ickby wrote:Hello Eivind,
I'm looking into binding the expressions of properties in the property editor. One question I can't find anything about: is it possible to bind expressions to a properties subvalue? For example if I have a quantify spin box for each component of a vector x y and z, can I bind this somehow? This would be handy for placements in the property editor.
Hi, this is possible using the ExpressionBinding::bind(const App::ObjectIdentifier & _path) method. You need to construct an ObjectIdentifier object, which you can do either with ObjectIdentifier::parse(...), or you can construct it like I have done in PropertyConstraintList::createPath(int ConstrNbr). The first one actually invokes the parser, so the second method is preferred as that is just object construction, even though it is a bit cumbersome to write. In your case, it would be something like
App::ObjectIdentifier(docObj)
<< App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("Placement"))
<< App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("Base"))
<< App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("x"))
to access the x value of the placement vector.
Eivind