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

Options
Vishnu
Vishnu Member, Employee Posts: 214
Name Dropper First Anniversary Solution Developer Community of Practice Member First Comment
edited November 2023 in Structures
Tagged:

Comments

  • Vishnu
    Vishnu Member, Employee Posts: 214
    Name Dropper First Anniversary Solution Developer Community of Practice Member First Comment
    Options
    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: 813
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    edited November 2023
    Options

    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 ;-)