Sketcher sign issue with Expressions

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
ulrich1a
Posts: 1905
Joined: Sun Jul 07, 2013 12:08 pm

Sketcher sign issue with Expressions

Postby ulrich1a » Sat Nov 28, 2015 8:31 pm

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 772 times
Sketch_sign_issue1.png
Sketch_sign_issue1.png (160.33 KiB) Viewed 772 times
Sketch_sign_issue.fcstd
(3.17 KiB) Downloaded 10 times
User avatar
DeepSOIC
Posts: 7167
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Sketcher sign issue with Expressions

Postby DeepSOIC » Sun Nov 29, 2015 12:14 am

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: 598
Joined: Tue Jan 29, 2013 10:35 pm

Re: Sketcher sign issue with Expressions

Postby eivindkvedalen » Sun Nov 29, 2015 12:57 am

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