How can I retrieve a Design Point number in a Mechanical simulation?

Pierre Thieffry
Pierre Thieffry Member, Moderator, Employee Posts: 107
25 Answers 10 Comments 25 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

One of our customers wants to export a file for each DP with the filename indicating the DP number . How can I retrieve this information?

Tagged:

Answers

  • Pierre Thieffry
    Pierre Thieffry Member, Moderator, Employee Posts: 107
    25 Answers 10 Comments 25 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    Here's how I did it - the customer wanted to export Equivalent Radiated Power Level

    erpl_result=ExtAPI.DataModel.GetObjectsByName('Equivalent Radiated Power Level')[0]
    analysis=erpl_result.Parent.Parent # Analysis could be retrieved differently
    dp_id=analysis.WorkingDir.split('\')[-4] # dp number appears in WorkingDir. Simply splitting by /
    user_files_dir=os.path.join(analysis.WorkingDir,'../../../user_files')
    
    file_name=os.path.join(user_files_dir,'erpl_'+dp_id+'.txt') # Filename with dp number
    erpl_result.ExportToTextFile(file_name)