Export Joint Probe (Tabular Data)

Run the script to export Tabular Data from all selected Joint Probe objects for the current design point in the current analysis. Resulting CSV file will be located in projectName\user_files.

Transparent Transparent

import csv
import wbjn

cmd = 'returnValue(GetUserFilesDirectory())'
UserFilesPath = wbjn.ExecuteCommand(ExtAPI,cmd)

# Selected Joint Probe Objects
jointProbes = Tree.ActiveObjects

for jointProbe in jointProbes:
    analysis = jointProbe.Parent.Parent
    resultsData=analysis.GetResultsData()
    resultSets = resultsData.ListTimeFreq
    
    wdir = analysis.WorkingDir
    dpString = wdir.split('_files')[1] # 'dpX\SYS\MECH'
    dp = dpString.split('\SY')[0]
    dp.Replace('\\','')
    
    export_path = UserFilesPath + dp +'_' + analysis.Name + '_' + jointProbe.Name + '.csv'
    
    X = list()
    Y = list()
    Z = list()
    Tot = list()
    vec = list()
    
    with open(export_path, 'wb') as file:
        writer = csv.writer(file)
        writer.writerow(['Force Reaction [X]','Force Reaction [Y]','Force Reaction [Z]','Force Reaction [Total]'])
        for index, i in enumerate(resultSets):
            # InternalObject - undocumented (not supported running Linux)
            X =     jointProbe.InternalObject.SequenceXDeformation(index)
            Y =     jointProbe.InternalObject.SequenceYDeformation(index)
            Z =     jointProbe.InternalObject.SequenceZDeformation(index)
            Tot =   jointProbe.InternalObject.SequenceTotalDeformation(index)
            vec.append([X,Y,Z,Tot])
        writer.writerows(vec)