How can we export the Acoustic AWeightedSPL FR result data using mechanical scripting?

Erik Kostson
Member, Moderator, Employee Posts: 312
✭✭✭✭
We want to first add an Acoustic A-Weighted SPL frequency response (FR) result, and then export/print the result data using mechanical scripting?
0
Best Answers
-
It can be done in the following way (as the ExportToTextFile method is missing for this result object):
model=ExtAPI.DataModel.Project.Model # refer to Model analysis = model.Analyses[0] solution=analysis.Solution ns=ExtAPI.DataModel.GetObjectsByName('Open Domain')[0] res=solution.AddAcousticAWeightedSPLFrequencyResponse() res.Location=ns res.EvaluateAllResults() res.Activate() paneTabular=ExtAPI.UserInterface.GetPane(MechanicalPanelEnum.TabularData) control = paneTabular.ControlUnknown for col in range(1,control.ColumnsCount+1): for row in range(1,control.RowsCount+1): cellText= control.cell(row ,col ).Text if cellText!=None: print cellText
0 -
If the result exists and the resulting data is there, then we need to activate the result object first before using the paneTabular function:
rs=ExtAPI.DataModel.GetObjectsByName('Frequency Response')[0] rs.Activate() paneTabular=ExtAPI.UserInterface.GetPane(MechanicalPanelEnum.TabularData) control = paneTabular.ControlUnknown for col in range(1,control.ColumnsCount+1): for row in range(1,control.RowsCount+1): cellText= control.cell(row ,col ).Text if cellText!=None: print cellText
0
This discussion has been closed.