In Workbench Mechanical scripting, how can I get the location of an external data file?
Landon Mitchell Kanner
Member, Employee Posts: 287
✭✭✭✭
in Structures
Here is my project page schematic:
I want to get this file location:
From the Mechanical model where it is use:
Tagged:
0
Answers
-
def GetImportedLoadMainFile(ImportedLoadGroup): import wbjn coord = ImportedLoadGroup.Source.Split(':')[0] WBcmds = ''' coord = "<$coord$>" import clr clr.AddReference("Ans.UI") import Ansys.UI clr.AddReference("Ans.ProjectSchematic") import Ansys.ProjectSchematic view1 = Ansys.UI.UIManager.Instance.GetActiveWorkspace().GetView(Ansys.ProjectSchematic.View.ProjectSchematicView.ViewName) coord_map = dict(view1.CoordinateMap) coord_map2 = {Ansys.UI.IDManager.GetAlphabeticLabelFromCoordinate(coord_map[key]):key for key in coord_map} setup1 = coord_map2[coord] try: setup1 = setup1.GetContainer() except: pass externalLoadData1 = setup1.GetExternalLoadData() externalLoadFileData1 = externalLoadData1.GetExternalLoadFileData(Name="ExternalLoadFileData") file = externalLoadFileData1.File.Location returnValue(file) '''.replace('<$coord$>',coord) return wbjn.ExecuteCommand(ExtAPI,WBcmds) impload = ExtAPI.DataModel.GetObjectsByType(Ansys.ACT.Automation.Mechanical.ImportedLoads.ImportedLoadGroup)[0] impload_file = GetImportedLoadMainFile(impload)
0