How to extract stress reults from ansys motion result file

Vishnu
Vishnu Member, Employee Posts: 221
100 Comments 100 Likes Name Dropper First Anniversary
✭✭✭✭
edited June 2023 in Structures

All you need to do is point to DFR file and extract results like below:

Stress extraction

Tagged:

Answers

  • Vishnu
    Vishnu Member, Employee Posts: 221
    100 Comments 100 Likes Name Dropper First Anniversary
    ✭✭✭✭
    Answer ✓

    the below code extracts Von-Mises on node 1: Please change the motion path if necessary.

    import clr, sys,os
    sys.path.append(r'C:\Program Files\ANSYS Inc\v221\Motion\bin')
    clr.AddReference('System.Collections')
    from System.Collections.Generic import List
    clr.AddReference('VM.Post.API.OutputReader')
    from VM.Post.API.OutputReader import *
    analysis = ExtAPI.DataModel.Project.Model.GetChildren(DataModelObjectCategory.Analysis,True)
    motion_an = filter(lambda x: x.SolverName == 'ANSYSMotion@ANSYSMotion', analysis)[0]
    work_dir = motion_an.WorkingDir
    filePath = os.path.join(work_dir,'file.dfr')
    outputReader = OutputReader(filePath) 
    
    parameters = PlotParameters()
    paths = List[str]()
    parameters.Target = "Solid/Node/1"
    paths.Add("Top Stress/VonMises")
    parameters.Paths = paths
    
    results = outputReader.GetCurves(parameters)
    
    
    for plot in results :
       print("Time ,", plot.Key)
       for value in plot.Value :
          print(value)