How can I create an imported load and set the source file information?
In an automated process, I want to import initial stresses. My external data system is connected and data is defined over 6 columns. How can I get the data for the tabular view of my imported stress?
Answers
-
There are already some jscript based answers. Here's another one. You will need to use with Transaction() to avoid an error message due to some graphical refresh.
The code below creates the imported initial stress, sets the location on bodies. The last couple lines are the most important: the table is retrieved and data is set.
More generally, the table can be easily handled with these commands. You can also add lines with 'table.Add(None)'. After adding a line, you will need to retrieve the table again with GetTableByName to actualize it.
Eventually, we'll get a more official way of dealing with imported loads in future releases.
with Transaction(): impLoadGrp = ExtAPI.DataModel.GetObjectsByName('Imported Load (F2) ')[0] initStress=impLoadGrp.AddImportedInitialStress() selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) bodies=DataModel.GetObjectsByType(DataModelObjectCategory.Body) boList=[] for bo in bodies: if bo.Name.find('CDB') != -1: boList.append(bo.GetGeoBody().Id) selection.Ids=boList initStress.Location = selection table=initStress.GetTableByName("") # get the worksheet table row1 =table[0] # get the first row for i in range(0,6): row1[i]='File1:Stress1'
2