How can I get the first and last value from a path result in Mechanical?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 389
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How can I get the first and last value from a path result in Mechanical - Static Structural? enter image description here

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 389
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓

    By changing the display time in the result object and accessing the tabular data.

    result = Model.Analyses[1].Solution.Children[1]
    result.Activate()
    steps = Model.Analyses[1].AnalysisSettings.NumberOfSteps
    
    for time in range(1, steps + 1):
        result.DisplayTime = Quantity("%s [sec]" % time)
        result.EvaluateAllResults()
    
        paneTabular=ExtAPI.UserInterface.GetPane(MechanicalPanelEnum.TabularData)
        control = paneTabular.ControlUnknown
    
        first_length = control.cell(2, 2).Text
        last_length = control.cell(control.RowsCount, 2).Text
    
        first_stress = control.cell(2, 3).Text
        last_stress = control.cell(control.RowsCount, 3).Text
    
        print "TIME STEP - %s" % time
        print "Value at length %s is %s " % (first_length, first_stress)
        print "Value at length %s is %s " % (last_length, last_stress)