[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!
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

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

Post by adrianinsaval »

C_h_o_p_i_n wrote: Wed Jul 28, 2021 8:13 am how about an tag to define parts of the sketch as "static" ( or ready/or done) ... so that the solver does not need to "solve" / touch this (tagged) part of the sketch any more ?
Isn't that what the block constraint does?
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

adrianinsaval wrote: Fri Jul 30, 2021 3:38 am Isn't that what the block constraint does?
Sort of yes. BUT: currently additional constraints have precedence over a block constraint, and even if that is fixed, the block constraint only consume the remaining degrees of freedom. So all other constraints would have to deactivated or deleted to achieve the behaviour of "this part doesn't need any solving".
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

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

Post by adrianinsaval »

what if you set the block constraint and then deactivate the other constraints of the element? maybe the proposed feature could be achieved by automating this?
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

adrianinsaval wrote: Fri Jul 30, 2021 2:23 pm what if you set the block constraint and then deactivate the other constraints of the element? maybe the proposed feature could be achieved by automating this?
That would indeed be a possibility, it could even be achieved by a Python macro. The way back is possible too, but it would make all deactivated constraint active again, even those that had initially already been deactivated. It is similar to use an editors block comment function to comment/uncomment a whole block of code.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

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

Post by chennes »

This UI doesn't quite make sense to me: I don't think a checkbox is the right element to achieve this (though I support the feature itself 100%). What you really have here is more like a standard pushbutton, in that it takes a single action: "Check all the displayed checkboxes" and "Uncheck all the displayed checkboxes". I have not dug into Qt Designer to mock anything up, but I wonder if a better UI wouldn't be two pushbuttons labeled "Show all" and "Hide all" either immediately above or immediately below the list of constraints.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

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

Post by uwestoehr »

chennes wrote: Fri Aug 20, 2021 3:47 am I don't think a checkbox is the right element to achieve this (though I support the feature itself 100%). What you really have here is more like a standard pushbutton
Why do you think so? We need 2 states. This can be achieved by a push button, but in the FC dialogs, the checkbox is used the most. Here in the dialog, there are other checkboxes existing, so a checkbox is in my opinion the right choice.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

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

Post by chennes »

My thinking is that the states are already represented by the series of checkboxes next to each constraint: so what we need is not a new state, but rather an action that manages the existing states.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

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

Post by uwestoehr »

chennes wrote: Sun Aug 22, 2021 9:06 pm My thinking is that the states are already represented by the series of checkboxes next to each constraint: so what we need is not a new state, but rather an action that manages the existing states.
But this is the a new state - hide/show the constraints in the list view. So a push button would do the job as well, but within the existing dialog this looks strange to me while an option follows the current dialog style.

However, I would like to hear abdullah's opinion since he designed the current dialog and I haven't yet heard from him about the PR at all.
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 »

uwestoehr wrote: Sun Aug 22, 2021 9:35 pm
chennes wrote: Sun Aug 22, 2021 9:06 pm My thinking is that the states are already represented by the series of checkboxes next to each constraint: so what we need is not a new state, but rather an action that manages the existing states.
But this is the a new state - hide/show the constraints in the list view. So a push button would do the job as well, but within the existing dialog this looks strange to me while an option follows the current dialog style.

However, I would like to hear abdullah's opinion since he designed the current dialog and I haven't yet heard from him about the PR at all.
Yes, it is highly unfortunate that I have kept you waiting for so long. Sorry for that.

To honor the truth, I was not the designer of the Constraints widget. I created the Elements widget. I have modified the Constraints widget and I am not sure myself that I have always done it with a sound UI criteria. I am not really good that UI design.

The most striking thing is that we are talking about an order of magnitude of minutes to hide a layer (or part of a layer when dimensionals are wanted). That is something that we should look at (independently of what I write below). [oh my! I just checked with an array of 4x5 constrained rectangles, it takes way too much, this I need to check/profile and fix]

When looking into that, it might be that we want to only tackle the representation and not the state (just thinking out loud). That could be an alternative solution (for a slightly different problem). If the final solution goes in that direction (which I am not sure yet and feedback is welcome), then maybe the right place is in the sketch view control (where you set the sketch perpendicular, or activate/deactivate the section). If that is the place, then we could have a toggle button alike feature.

If that is not possible or wanted or interferes with other functionality, or if we want to have this option too independently, then we need to decide which kind of control to set. If you tell me to implement a way to unselect all other constraints, I directly think of this checkbox that appears in some UIs on the label (on top of the first selectable item), that when you uncheck, all the items get unchecked and when you check all the items get checked. When you operate on the individual checkboxes in the list, this gets a third state automatically (I am not sure where I have seen that though, I have tried to search for it without luck). Then, there are many interfaces where there are buttons as chennes says. There are some where there is a separate checkbox (like the one I describe above, but not in the label, but on top of the label as a separate control, like the one of the PR).

Looking at the PR functionality, there are some caveats:
- after one hides everything (by checking the checkbox), if one checks one of the individual checkboxes, the constraint is checked (in the list), shown in the 3D view, but the hide/show all listed constraints continues checked. There appears to be an expectation from the user that when the "hide" mode is selected nothing is shown and if something is shown the the "hide mode" does not appear selected.
- similarly, one can have the checkbox unchecked (show all) and remove individual elements. The same expectation as above but in the reverse.
- this could be automated, but I think then we would need a third state (neither all are shown, nor all are hidden).

The automation would only get more complicated if we start having more options (like hide everything but dimensionals). For this reason, I tend to think that the checkbox solution is not as scalable/clear as simple buttons. Think for example:
- Do we put a second checkbox and when checking it (show dimensionals) we uncheck the "hideall" checkbox and uncheck all the individual checkboxes? Do we put it in a third state? And when we uncheck that one, do we remember the previous state of the "hideall" checkbox?

With two checkboxes the solution appears counterintuitive and over complicated. Maybe the reason is that as chennes points out, the state of each individual element already lies within the element. Having a state that overrules the states is necessarily redundant. This redundancy creates the need of synchronisation when operating the different checkboxes.

Buttons however are designed to trigger actions without caring about states (non-toggable normal buttons), which appears to be what we would like to have here.

... too much speaking out loud... do I make sense?
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: Fri Sep 17, 2021 11:05 pm Buttons however are designed to trigger actions without caring about states (non-toggable normal buttons), which appears to be what we would like to have here.
Hello abdullah, I totally agree with you on this point.

In fact I suggest to make the following 2 changes:
1) Add a couple of buttons (or commands) to hide/unhide all (non dimensional) constraints.
2) The command "Select associated constraints" (I have used it in the RT branch) which selects the constraints associated with selected geometry should become: "Unhide associated constraints".

So, in order to see the constraints associated with a geometrical element (let say an Edge) you would have to:
-Hide all constraints
-Select the element and use "Unhide associated constraints"

You may then revert back to the visualization of all constraints pressing:
-Unhide all constraints.
Locked