Rename reaction forces base on definition
LBACHELOT
Member Posts: 1
**
Hello everyone,
I encounter a problem while creating a script to extract the Force reactions Fx, Fy and Fz at all boundary conditions. The thing I want to do is to extract them and then rename them base on their definitions to be able to quickly see which reaction forces correspond to which boundary conditions. Therefore, I have started this script in python:
ma_liste=Model.GetChildren(DataModelObjectCategory.FixedSupport,True) ma_liste2=Model.GetChildren(DataModelObjectCategory.Displacement,True) ma_liste3=Model.GetChildren(DataModelObjectCategory.Spring,True) solution=Model.Analyses[0].Solution for fixedsupport in ma_liste: print(fixedsupport.Name) Fr=solution.AddForceReaction() Fr.LocationMethod=LocationDefinitionMethod.BoundaryCondition Fr.BoundaryConditionSelection=fixedsupport Fr.Name=Fr.RenameBasedOnDefinition() for displacement in ma_liste2: print(displacement.Name) Fr2=solution.AddForceReaction() Fr2.LocationMethod=LocationDefinitionMethod.BoundaryCondition Fr2.BoundaryConditionSelection=displacement Fr2.Name=Fr2.RenameBasedOnDefinition() for spring in ma_liste3: print(spring.Name) Fr3=solution.AddForceReaction() Fr3.LocationMethod=LocationDefinitionMethod.Spring Fr3.Spring=spring Fr3.Name=Fr3.RenameBasedOnDefinition() solution.EvaluateAllResults()
But then when I run the script it is starting to create and rename but then shut down my ANSYS Mechanical window showing me an error message ...
Does anyone have an idea of why it is doing this ? (I am using V2022R2)
Tagged:
0
Comments
-
You need to remove Fr*.Name= from the start of the last line of each for loop:
for fixedsupport in ma_liste: print(fixedsupport.Name) Fr=solution.AddForceReaction() Fr.LocationMethod=LocationDefinitionMethod.BoundaryCondition Fr.BoundaryConditionSelection=fixedsupport Fr.RenameBasedOnDefinition()
0