v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53285
Joined: Tue Mar 17, 2015 9:14 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by chrisb »

abdullah wrote: Wed Jul 04, 2018 4:34 pm
chrisb wrote: Wed Jul 04, 2018 12:41 amNevertheless
Could you take a look at this other behaviour below?

A blue constraint should never be reported as redundant. That is rather strange and may be a separate bug. I am interested in reproducing it.
otoien wrote: Wed Jul 04, 2018 4:55 am After reviewing the above and some further experiences it seems that the solver has some limitations in indicating which redundant constraints to remove. On the next panel I am editing, after removing the all symmetry constraints, it even indicates that some length constraints that are marked in blue (that is blue numbers), which to my understanding should be non-driving dimensions (I used them just to indicate, not set distances) still get marked as redundant. It needs to be deleted to not be reported any more. If a red (driving) distance constraint that is reported as redundant is converted to blue with the toggle to from reference mode icon, it will still be reported as redundant. While this could be an indication that the solver does not adequately distinguish driving and non-driving constraints, it could also be an indication that it gets confused and that reporting is inaccurate.
I can do so later. @otoien: Can you simplify your example as far as possible so that it still shows the issue? Then please upload the simplified file.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
otoien
Posts: 87
Joined: Sun Aug 13, 2017 2:38 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by otoien »

Thanks @abdullah for looking at this, and @chrisb for further suggestions. Your comments made a lot of sense to me and aligning with my experiences. I am happy if this eventually can lead to sketcher improvement. Note that all sketches mentioned here by me were initially created with v. 0.17, thus the old solver. The shortcomings of the old solver were apparently not limited to the symmetry constraints as I have worked on sketches that still have problem after the symmetry constraints have been deleted. For some simple sketches the redundant constraint reporting is fairly accurate, but seems to have more problems the more complicated it becomes. I have also seen one or two cases where the reported constraint number were off by only one. The incorrect reporting of redundant constraints that are non-driving might simply be a cases where there is an offset in the reporting so that the incorrect constraint number is reported - thus I would hesitate to make a bug report on that as it might be the same issue.

I have attached another example sketch where this happened (initially created with 0.17 and then tried edited some with 0.18). Click on select and some of the blue constraints get marked as redundant (all the green ones shown in the screenshot). Delete some of them but not all or make another change and the whole selection will shift next time select is pressed. Note that deleting the symmetry constraints has no effect as I already deleted some offending horizontal/vertical ones. I actually had to give up this sketch and chose the path of least resistance (copied and modified another somewhat similar one that I already had successfully updated).
-
Sketcher-0_18-non-driving-constraint-problem-001.jpg
Sketcher-0_18-non-driving-constraint-problem-001.jpg (187.73 KiB) Viewed 1522 times
Test-sketch-002.FCStd
(17.48 KiB) Downloaded 40 times
(I am still using ver. 0.18.13999 as reported on the first page.)
chrisb
Veteran
Posts: 53285
Joined: Tue Mar 17, 2015 9:14 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by chrisb »

abdullah wrote: Wed Jul 04, 2018 4:34 pm
chrisb wrote: Wed Jul 04, 2018 12:41 amNevertheless
Could you take a look at this other behaviour below?

A blue constraint should never be reported as redundant. That is rather strange and may be a separate bug. I am interested in reproducing it.
otoien wrote: Wed Jul 04, 2018 4:55 am If a red (driving) distance constraint that is reported as redundant is converted to blue with the toggle to from reference mode icon, it will still be reported as redundant. While this could be an indication that the solver does not adequately distinguish driving and non-driving constraints, it could also be an indication that it gets confused and that reporting is inaccurate.
I have setup a test case but it doesn't show the issue. @otoien, can you please add a file where we can reproduce. I add mine here, the sketch is overconstrained. If I change one of the length constraints the overconstraint message vanishes.
Attachments
noRedundantDrivenConstraint.FCStd
(3.44 KiB) Downloaded 39 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53285
Joined: Tue Mar 17, 2015 9:14 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by chrisb »

otoien, you answered while I prepared my post. I will look at your file.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53285
Joined: Tue Mar 17, 2015 9:14 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by chrisb »

otoien wrote: Thu Jul 05, 2018 8:33 am I have attached another example
Are you interested in general comments about your sketch (on first sight they are horrible, e.g. having lines of zero length), or should I try to drill down to the oriiginal issue. The latter would save me a considerable amount of time, I guess.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by abdullah »

otoien wrote: Thu Jul 05, 2018 8:33 am I have also seen one or two cases where the reported constraint number were off by only one. The incorrect reporting of redundant constraints that are non-driving might simply be a cases where there is an offset in the reporting so that the incorrect constraint number is reported - thus I would hesitate to make a bug report on that as it might be the same issue.
I think you have hit the nail on the head. I have reopened yesterday's sketch, "RearPanel". Now I have selected the filter of "Reference Constraints" in the Constraint Widget, I have selected all of them and deleted them. Now it is a matter of clicking on the redundants hyperlink and deleting what the solver detects as redundant, which is basically a couple of constraints that are really redundant. Next you have 1 DoF which is a construction line missing locking one endpoint (just click on the hyperlink of the 1DoF). You add a point on object with the horizontal line below and it is done.

The same worked in your new example. Could you make some tests and report if "the problems are solved" after deleting the reference constraints?

If this is the case, then the bug for the tracker is "solver misreports redundancies in the presence of reference constraints".

ATM, I cannot fix it, but I have a pretty clear idea of where the problem might be.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by abdullah »

chrisb wrote: Thu Jul 05, 2018 11:01 am
otoien wrote: Thu Jul 05, 2018 8:33 am I have attached another example
Are you interested in general comments about your sketch (on first sight they are horrible, e.g. having lines of zero length), or should I try to drill down to the oriiginal issue. The latter would save me a considerable amount of time, I guess.
Sure, continue educating the users and then... who is supposed to report these bugs? :P :lol:
chrisb
Veteran
Posts: 53285
Joined: Tue Mar 17, 2015 9:14 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by chrisb »

abdullah wrote: Thu Jul 05, 2018 12:15 pm ATM, I cannot fix it, but I have a pretty clear idea of where the problem might be.
I have condensed two examples which might make it easier to search for the bugs. One of them contains one line and only one constraint so there is not much that can be conflicting
redundantOneConstraint.FCStd
(3.09 KiB) Downloaded 51 times
.
The other contains a driven (blue) measure which is marked as conflicting. I have more intermediate states saved with more driven measures marked as conflicting, just in case you need them.
Attachments
Test-sketch-simplified3.FCStd
(11.09 KiB) Downloaded 42 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53285
Joined: Tue Mar 17, 2015 9:14 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by chrisb »

@otoien: I have to row back a bit concerning your script. It doesn't contain lines of length 0 they are only very very short. Nevertheless you should try to avoid measures when you can use geometric constraints. As soon as the same measure occurs twice it is worth a second look if it can be replaced by an equality constraint.
Then your sketch is very complicated. In Creo existed the 7-7-7 rule of thumb (courtesy freecad-heini-1): A sketch should contain no more than 7 elements or should contain no more than 7 measures or should take no longer than 7 minutes.
These numbers can well be increased in FreeCAD, NormandC proposed a limit of 100 constraints. Using more is an indicator of too much complexity and makes the sketcher slow as well. It is then sensible to divide the sketch in several parts.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
otoien
Posts: 87
Joined: Sun Aug 13, 2017 2:38 am

Re: v.0.18 Sketcher detects redundant constraints vs. v.0.17

Post by otoien »

abdullah wrote: Thu Jul 05, 2018 12:19 pm
chrisb wrote: Thu Jul 05, 2018 11:01 am
otoien wrote: Thu Jul 05, 2018 8:33 am I have attached another example
Are you interested in general comments about your sketch (on first sight they are horrible, e.g. having lines of zero length), or should I try to drill down to the original issue. The latter would save me a considerable amount of time, I guess.
Sure, continue educating the users and then... who is supposed to report these bugs? :P :lol:
Note: The following was edited in parallel with the last two messages.

I posted the last file to provide an example of what happens with the reporting of redundant non-driving constraints, not in order to have someone spend time "fixing my file for me". However I would of course appreciate very much if you take time for providing any advice/criticism that can improve my practices forward and help me working out problems myself in the 0.17 to 0.18 solver transition (I already fixed a number of other sketches but still have a few more complicated ones left). Keep in mind that these sketches are part of the very first real project I started (in 0.17 and am still working on, now in 0.18), so yes there might be my old sins surfacing here, and in the last sketch in combination with me messing around in 0.18 to try solve the old problems. I am aware of one sketch where I at some point had a non-driving length constraint of zero due to some re-scaling, but cannot find it now, nor can recall multiple instances of it. I sure would like to have that pointed out to me.

A couple of additional comments:

If I tick on Extended information, some additional numbers show up on the constraints, Like Constraint1 [(0,2),(1,1)]. I could not find any documentation on this. What is this information?

I am finding that there are many cases where a constraint cannot be selected with the mouse. Most often this happens on vertical/horizontal constraints, but not exclusively. I am typically in a situation where I clicked "click to select" to select redundant constraints, then I un-selected them by clicking somewhere else, and then I try to select one of them with the mouse. (Of course this is what I mostly have been doing with these sketches not so it could be unrelated to this.) All tries to select fails, and moving the mouse cursor around to find the trigger point does not make them highlighted as with other constraints where selection work. So I end using the constraint list, selecting one after the other until finally the constraint I want to select lights up - very tedious. Again this could perhaps be due to some kind of corruption of my sketch, but thought I would mention it.
Post Reply