Jump to content
Developer Wiki and Function Reference Links Read more... ×
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×