Matthias Ganninger Posted March 18, 2019 Share Posted March 18, 2019 (edited) Hi, I am implementing a tool event sink by inheriting from VWFC::PluginSupport::VWTool_EventSink. During DoSetUp I want to create a Vectorworks class if it doesn't already exist in the current document. When trying that many "Beta Undo Alert 9" - warnings are thrown at me (see attached image). I tried to create an Undo step around the class creation but that did not help. What am I missing here? Is there a recommended way of creating a class during DoSetUp without drowning in Beta Undo Alert 9 warnings? Regards, Matthias Edited March 18, 2019 by Matthias Ganninger Quote Link to comment
JBenghiat Posted March 18, 2019 Share Posted March 18, 2019 The general practice would be to do something like: // Create class newClassName if (VWClass::IsValidClassName(newClassName)) { gSDK->SetUndoMethod( kUndoSwapObjects ); gSDK->NameUndoEvent("Create default classes"); VWClass classObjNew(newClassName); MCObjectHandle classH = gSDK->InternalIndexToHandle(classObjNew); gSDK->AddAfterSwapObject(classH); gSDK->EndUndoEvent(); } Quote Link to comment
Matthias Ganninger Posted March 19, 2019 Author Share Posted March 19, 2019 Thanks Joshua, your code snippet works perfectly in DoSetup. I forgot adding the class handle to the Undo. Quote Link to comment
REdmondson Posted May 7, 2019 Share Posted May 7, 2019 I had this happen as well but was not working in class when it was occurring. Any thoughts? Quote Link to comment
JBenghiat Posted May 7, 2019 Share Posted May 7, 2019 You see this alert any time an action changes the document without properly registering with the undo system. It could be your code or it could be from another module. If you are running a debug session, you can pause execution when the alert pops up and try to track it down. 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.