How can I access Custom Component Properties in SpaceClaim?

Options
Nikos Kallitsis
Nikos Kallitsis Member, Employee Posts: 24
First Anniversary First Comment Ansys Employee Name Dropper

How can I access a user-defined property in Custom Component Properties?

Best Answer

  • Nikos Kallitsis
    Nikos Kallitsis Member, Employee Posts: 24
    First Anniversary First Comment Ansys Employee Name Dropper
    Answer ✓
    Options

    You can access the Custom Properties using Template.CustomProperties . Here is an example:

    comp = GetRootPart().Components[0] #Select 1st Component in Tree
    propDict = comp.Template.CustomProperties #Dictionary where Keys are the Property Names
    print(propDict.Keys) #Returns list of Property Names in string format
    prop = propDict[propDict.Keys[0]] #Select 1st Property using Property Name
    print(prop.Name) #Returns Property Name (same as selected Key)
    print(prop.Value) #Returns Property Value