Hello
I try to change de "documentation of properties" in spreadsheet. used for tooltip in property editor.
I did not found a way in the GUI
In Python I found a getDocumentationOfProperty but no corresponding set, and getProperty return a string ,not an object.
getDocumentationOfProperty is not even in FreeCad documentation.
Is thre a way to change the documentation instead of suppressig and adding the property?
If the property is suppressed and recreated what about th formulas using the property ?
Best regards
How to modify property documentation
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: How to modify property documentation
I know of no way to change the documentation/tooltip of a property except to remove it and add a new one, which will disrupt any expressions bound to the property.
It should be possible to make a copy of all the expressions the object is using:
and then restore them after removing and adding back the property
But there can also be objects with expressions bound to the property which also must be preserved.
Then after removing/adding the property with its new tooltip/documentation string:
All of this is untested and likely has errors. It would be better to check if the property is part of the expression before restoring it, but I don't think there is any harm in restoring all of them.
It should be possible to make a copy of all the expressions the object is using:
Code: Select all
old_expressions = obj.ExpressionEngine
Code: Select all
for o in old:
obj.setExpression(o[0],o[1])
Code: Select all
propmap = {}
others = obj.InList
for other in others:
propmap[other] = other.ExpressionEngine
Code: Select all
for k,v in propmap.items():
for expression in v:
k.setExpression(expression[0],expression[1])
Re: How to modify property documentation
Thanks for answering
I did not found anay way except suppress/add, even in C++ sources
But, at least in version 0.19, my tests indicate that suppress/add do not disrupt expressions using the property.
I checked in containts for distances in sketcher and position in pad
Best regards
I did not found anay way except suppress/add, even in C++ sources
But, at least in version 0.19, my tests indicate that suppress/add do not disrupt expressions using the property.
I checked in containts for distances in sketcher and position in pad
Best regards
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: How to modify property documentation
Perhaps you are removing the old property and adding the new one before the system can react if expressions are not broken by doing this.