Accessing and Manipulating the Analysis Object

The Analysis object provides an API for the Environment tree object.

To access the first Analysis object in the tree and its settings:

analysis1 = Model.Analyses[0]
analysis_settings = analysis1.AnalysisSettings

The Analysis object exposes several convenient methods. For example, you can add boundary conditions like bolt pretensions, loads, and fixed supports:

bolt = analysis1.AddBoltPretension()
pressure = analysis1.AddPressure()
force = analysis1.AddForce()
support = analysis1.AddFixedSupport()

Boundary condition objects often require a valid scoping. You can satisfy this requirement by setting Location properties:

pressure_scoping = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
pressure_scoping.Ids = [220]
pressure.Location = pressure_scoping
force_scoping = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
force_scoping.Ids = [219]
force.Location = force_scoping

For the above boundary conditions, accessible properties include:

bolt.SetDefineBy(1, BoltLoadDefineBy.Load) # Change definition for step #1.
bolt.Preload.Output.SetDiscreteValue(0, Quantity("15 [N]")) # Change preload value for step #1.
pressure.Magnitude.Output.Formula = '10*time' # To use a formula
pressure.Magnitude.Output.DiscreteValues=[Quantity('6 [Pa]')] # To use a direct value
force.Magnitude.Output.DiscreteValues=[Quantity('11.3 [N]'), Quantity('12.85 [N]')]