Export Beam Probe (Tabular Data)
Run the script to export Tabular Data from all selected Beam Probe objects for the current design point in the current analysis. Resulting CSV file will be located in projectName\user_files.
import csv
import wbjn
cmd = 'returnValue(GetUserFilesDirectory())'
UserFilesPath = wbjn.ExecuteCommand(ExtAPI,cmd)
# Selected Beam Probe Objects
beamProbes = Tree.ActiveObjects
for beamProbe in beamProbes:
analysis = beamProbe.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 + '_' + beamProbe.Name + '.csv'
AxialForce = list()
Torque = list()
ShearForceAtI = list()
ShearForceAtJ = list()
MomentAtI = list()
MomentAtJ = list()
vec = list()
with open(export_path, 'wb') as file:
writer = csv.writer(file)
writer.writerow(['Axial Force','Torque','ShearForceAtI','ShearForceAtJ','MomentAtI','MomentAtJ'])
for index, i in enumerate(resultSets):
# InternalObject - undocumented (not supported running Linux)
AxialForce = beamProbe.InternalObject.SequenceAxialForce(index)
Torque = beamProbe.InternalObject.SequenceTorque(index)
ShearForceAtI = beamProbe.InternalObject.SequenceShearForceAtI(index)
ShearForceAtJ = beamProbe.InternalObject.SequenceShearForceAtJ(index)
MomentAtI = beamProbe.InternalObject.SequenceMomentAtI(index)
MomentAtJ = beamProbe.InternalObject.SequenceMomentAtJ(index)
vec.append([AxialForce,Torque,ShearForceAtI,ShearForceAtJ,MomentAtI,MomentAtJ])
writer.writerows(vec)