How to add materials from library to project by script?
wanghao
Member Posts: 27
**
Hi
Is there any way in ACT script to import materials from library to the current mechanical project? I want to do the materials add function(Click to add the material to the project) by ACT script or other, is there any way?
Tagged:
0
Answers
-
Hello, I think you could take a look at this post:
"How do I communicate with the Project Page from within Mechanical?"
You should be able to run a wb script (following the previous example) to load materials from the libraries, with something similar to this:
This example loads the Silicon Anisotropic material properties from the General_Materials library
favorites1 = EngData.LoadFavoriteItems() library1 = EngData.OpenLibrary( Name="General Materials", Source="General_Materials.xml") system1 = GetSystem(Name="SYS") engineeringData1 = system1.GetContainer(ComponentName="Engineering Data") matl1 = engineeringData1.ImportMaterial( Name="Silicon Anisotropic", Source="General_Materials.xml")
I hope this information helps.
Best Regards,
0