Goal: Evaluate spring reaction forces using the
SolverData API and the result reader.
Code:
# Get access to solver data
analysis = Model.Analyses[0]
solver_data = analysis.Solution.SolverData
# Get access to result reader
with analysis.GetResultsData() as reader:
spring_results = reader.GetResult("SPRING")
# Get a list of all springs
springs = Model.Connections.GetChildren(DataModelObjectCategory.Spring, False)
for spring in springs:
print(spring.Name)
spring_data = solver_data.GetObjectData(spring)
element_id = spring_data.ElementId
fForce = spring_results.GetElementValues(element_id)
print(fForce[0])