Why would I use FeaturePython

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
TheMarkster
Veteran
Posts: 5512
Joined: Thu Apr 05, 2018 1:53 am

Re: Why would I use FeaturePython

Post by TheMarkster »

If you are not creating document objects, then it can sensible to only use dialogs. But if you are creating document objects you definitely want to base them on feature python.

Here are a few reasons:

To have a custom icon in the tree is very easy, just return the string in xpm format from getIcon() in the view provider class.

Serialization is already taken care of automatically for the FreeCAD property types.

Users may easily edit the properties in the property view without going back to the workbench to run the dialog again.

Properties may be bound to other properties, spreadsheet aliases, sketcher constraints, allowing for more parametric models.

No need to reinvent the wheel with slots, signals, and the like when the feature python object gives you all this already for responding to property changes.
EskiBrew
Posts: 100
Joined: Fri Apr 24, 2015 10:21 am

Re: Why would I use FeaturePython

Post by EskiBrew »

TheMarkster wrote: Sun Jan 23, 2022 9:09 pm If you are not creating document objects, then it can sensible to only use dialogs. But if you are creating document objects you definitely want to base them on feature python.

Here are a few reasons:

To have a custom icon in the tree is very easy, just return the string in xpm format from getIcon() in the view provider class.

Serialization is already taken care of automatically for the FreeCAD property types.

Users may easily edit the properties in the property view without going back to the workbench to run the dialog again.

Properties may be bound to other properties, spreadsheet aliases, sketcher constraints, allowing for more parametric models.

No need to reinvent the wheel with slots, signals, and the like when the feature python object gives you all this already for responding to property changes.
Thanks Mark, that's a very useful list 8-)
Post Reply