How to open Workbench ACT and launch a wizard by script

charlie.wang
charlie.wang Member, Employee Posts: 2
First Anniversary Ansys Employee First Comment
✭✭✭

Is there any way to launch a ACT wizard by script?

Tagged:

Best Answers

  • Aria
    Aria Member, Employee Posts: 67
    25 Answers Second Anniversary 25 Likes 10 Comments
    ✭✭✭✭
    edited March 2023 Answer ✓

    Your wizard is ultimately a callback to a python function. You can call that python function within your extension with your inputs.

    Lets assume you run your script in a bat file like following

    "%AWP_ROOT231%\Framework\bin\win64\RunWB2.exe" -B -R my_script.py
    

    then, my_script would activate the extension and run the python callback


    appAPI = Ansys.ACT.Core.ApplicationRepository.GetApplication("Project")
    ExtAPI = appAPI.GetExtensionApi(None)
    
    myACTName = "SomeACTextension"
    extension = [x for x in ExtAPI.ExtensionManager.Extensions if x.Name == myACTName]
    
    if len(extension) == 1:
        appFormat = "Scripted" # or = "Binary"
        GUID = "some-GUID-value"
        Extensions.LoadExtension(Id=GUID, Format=appFormat)
        ext=ExtAPI.ExtensionManager.GetExtensionByName(myACTName).GetModule()
        ext.SomeWizardCallback(arg1, arg2, arg3...)
    
    


  • charlie.wang
    charlie.wang Member, Employee Posts: 2
    First Anniversary Ansys Employee First Comment
    ✭✭✭
    Answer ✓

    Thank you. It works now!

Answers