How to use position values in expressions?
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
How to use position values in expressions?
Hi folks,
I would like to define the position of Body2.Placement.Position.z in an expression, such as
Body1.Placement.Position.z + 123
but I cannot figure out (documentation, forum, google) the correct syntax. Interestingly, something like Pad1.Length does work in the formula… I could use a named spreadsheet cell to define the Body1 z position, and use that variable in both Body1 and Body2.Placement.Position.z, but I would rather use the z variable directly. Can someone give a hint?
Thanks in advance
Bass Mati
I would like to define the position of Body2.Placement.Position.z in an expression, such as
Body1.Placement.Position.z + 123
but I cannot figure out (documentation, forum, google) the correct syntax. Interestingly, something like Pad1.Length does work in the formula… I could use a named spreadsheet cell to define the Body1 z position, and use that variable in both Body1 and Body2.Placement.Position.z, but I would rather use the z variable directly. Can someone give a hint?
Thanks in advance
Bass Mati
Re: How to use position values in expressions?
it is Body.Placement.Base.x+123mm.
If you type "Body.Pla" in an expression aware field you see this in the autocompletion list.
Edits in blue.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to use position values in expressions?
You are right and I have edited my post above - thanks.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to use position values in expressions?
Thanks! Base was the missing member that carries the coordinates, so Body1.Placement.Base.z returns the desired value.
Autocompletion does not suggest the "base" member bevor the final letter e (on a Windows machine with realthunder's Assembly3 build), that's the reason I was stuck. Unit input was not the problem, I am aware of that.
Thanks a lot!
Autocompletion does not suggest the "base" member bevor the final letter e (on a Windows machine with realthunder's Assembly3 build), that's the reason I was stuck. Unit input was not the problem, I am aware of that.
Thanks a lot!
Re: How to use position values in expressions?
My advice is to explore this in the Python console.
You can use "App.ActiveDocument." then continue with the usual expression. Auto completion is far better in the console.
You can use "App.ActiveDocument." then continue with the usual expression. Auto completion is far better in the console.
Re: How to use position values in expressions?
Could you please retest this with a current 0.19? Here it is never an issue with autocompletion.
OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17681 (Git)
Build type: Release
Branch: master
Hash: e94af7ff5e873f263cac51d7d47df68eca183250
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to use position values in expressions?
I'll try to verify that. May take some time, I have to reorganize my model because recompute duration is exploding somewhat.
Currently I'm evaluating Realthunder's Assembly3 build. It's experimental and has a few problems here and there, so I guess/hope autocompletion problems appear only there.
Re: How to use position values in expressions?
@chrisb: Autocomplete works in mainstream 0.19, so it is an Assembly3-related issue. Only "complaint" is, in a formula editor dialog box, I am used to get a complete list of members when I enter an object name, followed by a dot (like "Body001."). In freecad, I need to know at least the first letter of the member name to get a pick list… But I can live with that.