In this post:
https://discuss.ansys.com/discussion/4623/how-to-speed-up-command-snippet-creation-and-create-a-progress-bar/p1
@Rajesh Meena provided a method for accessing and updating the in-built progress bar in the bottom left corner of the Mechanical window.
Does anyone know how to clear and remove the bar once finished using it?
My code for testing the process is below.
import time
import Ansys.Mechanical.Application
progressObj = Ansys.Mechanical.Application.Progress()
dlg = ExtAPI.Application.ScriptByName("jscript").CallJScript("doStartProgress", ["Doing Stuff", progressObj.InternalObject])
def step_function():
pass
for i in range(1, 6):
stringout = 'Finished part ' + str(i) + ' of 5'
progressObj.SetProgress(i/5.0*100, 'Automating tasks', i * 20, stringout)
time.sleep(1)
ExtAPI.Application.InvokeBackground(step_function, progressObj)
time.sleep(1)
progressObj.SetProgress(100, 'Process complete', 100, 'Process complete')
ExtAPI.Application.InvokeBackground(step_function, progressObj)
#Need code here to flush and remove the progress bar