How to read a sketch support feature name

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
freedman
Veteran
Posts: 3472
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

How to read a sketch support feature name

Post by freedman »

This is driving me nuts. I read the support but I can't get the name. Here is the code.

Code: Select all

sk =  FreeCADGui.Selection.getSelection()[0] 
print(sk.Name)
print("Sk=",sk.Support)
You can see the report, tree, properties. I select sketch003 and run the code, it tells me the support is a PartDesign Pad and gives me the face number but what I want is the Pad/feature number. So what I want is; what feature the sketch is connected to for a support. The print should say Pad001.
Thanks
Attachments
support_fetch.JPG
support_fetch.JPG (54.58 KiB) Viewed 457 times
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How to read a sketch support feature name

Post by openBrain »

Nope. The 'chevrons' around the Pad identifier denote you get a reference (pointer) to the Pad instance. So just extract it from the nested list+tuple and you'll get name and much more. ;)
freedman
Veteran
Posts: 3472
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: How to read a sketch support feature name

Post by freedman »

Thanks, that got me on track. Much more indeed. Thanks openBrain

Code: Select all

sk =  FreeCADGui.Selection.getSelection()[0] 
print(sk.Name)
list_first=sk.Support[0]
big_list = list_first[0]
print("Much more = ",dir(big_list))
Post Reply