How to dynamically vary properties of a load object?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 389
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How to dynamically vary properties of a load object?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 389
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓

    The XML can be defined only static with all the possible properties defined. <onvalidate> callback of a property can be used to hide/show other load object properties using Python.

    Eg:

          <property name="SelectStatic" caption="Select (static)" control="select">
            <attributes options="Option 1,Option 2,Option 3" />
            <callbacks>
                <onvalidate>hide_other_properties</onvalidate>
            </callbacks>
          </property>
    
    def hide_other_properties(load, property):
        if  property.Value == "Option 1":
            load.Properties["SelectDynamic"].Visible = False
        else:
            load.Properties["SelectDynamic"].Visible = True
        ExtAPI.DataModel.Tree.Refresh()