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

Vishnu
Vishnu Member, Employee Posts: 216
Solution Developer Community of Practice Member First Anniversary Name Dropper 100 Comments
✭✭✭✭
edited November 2023 in Structures
Tagged:

Comments

  • Vishnu
    Vishnu Member, Employee Posts: 216
    Solution Developer Community of Practice Member First Anniversary Name Dropper 100 Comments
    ✭✭✭✭
    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: 859
    500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
    ✭✭✭✭
    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 ;-)