I want to register the rotation angle at which the torque is maximum in the response value in the script.
The following is an example of a Python script. This sample also works when registered as a post-calculation script. By registering it as a post-calculation script, you can automatically execute the script each time you import results. # -*- coding: utf-8 -*- app = designer.GetApplication() #Specify the response value name to be registered val_name = u"Angle_atMaxTorque" #Specify the column ID of the torque data to be referenced col_Torque = 0 #Specify the column ID of the rotation angle data to be referenced col_Motion = 0 #Obtain the torque result data object TorqueData = app.GetCurrentStudy().GetResultTable().GetData(u"Torque") #Obtain the rotation angle result data object AngleData = app.GetCurrentStudy().GetResultTable().GetData(u"TotalDisplacementAngle") #Get the current case ID CaseID = app.GetCurrentStudy().GetCurrentCase() #tore the maximum torque and rotation angle of the first step in variables Max_Torque = TorqueData.GetValue(0, col_Torque) Result_Angle = AngleData.GetValue(0, col_Motion) #Check results for the second step and beyond for row in range(1,TorqueData.GetRows() -1): #If the torque for row steps is greater than the torque stored in the variable, update the maximum torque and rotation angle if Max_Torque < TorqueData.GetValue(row, col_Torque): Max_Torque = TorqueData.GetValue(row, col_Torque) Result_Angle = AngleData.GetValue(row, col_Motion) #Register the rotation angle at which the acquired torque is maximum as a user-defined response value app.GetCurrentStudy().SetUserResponseVariable(val_name, CaseID, Result_Angle)


