[Resolved] PR #4942 new option to show/hide sketcher constraints

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
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: PR #4942 new option to show/hide sketcher constraints

Post by abdullah »

I am trying to think this thru again.

There is one caveat. When I implemented what is called "hiding constraints", I was not implementing "hiding" of constraints. I was implementing a different concept called "virtual space". The idea was to be able to have (some) constraints in different "virtual spaces" and being able to switch between virtual spaces. It was intended as a functionality to enable to work in parts of a complex sketch without being cluttered by the rest. Ultimately, the community only saw merit in having one virtual space and use it to hide what is unwanted.

If one has all the constraints shown (in the first virtual space, which is made the real space), to hide all of them it suffices to make the second virtual space the real one, by pressing this forgotten button (without any selection):
https://wiki.freecadweb.org/Sketcher_SwitchVirtualSpace

This takes no time at all. It is instantaneous.

Now, I have to think how to match this concept with the showing only dimensionals...
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4942 new option to show/hide sketcher constraints

Post by abdullah »

A small demo video (this code is master since a long time):
Peek 18-09-2021 20-34.gif
Peek 18-09-2021 20-34.gif (238.88 KiB) Viewed 3033 times
wsteffe
Posts: 461
Joined: Thu Aug 21, 2014 8:17 pm

Re: PR #4942 new option to show/hide sketcher constraints

Post by wsteffe »

Hello abdullah, I was not aware of the "Switch Virtual Space" Command.

Using the Commands "Switch Virtual Space" and "Select associated constraints" (this one is present in the RT branch and I do not know if it is also in the Master) it is easy to visualize only the constraints associated with a given geometrical element.

In fact after pressing "Switch Virtual Space" all constraint are hidden. Then selecting an edge and pressing "Select associated constraints" the edge related constraints are not only selected (in the Task View) but are also unhiden in the sketch view.

The selective hiding/unhiding of dimensional and non dimensional constraints would be a nice feature but not really necessary.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4942 new option to show/hide sketcher constraints

Post by abdullah »

wsteffe wrote: Sat Sep 18, 2021 7:16 pm Hello abdullah, I was not aware of the "Switch Virtual Space" Command.

Using the Commands "Switch Virtual Space" and "Select associated constraints" (this one is present in the RT branch and I do not know if it is also in the Master) it is easy to visualize only the constraints associated with a given geometrical element.

In fact after pressing "Switch Virtual Space" all constraint are hidden. Then selecting an edge and pressing "Select associated constraints" the edge related constraints are not only selected (in the Task View) but are also unhiden in the sketch view.

The selective hiding/unhiding of dimensional and non dimensional constraints would be a nice feature but not really necessary.
I can confirm that "select associated constraints" is in master as I coded it some years ago.

My post is not to be understood that it shouldn't be additional automation. Rather, it attempts to trigger the discussion to see how this is best automated, so that it is flexible enough to match several use cases, and thus becomes useful for a greater user base.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #4942 new option to show/hide sketcher constraints

Post by chrisb »

If I understand things right, the technique of hiding was already mentioned in the first post, but the performance was a problem if a sketch contained too many constraints.

Another - possibly related - thing I would like to see is the possibility to select all types of constraints separately, i.e. not only All/Normal (don't know the difference to All anyway)/Datums/Named/Reference, but also Tangent, Coincidence, ...
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wsteffe
Posts: 461
Joined: Thu Aug 21, 2014 8:17 pm

Re: PR #4942 new option to show/hide sketcher constraints

Post by wsteffe »

abdullah wrote: Sat Sep 18, 2021 6:30 pm I was not implementing "hiding" of constraints. I was implementing a different concept called "virtual space".
Would it be possible to have the same constraint in both virtual spaces ?

If true I would change the behaviour of switching to second VS in such a way that selected constraints are copied (and not moved).
The first VS would always show all the constraints and switching back to it would be equivalent to "Unhide all constraints".
The second VS would still show the constraints selected by the user.

The possibility to forget some constraints moved on the second VS would so be eliminated.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4942 new option to show/hide sketcher constraints

Post by abdullah »

wsteffe wrote: Sun Sep 19, 2021 5:50 am
abdullah wrote: Sat Sep 18, 2021 6:30 pm I was not implementing "hiding" of constraints. I was implementing a different concept called "virtual space".
Would it be possible to have the same constraint in both virtual spaces ?

If true I would change the behaviour of switching to second VS in such a way that selected constraints are copied (and not moved).
The first VS would always show all the constraints and switching back to it would be equivalent to "Unhide all constraints".
The second VS would still show the constraints selected by the user.

The possibility to forget some constraints moved on the second VS would so be eliminated.
That part is implemented already in master (and should be part of RT unless he decided to remove it). The virtual spaces are mutually exclusive in the current implementation. The current implementation only supports two virtual spaces (with more than two one needs a more sophisticated management of virtual spaces). Because there was no much interest in having more virtual spaces, they were made exclusive. It is not a hard limitation, we can change behaviour if it fits better the user cases.

There is one important aspect. Constraints are neither trully "moved" nor "copied". It is a mere visibility arrangement (that is why I was surprised of the time it takes when going through the widget). The more I look into it, the more I tend to think that the widget is not the right place for this. Rather, buttons with commands rearranging the visibility of groups of constraints belong to the toolbar next to the "switch virtual space" button. I think that would be efficient and intuitive, leaving the widget for fine-tunning visibility of individual constraints. This would also reduce the bloating of the constraint widget with buttons. I am still thinking about it.

The idea should also play well with future "geometry layers" feature. This will enable geometry to be arranged in layers (that is both a visibility and a functional arrangement). It should enable a more powerful carbon copy. However, constraints may be cross layer (for example, when a sketch has "imported" another via carbon copy and coincidents between sketches are introduced).
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4942 new option to show/hide sketcher constraints

Post by abdullah »

chrisb wrote: Sat Sep 18, 2021 9:54 pm If I understand things right, the technique of hiding was already mentioned in the first post, but the performance was a problem if a sketch contained too many constraints.

Another - possibly related - thing I would like to see is the possibility to select all types of constraints separately, i.e. not only All/Normal (don't know the difference to All anyway)/Datums/Named/Reference, but also Tangent, Coincidence, ...
Yes, a way of hiding was shown. Not the use of the "switching virtual space". The latter is very efficient (it is instantaneous with a high amount of constraints). It has limitations, as it is only a show all/hide all tool when one virtual space is empty. Otherwise it is a switch between mutually exclusive sets of constraints.

I will review the filter of the widget.
wsteffe
Posts: 461
Joined: Thu Aug 21, 2014 8:17 pm

Re: PR #4942 new option to show/hide sketcher constraints

Post by wsteffe »

abdullah wrote: Sun Sep 19, 2021 6:15 am Rather, buttons with commands rearranging the visibility of groups of constraints belong to the toolbar next to the "switch virtual space" button.
I agree on this point. But the virtual space switching could still play a role.
If the mutual exclusivity were removed the 2 Virtual Spaces (or a number of VS > 2) could store different settings of constraint visualization.
In my opinion it would be a nice feature.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #4942 new option to show/hide sketcher constraints

Post by chrisb »

abdullah wrote: Sun Sep 19, 2021 6:24 am I will review the filter of the widget.
I may be one of the rare users, who had waited for more virtual spaces. If constraints can be shown in multiple virtual spaces, it could be used to have a virtual space for each type of constraint plus one for all, plus custom user spaces.

Just dreaming.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Locked