[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!
Locked
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

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

Post by uwestoehr »

The Sketcher WB has a performance problem when a sletch has several 100 constraints. Take for example the case you design a circuit board. Here is an example file:
Sketch-Constraint-test.FCStd
(28.54 KiB) Downloaded 122 times

- open in the file the "Sketch-Elektrode-00"
- despite the sketch is relatively simple, it has > 500 constraints. The problem is that they pollute the view:
FreeCAD_xWlh8CiC5P.png
FreeCAD_xWlh8CiC5P.png (60.48 KiB) Viewed 9392 times

For real-life you need 2 views to keep the overview, to present and discuss the design with colleagues and customers:
A: only with the datum constraints displayed
B: and without any constraints displayed

Let's try to get view A:
- we first need to hide all constraints, so we go into the constraints list, select the first constraint, keep Shift pressed and select the last constraint
result: this takes here 50 seconds (and severely, Windows tells me that FreeCAD is not responding anymore just after 5 seconds, so FreeCAD misses to tell the OS, that it is still alive, just calculating)
- now right click and in the context menu choose "Hide constraints"
result: this takes here 101 seconds
- now filter the datums
- select all datums -> takes 7 seconds
- show all datums -> takes 13 seconds

So in total one needs 171 seconds, almost 3 minutes to get the desired view.

Once one has this view one usually needs only to toggle between view A and B, these are each 20 seconds.

-----------------

The PR implements the option to hide/show all currently listed constraints to save the time one needs to select all constraints manually.
So going from all constraints shown to view A needs with this option "only" 114 seconds and when toggling the datum view, 13 seconds.

There is still room for improvement since it is unclear why hiding/showing just 4 constraints needs 13 seconds. But the new option is in general a convenience option to save the annoying manual selection of all listed constraints.

abdullah wrote: .
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 »

Good addon - thanks!
(While I wouldn't encourage people to sketch/model in that way.)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
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 »

chrisb wrote: Mon Jul 26, 2021 9:23 am (While I wouldn't encourage people to sketch/model in that way.)
How else should I design?
User avatar
M4x
Veteran
Posts: 1449
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

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

Post by M4x »

Nice idea! The."FreeCAD is missing to tell the OS that it is still alive" happens regulary for me. Mostly in TechDraw or when I'm creating meshes. I assume it's a general problem.

Regarding the design discussion: Maybe a seperate thread would be a good idea here.
User avatar
obelisk79
Veteran
Posts: 1032
Joined: Thu Sep 24, 2020 9:01 pm

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

Post by obelisk79 »

I recently have been thinking about this kind of option.

I am currently unable to test the PR. However would it be much more difficult to have a checkbox that 'auto hides' geometric constraints? So only constraints for currently selected sketch elements are displayed?

Explanation: If I sketch a rectangle, I inherently understand that vertical and horizontal lines are constrained. However, if I want to see, modify or delete those constraints I can select the associated element (line, vertex, curve etc) and they would be displayed. Dimensional constraints would always be visible and if a user ever decided they need to see them all at once, they could either "CTRL-A" the sketch or toggle the setting in the tasks panel.

Just a thought.
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 »

uwestoehr wrote: Mon Jul 26, 2021 12:21 pm How else should I design?
Hard to say without the file and without knowing what you model, but you can almost always split the sketch in two or more. From what I can see, the sketch seems to by symmetric. You may use this fact by applying an appropriate pattern function.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
C_h_o_p_i_n
Posts: 225
Joined: Fri Apr 26, 2019 3:14 pm

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

Post by C_h_o_p_i_n »

Hi All,

but ... splitting a sketch also looks like a "workaround" - wouldn't a more general solution be better ?

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 ?

Regards,
Stefan
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 »

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 ?
Interesting idea. I'm afraid I'm running out of good colors to display this :lol: .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
C_h_o_p_i_n
Posts: 225
Joined: Fri Apr 26, 2019 3:14 pm

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

Post by C_h_o_p_i_n »

Hi All,

well - how about - alternating green-yellow - in an analogy to the protective ground ( Schutzleiter ) in wiring.

Greetings,
Stefan
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 »

double coloured or dashed lines were already discussed before to distinguish construction or external geometry. But that seems currently to be impossible: either all or no dashes.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Locked