Adding Path to Equivalent Stress - Mechanical scripting
Hey everyone,
I want to output some stress on paths and unfortunately I can't get it to add the paths to the stress.
As you can see in the pictures my code looks like that:
Spannung_Pfad = Model.Analyses[0].Solution.AddEquivalentStress()
Spannung_Pfad.ScopingMethod = GeometryDefineByType.Path
Spannung_Pfad.Surface = ExtAPI.DataModel.GetObjectsByName("Pfad0")[0]
As I already defined all the paths via name, I tried to Get the Object by it. Unfortunately the surface doesn't seem to be right, although the recording tool use the same?
If someone have an idea what I'm doing wrong, I would be glad.
Best regards
Best Answer
-
You can directly assign the path as the .Location of the result:
Spannung_Pfad = Model.Analyses[0].Solution.AddEquivalentStress() Spannung_Pfad.Location = ExtAPI.DataModel.GetObjectsByName("Pfad0")[0]
I was able to reproduce the incorrect line produced by the journaling tool in Mechanical 2023R2 and reported it to our Mechanical Software Development Team to hopefully fix this issue in future releases.
0
Answers
-
That worked flawlessly for me, thanks a lot for your quick and super helpfull answer!
0 -
It seems like your code is correctly defining the paths, but the surface might not be retrieved properly. Double-check if the surface object obtained by name matches the expected surface. If the recording tool uses the same, it's likely the code implementation that needs scrutiny. Keep troubleshooting, and you'll likely find the issue!
0