Jump to content
Developer Wiki and Function Reference Links ×

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


Recommended Posts

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
Link to comment

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

 

Link to comment
  • 1 month later...

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. 

Link to comment
  • 1 month later...

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...