Sketcher sign issue with Expressions

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Sketcher sign issue with Expressions

Post by ulrich1a »

I have not followed the sketcher development for a longer time. Now I came over an issue, I did not have before. But maybe I have just not observed it before. I defined two vertical length in the sketcher. The sketcher shows them as positive numbers, but in the data tab of the Sketch-data one of the number is negative.
It seems to be dependent on the direction, with which the constrained line is drawn. This issue seems to have no effect, as long as the numbers are not used elsewhere. But if the length with the negative number is used with the expressions in another sketch, then the sign starts to matter. This will result in unsolvable sketches, until there is a negation put into the expression.

The following example shows the different signs in the sketch and the data tab.
Had anyone else the same issue?
Is this the intended behavior?

Ulrich
Attachments
Sketch_sign_issue2.png
Sketch_sign_issue2.png (126.5 KiB) Viewed 1550 times
Sketch_sign_issue1.png
Sketch_sign_issue1.png (160.33 KiB) Viewed 1550 times
Sketch_sign_issue.fcstd
(3.17 KiB) Downloaded 34 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Sketcher sign issue with Expressions

Post by DeepSOIC »

It was discussed, and it's in an intermediate state AFAIR. Let's see if I can dig out that thread...

Found!
viewtopic.php?f=10&t=12701
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Sketcher sign issue with Expressions

Post by eivindkvedalen »

ulrich1a wrote:I have not followed the sketcher development for a longer time. Now I came over an issue, I did not have before. But maybe I have just not observed it before. I defined two vertical length in the sketcher. The sketcher shows them as positive numbers, but in the data tab of the Sketch-data one of the number is negative.
It seems to be dependent on the direction, with which the constrained line is drawn. This issue seems to have no effect, as long as the numbers are not used elsewhere. But if the length with the negative number is used with the expressions in another sketch, then the sign starts to matter. This will result in unsolvable sketches, until there is a negation put into the expression.

The following example shows the different signs in the sketch and the data tab.
Had anyone else the same issue?
Is this the intended behavior?
This is an open issue with the expression integration in sketcher, imo. DeepSOIC has already provided the previous discussion above... I've rebased a proposed fix to latest master at https://github.com/eivindkv/free-cad-co ... ions_fixes that you can try.

This will keep the sign stable, and most likely what we want. Another option is to rearrange the constraint points on creation, to always end up initially with a positive sign. I think the discussion stopped there, because we could not reach a decision on what to do, so I never made a pull request for this patch.

Eivind
Post Reply