Jump to content
Developer Wiki and Function Reference Links ×

Copy/Paste Objects and Reassign Incoming Classes to Existing Classes


Recommended Posts


I had just edited the previous post..

in the meantime I worked out this

ForEachObject(AssignThem, SEL);

SEL criteria did the job, when calling the procedure



IF GetClass(h) = LOC_ClassArray[x] THEN SetClass(h, assign_to);


thanks anyway!

Link to comment
  • Vectorworks, Inc Employee

You're welcome.

You did almost exactly what I did! :-)

I'd still recommend my version since it doesn't change the active class or selection state of any objects. This should make it run faster and leave the drawing state as the user would expect. Plus it should work on objects within symbols and groups.

If you have a large file to test on, try both versions to see if there's a difference.

Link to comment

Ciao Giovanni,

did you consider building the LB on resource lists passing obj type 94?

Using the resource lists you are also able to offer the choice of items residing in the standards folder, moreover the list is automatically alpha-sorted, which is good.

i := 0;

WHILE GetNumLBItems(gD, cLB_Left) < gNumClasses DO BEGIN

clN := GetActualNameFromResourceList(gClassList, inc(i));


I can't try the script now, but it looks nice!


Link to comment

Ciao Orso!

thanks for the suggestion. I hadn't thought about passing obj type 94, it actually sounds a much more straight forward way to build the resource list.

I will go through the script again, hopefully soon..

If anyone who has tried the plug in had other suggestions, please let us know!

Bis Bald


Link to comment
  • 4 weeks later...

Hello Everyone!

Here is a new Downloadable Script for the Smart Paste!

Download both attachments (_DialogBuilderUtilities.txt is needed too)


View the Script Here


I have Re-written the Script using Resource Lists to Build the List Browsers as suggested by Orso.

This worked Smoothly (thanks orso).

I also worked out the Undo Button. I had to use arrays because I faced some problems in outputting the User selections to a txt file and then reading them back to Undo the Actions.

If anyone can give me some hints on this, it would be good..

I still have the intention to implement the functionality of saving the User's Choices so that the plug in will be able to do part of the Job automatically, without the User to always re-select already made associations (Matt, I think you suggested this at some point..)

Many Thanks to everyone for helping out with this so far!!!


PS: this script has only been tested on a Mac version of Vectoworks 2009. Please let me know anyone experiences problems with other versions.

Edited by Gio Pet
Link to comment

Hi Gio,

It would be good if the dialog box can show which existing class has been assign to incoming class after click the Assign button. for large copy element which consist of a lot of classes, it is good if we can do a final checking ( correct assign ) before we proceed to OK button. for large project, it is very difficult to correct it if we assign wrongly. Once the new paste element has been park under current existing class which consist thousand of objects. it will be though to fix it.

btw. it is nice script. credit to you.


Link to comment
  • 3 weeks later...
  • Vectorworks, Inc Employee

I finally got a chance to look at this.

Well done Giovanni! I've not played around with resizable dialog, but I'm sure you're aware of the LB widths not sizing correctly.

This will be a good command to have on hand. Keep us posted on any updates. :-)

Link to comment

If you want to load use an external file use the XML functions.

Here is a snippet to get started.

When you script is executed you will want to write to the XML file

what the old class was and what the new class is

When you load your script you will want to load the XML file and see if there are any classes to be reassigned with defaults if so set the default.




kLibraryFolder =-13; {constant to set the file path to the VW library folder}



xmlFile :STRING;

result :INTEGER;


hXML := InitXML;


xmlFile := 'ClassAssign.xml';

result := ReadXMLFile(hXML, kLibraryFolder, xmlFile);

DATAPath:=Concat('/Prefs/',ClassName[]); {defines the classname path, upto you how to this is structured.}

result := GetElementValue(hXML, DATAPath, NewClassName[]));

{this will return the value to NewClassName[]}

result := ReleaseXML(hXML);



Message('Could not initialize XML reader.');



Edited by Assembly
Link to comment
  • 2 months 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.

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