How can I define a load by components through scripting?
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 864
✭✭✭✭
Answers
-
Below is an example:
analysis=ExtAPI.DataModel.Project.Model.Analyses[0] # refer to analysis newForce=analysis.AddForce() # add force newForce.DefineBy = LoadDefineBy.Components # define by components newForce.ZComponent.Output.DiscreteValues = [Quantity("1 [N]")] # define Z value newForce.YComponent.Output.DiscreteValues = [Quantity("1 [N]")] # define Y value
2 -
v2021R2
The loading in a time stepped analysis can also be automated. I had to set the independent variable to step but the loop is based on the timeSteps and can be used to calculate load based on timeSteps[i].
# Get Time Steps from the Analysis settings timeSteps = ExtAPI.DataModel.AnalysisList[0].StepsEndTime F = Model.Analyses[0].AddForce() F.DefineBy=LoadDefineBy.Components F.IndependentVariable = LoadVariableVariationType.Step F_unit = F.XComponent.Output.Unit for i in range(len(timeSteps)): F.XComponent.Output.SetDiscreteValue(i,Quantity(timeSteps[i],F_unit)) F.YComponent.Output.SetDiscreteValue(i,Quantity(timeSteps[i],F_unit)) F.ZComponent.Output.SetDiscreteValue(i,Quantity(timeSteps[i],F_unit))
6