How to extract function expression result (Custom result) data using scripting for Ansys Motion?

Vishnu
Vishnu Member, Employee Posts: 222
100 Comments 100 Likes Second Anniversary Name Dropper
✭✭✭✭
edited November 2023 in Structures
Tagged:

Comments

  • Vishnu
    Vishnu Member, Employee Posts: 222
    100 Comments 100 Likes Second Anniversary Name Dropper
    ✭✭✭✭
    ansys_motion_objects = ExtAPI.DataModel.GetUserObjects("ANSYSMotion")
    function_expressions = filter(lambda x: x.Name == "CustomResult", ansys_motion_objects)
    my_function_expression = function_expressions[0]
    tabular_data = my_function_expression.Controller.tabular
    num_rows = tabular_data.RowCount
    num_columns = tabular_data.ColumnCount
    table_list=[]
    for row in range(0,num_rows):
    	row_list = []
    	for column in range(0,num_columns):
    		row_list.append(tabular_data.Cells[row,column].Text)
    	table_list.append(row_list)
    
    
    print table_list
    
  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    edited November 2023

    Important note: I'm changing this post to external as it contains very useful information. However, please note that scripting in Motion is neither documented, nor supported. This means we do not guarantee that this script will work, and will not provide support over it. Use at your own risk ;-)