[Solved] How to get value form Object Variable

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

[Solved] How to get value form Object Variable

Post by dan-miel »

Hi all.
When adding a property to an Object using the code below, you can get the Value of the string by Place = Loc.DriveTo. How can a person get the “City”, “Eats” value?
Thanks
Dan

Code: Select all

Loc.addProperty("App::PropertyString", "DriveTo", "City").DriveTo = "New York"
Loc.addProperty("App::PropertyString", "DriveTo", "Eats").DriveTo = "Hanks Bar"
Place = Loc.DriveTo
Last edited by dan-miel on Wed Nov 30, 2022 3:11 pm, edited 1 time in total.
User avatar
Roy_043
Veteran
Posts: 8456
Joined: Thu Dec 27, 2018 12:28 pm

Re: How to get value form Object Variable

Post by Roy_043 »

Code: Select all

loc.getGroupOfProperty("DriveTo")
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: How to get value form Object Variable

Post by dan-miel »

Roy_043 wrote: Wed Nov 30, 2022 7:27 am loc.getGroupOfProperty("DriveTo")
This works.
Thanks Roy.
Post Reply