How to open Workbench ACT and launch a wizard by script
Best Answers
-
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...)
1 -
Thank you. It works now!
1
Answers
-
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 ''' System.Threading.Thread(System.Threading.ThreadStart(runActionsWizard)).Start() def runActionsWizard(): ''' Run actions for Wizard ''' ExtAPI.UserInterface.UIRenderer.GetContainer("Wizard").CurrentPanel.GetComponent("WizardDefinitionComponent_Wizard;Wizard_Name;GUI;Wizard_Name;xml;1;0").TriggerClick() ExtAPI.UserInterface.UIRenderer.GetContainer("Wizard").CurrentPanel.GetComponent("Submit").TriggerClick("submit")
0