[Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

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
gntech
Posts: 56
Joined: Tue May 23, 2017 9:03 am

[Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

Post by gntech »

OS: KDE neon User Edition 5.16 (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17140 (Git) AppImage
Build type: Release
Branch: master
Hash: 961ffce93e0fff6f1bf8326af248fda3f608215f
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

I have noticed a possible bug in the way the sketcher solves constraints on a sketch when a dimension is changed. See pictures below and their subtitles for an explanation.
Attachments
sketch_example.FCStd
This file contains the sketch.
(5.42 KiB) Downloaded 33 times
Consider the following sketch which is symmetric around the Y-axis and fully constrained.
Consider the following sketch which is symmetric around the Y-axis and fully constrained.
sketcher_1.png (11.71 KiB) Viewed 1138 times
If the 20 mm dimensions is increased slightly everything updates correctly.
If the 20 mm dimensions is increased slightly everything updates correctly.
sketcher_2.png (12.45 KiB) Viewed 1138 times
However for a large change in the dimension the right side of the sketch flips. This is obviously an undesired behaviour.
However for a large change in the dimension the right side of the sketch flips. This is obviously an undesired behaviour.
sketcher_3.png (12.79 KiB) Viewed 1138 times
juless
Posts: 19
Joined: Wed Apr 24, 2019 11:46 am

Re: [Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

Post by juless »

Looking at it briefly, although the sketch is fully constrained, you may want to change the dimension constraint for another symmetry constraint. As you can see in your example, its ambiguous where changed line should go - it's definitely not symmetrically around the y axis as I think you intend.
chrisb
Veteran
Posts: 54313
Joined: Tue Mar 17, 2015 9:14 am

Re: [Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

Post by chrisb »

This behaviour is well known and it is not considered to be a bug: All constraints are fulfilled in both cases.
Nevertheless this could be improved to work more intuitively and there is ongoing work on it from time to time.
Levenberg-Marquardt solver (use it after switching on the expert settings in Sketcher's preferences) usually handles this better.

You can improve things by using different constraints. Symmetry was already mentioned. Using angles instead of distance dimensions often helps as well.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: [Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

Post by bejant »

Here is a method using just a few different Constraints, following the suggestion that chrisb wrote, making Sketch become more robust:

20190626a.png
20190626a.png (14.26 KiB) Viewed 1106 times
The most important new Constraint is probably the Symmetry Constraint that was applied between the bottom outer vertices and the Y-axis.

20190626a-sketch_example.FCStd
(5.42 KiB) Downloaded 39 times
gntech
Posts: 56
Joined: Tue May 23, 2017 9:03 am

Re: [Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

Post by gntech »

Sorry for replying so late
chrisb wrote: Wed Jun 26, 2019 9:34 pm Levenberg-Marquardt solver (use it after switching on the expert settings in Sketcher's preferences) usually handles this better.
Thanks for the suggestion, this solved my issue! Levenberg-Marquardt behaves the way I am used to from commercial CAD software. It maintains the topology of the sketch when editing a fully defined sketch.

Can this be set as the default for all sketches? Is there some known drawback with it?
chrisb
Veteran
Posts: 54313
Joined: Tue Mar 17, 2015 9:14 am

Re: [Sketcher] Part of sketch flips when changing dimensions in fully constrained sketch

Post by chrisb »

I remember that LM-solver on some occasions was not able to solve a mathematically solvable sketch.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply