Hello I have a red color sketch and blue sketch which depends on red. Once I move to the right the red sketch, the blue one flips its direction. I don't want that. Pictures:

By the way, I found, if I make an angle constraint (90deg) instead of perpendicular, it seems the problem solved. But then, why?

## [SOLVED] Sketch constraint flips direction

### [SOLVED] Sketch constraint flips direction

Last edited by Artem_Zh on Tue Oct 10, 2017 6:09 am, edited 1 time in total.

### Re: Sketch constraint flips direction

Both versions, the flipped one and the not flipped, satisfy the constraints you gave. It is sometimes irritating that the solver does in this case not show degrees of freedom and the sketch is green and fully constraint and yet there are several different solutions.

The solver can only detect an infinite number of different solutions. As soon as there is only a finite number it is marked as solved. You found the solution yourself: Use constraints that make the solution a unique one.

The solver can only detect an infinite number of different solutions. As soon as there is only a finite number it is marked as solved. You found the solution yourself: Use constraints that make the solution a unique one.

A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.

### Re: Sketch constraint flips direction

I am not 100% sure but based on your description i feel you are talking about geometry flip occurring when you change the constraint value manually while in the Sketcher edit mode?

Edit -> Preferences ... -> Sketcher -> Enable Show advanced Solver Control in the Task bar

After you will enter the Sketcher edit mode the next time look in the sidebar and under Advanced solver control change the solver from default DogLeg to LevenbergMarquardt.

P.S. Complete the test again to see if the mentioned issue will still occur.

Edit -> Preferences ... -> Sketcher -> Enable Show advanced Solver Control in the Task bar

After you will enter the Sketcher edit mode the next time look in the sidebar and under Advanced solver control change the solver from default DogLeg to LevenbergMarquardt.

P.S. Complete the test again to see if the mentioned issue will still occur.

### Re: [SOLVED] Sketch constraint flips direction

I tested your solution, it works as well. As far as I understood, LevenbergMarquardt is more reliable solver, but could you provide some good practices, when do we need to use LevenbergMarquardt or DogLeg? Should we still use angle constraint against Perpendicular?triplus wrote: ↑Mon Oct 09, 2017 9:56 pm I am not 100% sure but based on your description i feel you are talking about geometry flip occurring when you change the constraint value manually while in the Sketcher edit mode?

Edit -> Preferences ... -> Sketcher -> Enable Show advanced Solver Control in the Task bar

After you will enter the Sketcher edit mode the next time look in the sidebar and under Advanced solver control change the solver from default DogLeg to LevenbergMarquardt.

P.S. Complete the test again to see if the mentioned issue will still occur.

### Re: [SOLVED] Sketch constraint flips direction

Good to hear that.

It was discovered a while back LevenbergMarquardt solver doesn't have the "flip issue".As far as I understood, LevenbergMarquardt is more reliable solver, but could you provide some good practices, when do we need to use LevenbergMarquardt or DogLeg? Should we still use angle constraint against Perpendicular?

https://forum.freecadweb.org/viewtopic. ... =30#p92119

And i didn't find any issues compared to DogLeg solver. Therefore it should be safe to always use LevenbergMarquardt solver to avoid the "flip issue". I am assuming there is some bug or something is missing in DogLeg solver implementation. That would address the "flip issue". But we are a bit short on developers having enough knowledge and determination to tackle this ATM.

P.S. Note that unfortunately when using expressions (this is just assumption) DogLeg solver is always being used. Therefore you can't avoid the "flip issue" ATM when using expressions.

### Re: [SOLVED] Sketch constraint flips direction

Understood.

Thank you

Thank you

### Re: Sketch constraint flips direction

What's new about this

- Flachy Joe -

"Puisqu’on ne peut changer la direction du vent, il faut apprendre à orienter les voiles." Anonyme

"Puisqu’on ne peut changer la direction du vent, il faut apprendre à orienter les voiles." Anonyme

Modélisations et Macros à la demande, contactez-moi en MP.