Better Constraints for a more robust Model

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!
Post Reply
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Better Constraints for a more robust Model

Post by furti »

Hello,

I created a (not too complex model i thougth) model (see Attachment) and want it to be fully parametric. At least for me it looks pretty good so far. I can change the dimensions in the Spreadsheet and the model adapts to it.

But now comes the problem. When i change the length "B2" in the Spreadsheet to 80mm "Sketch001" breaks appart. The two upper points change positions and the lines cross each other. And it is Pretty clear that the pocket does not like this at all :D
Flipped_Points.png
Flipped_Points.png (33.41 KiB) Viewed 635 times
Sometimes it happens with 70mm too. But most of the time 70mm work perfect. How could i change the constraints in Sketch001 so that the solver knows that the one point should be above the other one? Has anyone a idea?

My FreeCAD Info:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13510 +12 (Git)
Build type: Release
Branch: 
Hash: 3bb5ff4e70c0c526f2d9dd69b1004155b2f527f2
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Austria (de_AT)
Thank you for your help in advance :)
Staender.FCStd
(24.4 KiB) Downloaded 17 times
dbecad
Posts: 80
Joined: Fri Mar 16, 2018 11:10 pm

Re: Better Constraints for a more robust Model

Post by dbecad »

Good day Furti,
i could not completely fix your model because even when the groove was fixed by using parallel constraints instead of distances and symmetry, the main sketch would also break in other occasions.
You are using a lot of distance/symmetry constraints, try to change them to parallel ones. Distance do not have side (to the left or right) so you can end up with weird crossings that still respects your constraints.
I've redone an sketch with the shape and the grooves as construction lines but without any dimensions. You can try to stretch/move any points to see if it reacts as expected before applying measurements. If something does not work as expected, you have to figure out why the solver allows the solution that you get.
staender.png
staender.png (21.97 KiB) Viewed 601 times
You might want to change the equal constraints 15 if you don't want to have the same radius on top & inside the frame.
Cheers
Attachments
Staender_sketch.FCStd
(4.42 KiB) Downloaded 9 times
Last edited by dbecad on Tue May 29, 2018 10:34 pm, edited 1 time in total.
chrisb
Veteran
Posts: 54144
Joined: Tue Mar 17, 2015 9:14 am

Re: Better Constraints for a more robust Model

Post by chrisb »

You should delete the redundant Point-on-object constraint.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Better Constraints for a more robust Model

Post by furti »

dbecad wrote: Tue May 29, 2018 10:33 pm You are using a lot of distance/symmetry constraints, try to change them to parallel ones.
Thanks for pointing me in that direction dbecad. I don't know why I didn't even think about using parallel constraints at all :oops: With parallel constraints the model is a lot more robust. But still breaking sometimes on big values for the overall length (500 mm upwards) with:

Code: Select all

Updating geometry: Error build geometry(7): gp_Circ::SetRadius() - radius should be positive number
Invalid solution from DogLeg solver.
Updating geometry: Error build geometry(8): gp_Circ::SetRadius() - radius should be positive number
Invalid solution from LevenbergMarquardt solver.
Don't know why :?:

chrisb wrote: Tue May 29, 2018 10:34 pm You should delete the redundant Point-on-object constraint.
What constraint do you mean?



When working on the Sketch for the grooves something weird happend.
I created a Sketch and imported some edges from the base Sketch with the external geometry tool. Then I added a line and a symmetry constraint on one of the external references. (The white lines in the screenshot are from the base sketch that is still visible)
Sketch002.png
Sketch002.png (8.58 KiB) Viewed 552 times
When I change the Length in the Spreadsheet the Sketch breaks with the message:

Code: Select all

Sketch contains conflicting constraints


Then i tried to Import the reference and add a construction line with two Point on Point constraints and add the symmetry constraint to this construction line.
Sketch001.png
Sketch001.png (10.18 KiB) Viewed 552 times
When the length i changed now the sketch does not break and the symmetry constraint is updated as expected.


Is this the desired behavior or is this a bug? I would have expected the symmetry constraint on the external edge to work.
I uploaded the File so you can play around with it as you wish.


Thank you for your help :)
Staender.FCStd
(15.55 KiB) Downloaded 11 times
chrisb
Veteran
Posts: 54144
Joined: Tue Mar 17, 2015 9:14 am

Re: Better Constraints for a more robust Model

Post by chrisb »

furti wrote: Fri Jun 01, 2018 6:37 pm
chrisb wrote: Tue May 29, 2018 10:34 pm You should delete the redundant Point-on-object constraint.
What constraint do you mean?
Ok, my comment was a bit short due to the fact that I had repeated it in the last days several times in different tastes and I think that newbies have a look now and then at other posts too.

Here we go again:
The symmetry constraint implies one of the two point-on-object constraints of its endpoints.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Better Constraints for a more robust Model

Post by furti »

chrisb wrote: Fri Jun 01, 2018 7:54 pm The symmetry constraint implies one of the two point-on-object constraints of its endpoints.
Thanks for pointing that out. I realized that too when I started to reconstraint my Sketches.
But this kind of Problem is a bit hard to find. At least when "Auto constraints" are enabled.

E.g. The "Point on Object" constraint on the X Axes are created automatically.
pointonobject.png
pointonobject.png (6.33 KiB) Viewed 522 times
When one adds the symmetry constraint later on, the two "Point on Object" Constraints are still there, but the Solver doesn't tell you that at least one of them is redundant.
symmetry.png
symmetry.png (13.84 KiB) Viewed 522 times

BTW: I read a lot of other posts too. But somehow I didn't came across a post that pointed that out. Or maybe I did but didn't realize that this applies to my model too ;)

Thanks a lot for your help :)
chrisb
Veteran
Posts: 54144
Joined: Tue Mar 17, 2015 9:14 am

Re: Better Constraints for a more robust Model

Post by chrisb »

furti wrote: Sat Jun 02, 2018 5:39 am E.g. The "Point on Object" constraint on the X Axes are created automatically.
pointonobject.png
When one adds the symmetry constraint later on, the two "Point on Object" Constraints are still there, but the Solver doesn't tell you that at least one of them is redundant.
I recommend that you upgrade to the current development version. It has massive sketcher improvements included, so the redundancies would have been detected immediately.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Better Constraints for a more robust Model

Post by furti »

chrisb wrote: Sat Jun 02, 2018 6:52 am I recommend that you upgrade to the current development version.
Thanks for the tip. The 0.18 development Version indeed finds this redundant constraints :)

I found something that looks like a bug to me. When two points overlap in the Sketcher in 0.18 the highlight color is not shown anymore. This worked with the latest 0.17 version.

Point is highlighted when not overlapping:
no_overlap.png
no_overlap.png (1.8 KiB) Viewed 480 times
Point is not highlighted when overlapping:
overlap.png
overlap.png (1.84 KiB) Viewed 480 times
Does not work in:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13870 (Git)
Build type: Release
Branch: master
Hash: f0964a9c052ee666631cd9caec1655790964ecb6
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Austria (de_AT)
Works with:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13510 +12 (Git)
Build type: Release
Branch: 
Hash: 3bb5ff4e70c0c526f2d9dd69b1004155b2f527f2
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Austria (de_AT)
chrisb
Veteran
Posts: 54144
Joined: Tue Mar 17, 2015 9:14 am

Re: Better Constraints for a more robust Model

Post by chrisb »

This has already been reported and Abdullah is aware of it. Everything works if you switch off the grid.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply