How to add materials from material library in Mechanical with ACT?
cmd = """ library1 = EngData.OpenLibrary( Name="Composite Materials", Source="Composite_Materials.xml") system1 = GetSystem(Name="SYS") engineeringData1 = system1.GetContainer(ComponentName="Engineering Data") matl1 = engineeringData1.ImportMaterial( Name="E-Glass", Source="Composite_Materials.xml") """ ExtAPI.Application.ScriptByName('journaling').ExecuteCommand(cmd) ExtAPI.DataModel.Project.Model.RefreshMaterials()
@Ayush Kumar
Thank you for the response above.
I have been try to use your code above in my script but it doesn't seem to have any effect.
The material doesn't show even when I ran the code in Ansys Mechanical GUI.
Could it be that the code is outdated as a result of a software update?
Thank you in advance
@Collins I tested today with 2024R1 and it seems work perfectly fine. Which version are you testing with?
For anyone experiencing the same problem
@Ayush Kumar provided a detailed answer here
https://discuss.ansys.com/discussion/3425/how-to-loading-engineering-data-source-and-selecting-materials-using-scripting#latest
THank you