Sketcher mini-features

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher mini-features

Post by abdullah »

wmayer wrote:...
Next mini-feature in my list is to fill-in the export dialog filename with the name of the feature to be exported.

Currently:
void StdCmdExport::activated(int iMsg)

uses:
FileDialog::getSaveFileName

with declaration:

static QString getSaveFileName( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(),
const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0 );

Do you think it would be possible to overload this function with an extra default parameter "const QString & suggestedFileName = QString()"?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher mini-features

Post by DeepSOIC »

I'd be grateful if you also fill in current filename of a saved FreeCAD project when doing a save-as. EDIT. Actually, no, don't do that :mrgreen:
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher mini-features

Post by DeepSOIC »

BTW, Part-o-magic has an Exporter feature, which does a similar but different thing.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher mini-features

Post by abdullah »

DeepSOIC wrote:I'd be grateful if you also fill in current filename of a saved FreeCAD project when doing a save-as. EDIT. Actually, no, don't do that :mrgreen:
Could you explain the reasons behind your reconsideration?

I think it saves time and that is why I have it in my mini-feature list (mainly that export to stl). However, something tells me that the reasons behind your change of mind may also be arguments against what I intend to do. Maybe you make me change my mind too ;)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher mini-features

Post by DeepSOIC »

Well, if I'm using save-as, I am likely wanting to save a file with a different name than what it used to be. Hence pre-filling the old one doesn't make much sense. And proper directory is opened by default.

For exporting, prefill it with feature name. IMO makes perfect sense.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher mini-features

Post by jmaustpc »

DeepSOIC wrote:Well, if I'm using save-as, I am likely wanting to save a file with a different name than what it used to be. Hence pre-filling the old one doesn't make much sense.
Most of the time I am using saveas to save a different version of the same thing, hence typically I want the same file name but add/edit a prefix or suffix to the file name.

For example, house and housewithgarage or more likely house1 and the house 2 etc. :)
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Sketcher mini-features

Post by wmayer »

adullah wrote:Group locking

Same example, just select all the centers of all the poles. Now select the origin. Now hit the lock constraint.
This implementation has a weakness when applying it on a rectangle.
  • Create a rectangle
  • Select the four corners
  • Select the origin
  • Press the lock button
On the screen it looks like it added four constraints but in fact it added eight and always two constraint symbol lie on each other which makes it hard to select and remove the redundant ones.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Sketcher mini-features

Post by Jee-Bee »

DeepSOIC wrote:
abdullah wrote:
triplus wrote:...When i select a single point and click on Coincident constraint. Pop-up is the outcome. Wouldn't it be better to do something useful instead. Like creating coincident constraint between the selected point and origin?
The question is, it is a common operation to make points coincident with the origin? In my workflow, either it gets constrained via "autoconstraints" on creation or it is extremely rare that I have to do this operation. If it is worth in your workflow, then I can implement it, it is not that it would take me more than 10 minutes. ;)
I would like it to find the closest point and get coincident to it. Also some smartness is due. So that it doesn't suddenly make a redundant coincident between points that have tangent connection applied already... and doesn't throw that point off the screen because the closest point happened to be so far away...
The question here is for all constraints. if one line or point selected and perpendicular is used, what then ... ?
I would suggest that automatically a task window is opened that add the selected point and where you can select a second or third element.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher mini-features

Post by abdullah »

wmayer wrote:
abdullah wrote:Group locking

Same example, just select all the centers of all the poles. Now select the origin. Now hit the lock constraint.
This implementation has a weakness when applying it on a rectangle.
  • Create a rectangle
  • Select the four corners
  • Select the origin
  • Press the lock button
On the screen it looks like it added four constraints but in fact it added eight and always two constraint symbol lie on each other which makes it hard to select and remove the redundant ones.
Werner, you have asked the sketcher for trouble :) and the sketcher has delivered!! :lol:

Seriously, now that you raised the point, maybe the problem is my expectations of the locking constraint. I expect a vertical + horizontal constraint on that point (probably because it is what it has historically done). I also expect it to not avoid, not even obvious redundancies (create a point, make a horizontal distance constraint on it. Now ask to lock the point. Redundant horizontal distance constraint created). From that point of view, the implementation for groups is neither better, nor worse than the original, but an extension to several geometries. The user must know what it is asking for or face the consequences... which potentially are of a greater scale, as more points are being constraint at the same time. When using the lock constraint, I personally would have selected two diagonal vertices and ask for a lock on those two.

However, now that you raised the point, I realise that "locking" for a user may mean "do whatever you have to do to make that thing locked and do not bring problems back to me". My view on this is that general point locking (for Geompoints and non-geompoint vertex without incurring in redundancies) can not be achieved without specialised solver information not available at this point (and subject to working in the regions where the solver works well for rank determination). If only, because there are infinite number of constraint combinations that would indirectly create a redundancy.

For full geometries, I have another mini-feature in mind, which makes use of solver ability to fix the parameters of a shape. A full geometry would then behave as it were an external geometry. This solves part of the use cases (locking a full bspline in place, while allowing the remaining part of the sketch to be normally edited). However, it does not solve the locking of non-geompoints vertex (e.g. endpoints of line, or center of a circle). For those, we still need the current distanceX, distanceY implementation.

All this to say:
1. I do not see how I can meaningfully improve the proposed commit implementation (I welcome any proposal of improvement).
2. In view of the other planed mini-feature, we need to differentiate or integrate in the UI (between) a "Fix geometry" constraint/assisting tool and the current "lock" constraint. If the general feeling is that they can achieve symbiosis under the same icon (geompoints will be locked via the yet to be implemented mini-feature; vertex not being a geompoint via traditional way), then they may be integrated together. If not, separate icons, names will have to be provided. In the latter case, it may we worth thinking whether we want to keep the "lock" name for the current implementation. A possibility is to cede the "lock" name to the yet to be implemented mini-feature and make a new name for the traditional "horizontal/vertical lock". Of course, that also raises issues as users are used to a terminology, icons and have expectations too ;)






I think it would be great to find right terminology for both. If I were to propose, I would opt to call the latter "lock" and find a new name for the current distancex-distancey implementation more in accordance with what it actually is.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Sketcher mini-features

Post by wmayer »

1. I do not see how I can meaningfully improve the proposed commit implementation (I welcome any proposal of improvement).
No problem. When doing it the first time it was a bit surprising. But since the solver afterwards shows the redundant constraints everything is fine and nothing special needs to be done.

However, one nuisance is still that the constraint symbols are coincident. Look at the following situation:
  • Draw a vertical line
  • If not automatically done set the vertical constraint to be sure the line is really vertical
  • Remove the vertical constraint
  • Select the two end points of the line and the origin
  • Apply the lock constraint
Now the two symbols that set the distance to the origin exactly overlap and I wonder if this can be avoided.
Post Reply