Adding Path to Equivalent Stress - Mechanical scripting

Tobias
Tobias Member Posts: 5
Name Dropper First Comment
edited August 2023 in Structures

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

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 183
    First Answer First Comment 5 Likes First Anniversary
    edited August 2023 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.

Answers

  • Tobias
    Tobias Member Posts: 5
    Name Dropper First Comment

    That worked flawlessly for me, thanks a lot for your quick and super helpfull answer! :)