How to read a result file into Mechanical from WB?

Rohith Patchigolla
Member, Moderator, Employee Posts: 242
✭✭✭✭
in Structures
Answers
-
One could use the below script to run it via WB --> File --> Scripting --> Run Script File for example to load an rst file (in a given unit system) into Mechanical corresponding to a particular WB system. This imports rst to the first WB system (and first analysis in the Mechanical tree) in Batch.
import os filename = "file.rst" rstPath = r"D:\del3\New folder (6)" fullpath = os.path.join(rstPath,filename) mechScriptCmds=""" fullpath = r'{0}' analysis = DataModel.AnalysisList[0] analysis.Solution.ReadGivenAnsysResultFile(fullpath,Ansys.Mechanical.DataModel.Enums.UnitSystemIDType.UnitsNMM) """.format(fullpath) mySys = GetAllSystems()[0] model = mySys.GetContainer(ComponentName="Model") model.Edit(Interactive=False) model.SendCommand(Language="Python", Command=mechScriptCmds)
0