How can I retrieve the ACT extension XML/XML objects for a binary extension (.wbex)?
Ayush Kumar
Member, Moderator, Employee Posts: 450
✭✭✭✭
I have a binary extension and would like to automate creation of some objects of that extension. For automation I need to know what are the object names, types and location to be able to access them via Mechanical scripting API. The whole structure of an extension is defined in the XML, is there a way to retrieve that for a binary (.wbex) ACT extension?
Tagged:
2
Answers
-
When an ACT extension object is retrieved in Mechanical Scripting Console, it gives you access to the extension's
DataModel
. With this you can access all elements of the extension, for example:interfaces
,toolbars
,SimDatas
, the whole XML file as well:Get extension XML and write out to a file:
my_extension = ExtAPI.ExtensionManager.GetExtensionByName("HarmonicResponsePlotter") my_extension_xml = my_extension.DataModel.Xml my_extension_xml_file = open(r"\Output\Path\to\xml", "w") my_extension_xml_file.write(my_extension_xml) my_extension_xml_file.close()
Access a
toolbar
usinginterfaces
:my_extension = ExtAPI.ExtensionManager.GetExtensionByName("HarmonicResponsePlotter") print(my_extension.DataModel.Interfaces[2].Toolbars[0].Entries)
0