Page 1 of 1

how to add expression feature to a QuantitySpinBox

Posted: Thu Mar 19, 2020 10:06 pm
by uwestoehr
I work frequently with Part/PartDesign primitives and it annoys me that I can define the offset using expressions but not the angle:
Screenshot of TaskAttacher dialog
Screenshot of TaskAttacher dialog
FreeCAD_oKAWuIXQWJ.png (10.97 KiB) Viewed 872 times

Therefore I wanted to add the missing expression feature but cannot figure out how. Has anybody a pointer for me please to learn how this is done?

Re: how to add expression feature to a QuantitySpinBox

Posted: Thu Mar 19, 2020 10:30 pm
by openBrain
As this angles are basically yaw/pitch/roll, I advise that you have a look at notes of issue #4106 and related links before getting started. ;)

Re: how to add expression feature to a QuantitySpinBox

Posted: Fri Mar 20, 2020 12:30 am
by chrisb
It seems that these are not enabled for expressions for the same reason as the Placement dialog is not expression aware: They are already calculated values.

Re: how to add expression feature to a QuantitySpinBox

Posted: Fri Mar 20, 2020 3:29 am
by uwestoehr
openBrain wrote: Thu Mar 19, 2020 10:30 pm As this angles are basically yaw/pitch/roll, I advise that you have a look at notes of issue #4106 and related links before getting started. ;)
My question is not bound to these specific SpinBoxes, but in general: How do I add the expression feature to a SpinBox?

Re: how to add expression feature to a QuantitySpinBox

Posted: Fri Mar 20, 2020 7:41 am
by wmayer
uwestoehr wrote: Fri Mar 20, 2020 3:29 am My question is not bound to these specific SpinBoxes, but in general: How do I add the expression feature to a SpinBox?
https://github.com/FreeCAD/FreeCAD/blob ... rs.cpp#L97

All what's needed is to use the bind for the property you want to control. The ability to set expressions is done automatically.

Re: how to add expression feature to a QuantitySpinBox

Posted: Fri Mar 20, 2020 11:27 am
by uwestoehr
wmayer wrote: Fri Mar 20, 2020 7:41 am All what's needed is to use the bind for the property you want to control. The ability to set expressions is done automatically.
Many thank!