Activate/deactivate boundary conditions through scripting

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 831
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

Using ACT, how can I define a displacement boundary condition through tabular data values and activate/deactivate this boundary condition for one step?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 831
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    The following code can be adapted. Please note that activating/deactivating a boundary condition is done by the use of InternalObject, which use is not supported.

        analysis=ExtAPI.DataModel.Project.Model.Analyses[0] # refer to analysis
        my_disp=analysis.AddDisplacement() # add displacement boundary condition
        my_disp.Location=ExtAPI.DataModel.GetObjectsByName("MyNamedSelection")[0] # scope boundary condition to named selection called "MyNamedSelection"
        my_disp.XComponent.Inputs[0].DiscreteValues=[Quantity('0[s]'),Quantity('1[s]'),Quantity('2[s]'),Quantity('3[s]')] # define input values for tabular data
        my_disp.XComponent.Output.DiscreteValues=[Quantity('0[mm]'),Quantity('1[mm]'),Quantity('2[mm]'),Quantity('3[mm]')] # define output values for tabular data loading
        my_disp.InternalObject.SetPropertyByStep(1,"Active",False) # deactivate displacement at load step n°1
        # my_disp.InternalObject.SetPropertyByStep(1,"Active",True) # activate displacement at load step n°1