Jump to content

Progress Dialog


twk

Recommended Posts

SDK Only as far as I know.

 

I used to use the Message command for this, but a few versions ago it stopped displaying until the script run completed. I think it was going to be fixed, but I have not tried in VW 2020.

 

The AlertInform dialog box would be good for this as the Minor Alert boolean makes it show at the bottom edge of the drawing window where the rendering progress indicator sits, but only for the first run. After the first run it automatically is (or at least was in VW2017) it automatically defaulted to a full dialog box.

 

I hope one of these might work for you.

Link to comment

Ahh thats a shame, I shall explore some external python libraries.. WxPython, TKinter etc.

 

On 3/1/2020 at 6:05 AM, Pat Stanford said:

After the first run it automatically is (or at least was in VW2017) it automatically defaulted to a full dialog box.

This still happens sadly..

Edited by twk
Link to comment

Hello

 

I am not sure, if have understood correctly your question. However I can say the following:

  • the progress dialog can be displayed without the vs.ProgressDlgStart() and terminated without the vs.ProgressDlgEnd() call.
  • without calling vs.ProgressDlgClose() the dialog window stays open until the script terminates.
  • vs.ProgressYield() has to have a numeric parameter vs.ProgressYield(1), otherwise pyhton errors are thrown.
  • vs.ProgressYield(int) has to be called otherwise the other messages like vs.ProgressDlgSetMeter(message) are not refreshed on the dialog window.
def messagePtest3():

	
	selCount = 10

	def DoTheWork():
	#	vs.ProgressDlgStart(100,selCount)
		for i in range(selCount+1):
			vs.ProgressDlgYield(1)
			vs.ProgressDlgSetMeter(str(i))
			vs.Wait( 1 )	#well, we work by waiting

	
	
	vs.ProgressDlgOpen( "I'm about to do some work", False )
	vs.ProgressDlgSetMeter("") # this resets previous values, if vs.ProgressDlgStart is not callded
	DoTheWork()
	# vs.ProgressDlgEnd()
    # vs.ProgressDlgClose() # if close is not called, the dialog stays open until the script terminates
	
	

 

best regards,

 

relume

 

 

Edited by relume
Link to comment
  • 2 years later...

Hi
Also Failing here. Seems the python script is waiting for the python execution and not for Vectorworks. If I as example importing 10 Symbols from a source it takes about 10 seconds. The progress bar (and Message Window) ends in 1 Second. If i build in 10 seconds of wait or sleep function it is visible 10 seconds but the execution takes then 20 seconds.

Next try would be to run the function inside a dialog loop

 

def place_symbols():
	vs.ClrMessage()
	vs.ProgressDlgOpen("Ersetze Objekte", False)
	if globals.settings['Ebene'] == 1: #new Layer
		vs.HideLayer()
		l_handle = vs.CreateLayer(globals.settings['Ebene Name'], 1)
		vs.HideLayer()

	vs.ProgressDlgStart(100, len(globals.pairs))
	counter = 1
	for target, source in globals.pairs:
		#vs.ProgressDlgStart(counter, counter)
		sym_name, [ListID, index] = source

		vs.ProgressDlgSetMeter('Ersetze' + sym_name)
		vs.Message('Ersetze' + sym_name)
		vs.ProgressDlgYield(1)
		#time.sleep(1)
		if vs.GetObject(sym_name):
			vs.DelObject(vs.GetObject(sym_name))

		vs.ImportResourceToCurrentFile(ListID, index)
		vs.Layer(vs.GetLName(l_handle))
		vs.Symbol(sym_name, (0,0), 0)
		h_new = vs.LNewObj()
		counter += 1
		off_x, off_y, off_z = target['PositionXYZ']
		rot_x, rot_y, rot_z = target['RotationXYZ']
		vs.SetEntityMatrix(h_new, (off_x, off_y, off_z), rot_x, rot_y, rot_z )

	if 	globals.settings['Ebene'] == 0: #replace on active layer
		for target, source in globals.pairs:
			handle = target['handle']
			if handle != vs.Handle(0):
				vs.DelObject(handle)

	vs.ClrMessage()
	vs.ProgressDlgEnd()
	vs.ProgressDlgClose()

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...