Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
Musisback

Duplicate Class

Recommended Posts

Hello,

Is it possible to duplicate a class via Vectorscript?

Thanks

I don't think there is a function that does that but you can create it yourself.

Share this post


Link to post

I haven't verified my memory, but I believe CreateDuplicateObject works with classes, using GetObject on the class name.

-Josh

Share this post


Link to post

Well, it works, but it is quite tricky because the duplicate doesn't have a name after duplication...

Here's how I do :

function duplicateClass(className : string) : string;
Const 
   ProvName = '###NewClass###';
VAR
   newClass, class2duplicate :  handle;

BEGIN
   class2duplicate := Getobject(className);
   newClass := CreateDuplicateObject( class2duplicate,getparent(class2duplicate));
   SetName(newclass,ProvName);
   RenameClass(ProvName ,className);
   duplicateClass := Getname(newClass);  
END;

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
Sign in to follow this  

 

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.

×