How can I access Custom Component Properties in SpaceClaim?

Nikos Kallitsis
Nikos Kallitsis Member, Employee Posts: 34
10 Comments 5 Likes First Anniversary Ansys Employee
✭✭✭✭

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

Best Answer

  • Nikos Kallitsis
    Nikos Kallitsis Member, Employee Posts: 34
    10 Comments 5 Likes First Anniversary Ansys Employee
    ✭✭✭✭
    Answer ✓

    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