How to dynamically vary properties of a load object?

Options
Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 419
5 Likes First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

How to dynamically vary properties of a load object?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 419
    5 Likes First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    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()