How can I access Custom Component Properties in SpaceClaim?

Member, Employee Posts: 40
10 Comments 5 Likes First Anniversary Ansys Employee
✭✭✭✭

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

Best Answer

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

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

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

Welcome!

It looks like you're new here. Sign in or register to get started.