How to open Workbench ACT and launch a wizard by script

Options Member, Employee Posts: 2
First Anniversary Ansys Employee First Comment

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


Best Answers

  • Aria
    Aria Member, Employee Posts: 67
    First Anniversary Ansys Employee First Answer Name Dropper
    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

    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.SomeWizardCallback(arg1, arg2, arg3...)

  • Member, Employee Posts: 2
    First Anniversary Ansys Employee First Comment
    Answer ✓

    Thank you. It works now!


  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 813
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    Hi @charlie.<?WORD FLAGGED?> . Wizards are designed to be interactive (they are made to guide non-expert users through a workflow). There is very little that can be done to run a Wizard through a script.

    The following commands will imitate clicking on the "Next Button" in a Wizard. Opening the wizard still has to be done manually. Also, please note that the following commands are unsupported (no documentation, no support, and no guarantee that it will work).

    import System
    import time
    def runWizard(analysis):
        Open Wizard in another thread
    def runActionsWizard():
        Run actions for Wizard