How to run functions that are defined in an ACT extension or Mechanical Add-on from a script?

Landon Mitchell Kanner
Landon Mitchell Kanner Member, Employee Posts: 178
First Answer First Comment 5 Likes First Anniversary

I have an ACT extension installed for Mechanical. I want to run an Mechanical script that will leverage some of the automation that is defined in the ACT extension. How can I do that?

Best Answer

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 178
    First Answer First Comment 5 Likes First Anniversary
    Answer ✓

    You can access an ACT extension (or Mechanical Add-on) module using the GetModule method:

    nvh_addon = ExtAPI.ExtensionManager.GetExtensionByName("NVHToolkit")
    nvh_module = nvh_addon.GetModule()
    

    The module allows you to access functions, variables, methods, etc. that are defined in the extension. For example:

    mac_data = nvh_module.MacData()

    Note that in many cases, it will be difficult to know how to use an extension's module without access to the extension's source code.

Answers