get the first row of a path result

Drago
Drago Member, Employee Posts: 18
First Anniversary Ansys Employee First Comment Photogenic
edited June 2023 in Structures

How I can get the first row of a path result. Supposed that the result is saved in stress, which is defined like this:

sol = Model.Analyses[0].Solution
stress = sol.AddMaximumPrincipalStress()
stress.ScopingMethod = GeometryDefineByType.Path

then I can access the data e.x with:

stress.PlotData.Values[3]

But the first three columns contain the coordinate, not what we see in Mechanical - the distances along the path. Thank you

Tagged:

Answers

  • Drago
    Drago Member, Employee Posts: 18
    First Anniversary Ansys Employee First Comment Photogenic
    Answer ✓
    import math
    
    x_coord = stress.PlotData.Values[0]
    y_coord = stress.PlotData.Values[1]
    z_coord = stress.PlotData.Values[2]
    
    x_diff = [x - x_coord[0] for x in x_coord]
    y_diff = [y - y_coord[0] for y in y_coord]
    z_diff = [z - z_coord[0] for z in z_coord]
    
    dist = [math.sqrt(x*x + y*y + z*z) for x,y,z in zip(x_diff,y_diff,z_diff)]