I am trying to automate a series of steady state thermal simulations with a same geometry and different heat flux boundary conditions imported from a CSV file. I have created a PyMechanical script attached to this email. The issue is that I couldn't find a way to import the material .xml file that is exported from WorkBench Engineering Data.
Is there an API for importing Materials in standalone mechanical?
The Python API for importing Material is exposed from 232 onwards. For 231 version, you will have to use jscript.
You need to make sure that the xml file is not exported from future versions.
materials = DataModel.Project.Model.Materials
material_file = material_file.replace("\", "\\")
script = 'DS.Tree.Projects.Item(1).LoadEngrDataLibraryFromFile("' + material_file + '");'