Jump to content
Matthias Ganninger

Class Creation during a tool's DoSetUp (Beta Undo Alert 9)

Recommended Posts

Posted (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

VWSDK - ClassCreation.png

Edited by Matthias Ganninger

Share this post


Link to post

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();
}

 

Share this post


Link to post

I had this happen as well but was not working in class when it was occurring. Any thoughts?

Share this post


Link to post

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. 

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...