Using ACT, I want to define a tabular data force and inside the 'Quantity' field I want to use a var

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

Using ACT, I want to define a tabular data force and inside the 'Quantity' field I want to use a variable, not a numerical value.

Tagged:

Answers

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

    In fact, values inserted inside the 'Quantity" field are string values: in MyForce2.XComponent.Output.DiscreteValues=[Quantity('0[N]'), '0[N]' is a string. To refer to a variable, one can use string concatenation. Below is an example of script:

        StaticAnalysis=ExtAPI.DataModel.Project.Model.Analyses[0]
        MyForce2=StaticAnalysis.AddForce()
        MyForce2.DefineBy=LoadDefineBy.Components
        ForceValueAt1=str(10)
        UnitForce='[N]'
        MyForce2.XComponent.Inputs[0].DiscreteValues=[Quantity('0[s]'),Quantity('1[s]')]
        MyForce2.XComponent.Output.DiscreteValues=[Quantity('0[N]'),Quantity(ForceValueAt1 + UnitForce)]