AFDesign Posted May 28, 2015 Share Posted May 28, 2015 Hi, does it exist additional documentation for the "UndoOFF" procedure more than http://developer.vectorworks.net/index.php/VS:UndoOff ? My plugin take some time to regenerate so I use "Progress Dialog" to have visual feedback. If I put UndoOFF (after Begin) my plugin regenerate 2 times: when the progressbar end, it restart one more time. Without UndoOFF it works correctly, but I need it to reduce memory use. Thanks for your help! Quote Link to comment
AFDesign Posted June 25, 2015 Author Share Posted June 25, 2015 (edited) I tried everything, it's probably a bug. if you try this simple code in a linear object plugin, when it regenerates with undooff you will receive the alert message twice, if you delete undooff it will works correctly (only one alert). Any workaround? Thanks PROCEDURE Example1; BEGIN undooff; ovaln(0,0,0,1,1m,1m); {draw a circle} alertinform('Plugin regenerated!','',false); END; Run(Example1); Edited June 26, 2015 by AFDesign Quote Link to comment
AFDesign Posted June 26, 2015 Author Share Posted June 26, 2015 I finally found a workaround, if someone is interested: 1) SetMaximumUndoEvents(0); 2) execute script 3) restore maximum undo events end of monologue Quote Link to comment
Pat Stanford Posted June 26, 2015 Share Posted June 26, 2015 I am not certain that it is an UndoOff issue, but it might be a PIO issue. I can't find it in my email history, but I think that the script of a PIO has to run multiple times when it is first placed into a drawing. I think it has something to do with going in with the default values and then updating to use the actual parameters. Hopefully someone else will be able point this out. I made a linear PIO out of your script and got the multiple regenerations. I then commented out the UndoOff and got the same result. If your work around is doing what you need then that is great. I don't have another work around. Quote Link to comment
Hippocode Posted June 27, 2015 Share Posted June 27, 2015 (edited) Pat is right. The first time you create each pio it runs twice. I think the event constant is named OnFirstRegen or something similar, followed by the Recalculate event. Edited June 27, 2015 by hippothamus Quote Link to comment
AFDesign Posted June 28, 2015 Author Share Posted June 28, 2015 Thank you, I will try to get more info about this. But if I don't use undooff I get only one regen, not two. 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.