twk Posted February 29, 2020 Share Posted February 29, 2020 Does anyone know how to have a infinite cylce of progress until a function is finished? Is this possible with Python/Vectorscript calls? A note on the SDK example page says it is possible, http://developer.vectorworks.net/index.php/SDK:Progress_Dialoghttp://developer.vectorworks.net/index.php/SDK:Progress_Dialog. Wondering if thats unique to the C++ SDK.. Quote Link to comment
Pat Stanford Posted February 29, 2020 Share Posted February 29, 2020 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. Quote Link to comment
relume Posted March 1, 2020 Share Posted March 1, 2020 Hello The message command issue has still not been fixed in VW 2020. best regards, relume Quote Link to comment
twk Posted March 2, 2020 Author Share Posted March 2, 2020 (edited) 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 March 2, 2020 by twk Quote Link to comment
relume Posted March 2, 2020 Share Posted March 2, 2020 (edited) 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 March 2, 2020 by relume Quote Link to comment
DomC Posted November 2, 2022 Share Posted November 2, 2022 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() Quote Link to comment
Recommended Posts
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.