how to add expression feature to a QuantitySpinBox

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
uwestoehr
Posts: 1964
Joined: Sun Jan 27, 2019 3:21 am

how to add expression feature to a QuantitySpinBox

Postby uwestoehr » Thu Mar 19, 2020 10:06 pm

I work frequently with Part/PartDesign primitives and it annoys me that I can define the offset using expressions but not the angle:
FreeCAD_oKAWuIXQWJ.png
Screenshot of TaskAttacher dialog
FreeCAD_oKAWuIXQWJ.png (10.97 KiB) Viewed 333 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?
openBrain
Posts: 4874
Joined: Fri Nov 09, 2018 5:38 pm

Re: how to add expression feature to a QuantitySpinBox

Postby openBrain » 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. ;)
chrisb
Posts: 29061
Joined: Tue Mar 17, 2015 9:14 am

Re: how to add expression feature to a QuantitySpinBox

Postby chrisb » Fri Mar 20, 2020 12:30 am

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.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
User avatar
uwestoehr
Posts: 1964
Joined: Sun Jan 27, 2019 3:21 am

Re: how to add expression feature to a QuantitySpinBox

Postby uwestoehr » Fri Mar 20, 2020 3:29 am

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?
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: how to add expression feature to a QuantitySpinBox

Postby wmayer » Fri Mar 20, 2020 7:41 am

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.
User avatar
uwestoehr
Posts: 1964
Joined: Sun Jan 27, 2019 3:21 am

Re: how to add expression feature to a QuantitySpinBox

Postby uwestoehr » Fri Mar 20, 2020 11:27 am

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!