Sketcher does not allow usage of reference constraints

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Sketcher does not allow usage of reference constraints

Post by chrisb »

The sketcher in 0.17 does not allow the usage of reference constraints anymore, if they are defined in the same sketch. In 0.16 this is possible.
I think this feature is very useful to transport measures from one end to another. In many cases this can be achieved by other means as well, e.g. with additional construction lines and equality constraints but thinking of angles things become more difficult. As 0.16 shows it is well possible. Why has it been removed? Is there any advantage outwheighing the removal?
OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.12183 (Git)
Build type: Release
Branch: (detached from 7d4eafb)
Hash: 7d4eafbab04f85fc07100915130d720af599f1b6
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
Attachments
Bildschirmfoto 2017-09-23 um 09.26.40.png
Bildschirmfoto 2017-09-23 um 09.26.40.png (44.11 KiB) Viewed 4660 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Sketcher does not allow usage of reference constraints

Post by eivindkvedalen »

chrisb wrote: Sat Sep 23, 2017 7:27 am The sketcher in 0.17 does not allow the usage of reference constraints anymore, if they are defined in the same sketch. In 0.16 this is possible.
I think this feature is very useful to transport measures from one end to another. In many cases this can be achieved by other means as well, e.g. with additional construction lines and equality constraints but thinking of angles things become more difficult. As 0.16 shows it is well possible. Why has it been removed? Is there any advantage outwheighing the removal?
OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.12183 (Git)
Build type: Release
Branch: (detached from 7d4eafb)
Hash: 7d4eafbab04f85fc07100915130d720af599f1b6
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
Are you sure this works in the most recent version of 0.16? It's not supposed to work, as the solver is not updated with the reference constraints during the solving, but after a stable solution has been found.

Eivind
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher does not allow usage of reference constraints

Post by chrisb »

When I realized this issue in 0.17 I tried it in 0.16.6712 and I could bet it worked. Otherwise I would not have mentioned it explicitely.
When I try it now I cannot replicate, neither in 0.16.6712 nor in 0.17 as reported.

However, I found a way to implement such dependencies: Use a normal constraint in an Expression and turn it later into a reference. It works as expected.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Sketcher does not allow usage of reference constraints

Post by eivindkvedalen »

chrisb wrote: Sat Sep 23, 2017 11:07 pm When I realized this issue in 0.17 I tried it in 0.16.6712 and I could bet it worked. Otherwise I would not have mentioned it explicitely.
When I try it now I cannot replicate, neither in 0.16.6712 nor in 0.17 as reported.

However, I found a way to implement such dependencies: Use a normal constraint in an Expression and turn it later into a reference. It works as expected.
This is also not supposed to work, and I'd consider this a bug. The behaviour is undefined, and you're just lucky if it works as you expect. The closest working solution to what you want to archieve is to not refer to reference constraints, but use real constraints. This is well-defined, and works as expected.

Eivind
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher does not allow usage of reference constraints

Post by chrisb »

I now faintly remember that there was an issue with these reference constraints leading to more or less converging solutions of the constraints system.
Thanks for responding.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Sketcher does not allow usage of reference constraints

Post by Joel_graff »

chrisb wrote: Mon Sep 25, 2017 4:59 pm I now faintly remember that there was an issue with these reference constraints leading to more or less converging solutions of the constraints system.
Thanks for responding.
It would be nice to try to solve this problem so reference constraints can be used. To me , it seems as though the inability to use reference constraints has a significant impact on the usefulness of expressions in Sketcher. I can do what I need in Python, of course, but I almost didn't have to... :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
prandall
Posts: 76
Joined: Thu Feb 16, 2017 12:42 pm
Contact:

Re: Sketcher does not allow usage of reference constraints

Post by prandall »

I have been using reference constraints to make "calculators." It is very handy to have an angle in the reference constraint, name it, and be able to reference it in other areas.
3D Printing, CAD, Electronics and other errata at: https://www.youtube.com/channel/mathcodeprint
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Sketcher does not allow usage of reference constraints

Post by Joel_graff »

prandall wrote: Tue Apr 10, 2018 9:04 pm I have been using reference constraints to make "calculators." It is very handy to have an angle in the reference constraint, name it, and be able to reference it in other areas.
What version are you using?
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
prandall
Posts: 76
Joined: Thu Feb 16, 2017 12:42 pm
Contact:

Re: Sketcher does not allow usage of reference constraints

Post by prandall »

At the time of the post I was using 0.17 ( The latest daily build )

Now I am using 0.18

Code: Select all

OS: Linux Mint 17.3 Rosa
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.13588 (Git)
Build type: None
Branch: master
Hash: 1e2b9758cc7f6872da018ee71983a82499866508
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)
In this version of 0.18 you can not use the Reference constraint AND you can not change it to a Reference constraint after the fact. from the Toolbar. It just fails with no message.

However, if you right click in the Contstraints tab of Combo-Tasks, you can toggle to Ref constraint and the reference remains.

the calculation is unreliable tho ... so better not use it :(

A change in the ref constraint from Sketch-Edit mode does not update the Expression based constraint. However if you change the value in the Properties-Data tab it will update the value of the Expression in the driven constraint.

I will do a gif of this if needed/wanted
3D Printing, CAD, Electronics and other errata at: https://www.youtube.com/channel/mathcodeprint
dbecad
Posts: 80
Joined: Fri Mar 16, 2018 11:10 pm

Re: Sketcher does not allow usage of reference constraints

Post by dbecad »

I guess using construction mode geometry you can get a line of the right dimension and then use an equal constraint to do the "geometrical calculator" job.
However, as there are no equal constraints for angles, how do you do it ? Using an isosceles triangle should work but would be a pain to set up.
Is there reason why angle could not have equal constraints?
Cheers
Post Reply