SOLVED: Access all properties with same 'Group'(?)

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

SOLVED: Access all properties with same 'Group'(?)

Post by keithsloan52 »

Don't think Group is the right term but If an objects properties has been set with say

Code: Select all

obj = App.ActiveDocument.addObject("Part::Feature", "CustomObject")

obj.addProperty("App::PropertyFloat", "Velocity", "Parameter", "Body speed")
obj.addProperty("App::PropertyBool", "VelocityEnabled", "Parameter", "Enable body speed")
How can I scan just through all properties with 'Group'(?) "Parameter"
Last edited by keithsloan52 on Thu Jun 30, 2022 6:12 am, edited 1 time in total.
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Access all properties with same 'Group'(?)

Post by edwilliams16 »

Just looking at the available methods for obj

Code: Select all

for prop in obj.PropertiesList:
    if obj.getGroupOfProperty(prop) == 'Parameter':
        print(f'{prop} = {getattr(obj, prop)}')
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: SOLVED: Access all properties with same 'Group'(?)

Post by keithsloan52 »

Thanks
Post Reply