Code: Select all
void PropertyData::addProperty(...)
I belive this addProperty shoud be usable to add custom text fields to any object. And it seems accessible from python.
Code: Select all
>>> placement.addProperty('App::PropertyString','tata')
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: Type App::Placement cannot dynamically add properties
>>>
... but not for this things. It doesn't really matter though, because there is another feature App::FeaturePython to which we can add all sorts of properties, includung App::Placement and App::PropertyString. also App::PropertyPath should we need it
Code: Select all
>>> App.activeDocument().getObject('Constraints').newObject( 'App::FeaturePython', constrName )
>>> App.activeDocument().getObject( constrName ).addProperty('App::PropertyPlacement','Offset')
>>> App.activeDocument().getObject( constrName ).addProperty('App::PropertyString','Expression')
Code: Select all
>>> constrName.Expression