Jump to content
Developer Wiki and Function Reference Links ×

Request: Make 2d/3D Symbol 'Unique' script

Recommended Posts

As already discused here: https://forum.vectorworks.net/index.php?/topic/61717-make-symbols-unique/

it would be really usefull if there was a button/script that would duplicate a 2D/3D symbol and replace the selected symbol with the new duplicated 'unique' symbol.


- Can be a button in PIO, next to the 'replace' button

- And/or could be a item in the right-click menu, under the 'replace' option


Nice to have:

- pop-up that asks the name for the new symbol, by default add -1, -2 etc to the original name

- pop-up asking if you want all sub symbols to be unique


Starting point:

See https://forum.vectorworks.net/index.php?/topic/12522-duplicate-symbol-definition/&tab=comments#comment-396710

And https://gist.github.com/justinmilo/bbc1d64f28509737b601#file-makeunique-py


Unfortuantly this script can not duplicate  2D/3D hybrid symbols. But now it's 7 years later. Any possibility that VW script capability has grown so a true "make unique" script is possible?


I hope someone can help with this request. This would be super usefull during design studies where we often try out different options.

Edited by MarcelP102
Link to comment

@Jesse Cogswell I Have tried the script. It works perfectly for 2D symbols. But when I make a hybrid symbol containing walls unique I get this message see step 2. It's Dutch, but translates into 'Are you sure you want to degroup a object from a higher level?' The view is in 3D and showed the symbol 3x instead of 2x. 


When clicking YES: Results in a unique hybrid symbol but the walls are copied as polygone lines

When clicking NO: Results in correct unique hybrid symbol, without the extra polygone lines. But it has copied the walls outside the symbol


1- Start, 2x orignal symbol



2- Pop-up



3 - Result of selecting YES



4 - Result of selecting NO


Edited by MarcelP102
Link to comment

 The way the script works is that creates a new symbol with the unique name, drops the original symbol into the symbol definition, converts the symbol to a group, then ungroups the group to leave in the geometry.  For hybrid symbols, it does this twice, once for 2d geometry and once for 3d geometry.  My guess is that the error is a result of the walls essentially being dropped in twice, as they are hybrid objects themselves.

I'll look into this a bit more tomorrow, I might be able to fix it.  Until then, avoid using the tool on symbols containing hybrid plug-in objects (other hybrid symbols should be okay).

  • Like 1
Link to comment

@MarcelP102 Took another crack at the script, and I think I got it to work.  Let me know if you see anything else that isn't working as expected.  You should be able to do the same process using the Install button in the Plug-in Manager to install it as long as you haven't moved it around in your user folder (if so, delete the file from the user folder before installing).  No need to worry about editing your workspace again.



Make Symbol Unique.zip

Edited by Jesse Cogswell
Updated plug-in. Added functionality for mirrored symbols, layer elevations, and running on multiple instances of the same symbol at once.
Link to comment

Okay, so I started writing up a whole thing how none of the duplicate commands in the function reference apply to symbol definitions, as those were the things I tried first.  But in the process of writing that up, I got an idea to "crawl' through the selected symbol and use CreateDuplicateObject with each object in the symbol.  After some tricky coding to get those duplicated objects into the new symbol definition in the proper planes, I was able to make that work and without having to navigate around the quirks with the SymbolToGroup command and the problems it causes with high level objects.  The added benefit is that text objects linked to a record format now retain that link, meaning I was able to transfer records over as well, which was a huge downside to the original tool.


Big props to @Pat Stanford for making me get off my butt and work for it.  Updated tool attached.  Same installation as before.



Due to a request from another user, I've added the option to either retain the original symbol's records in the new symbol, or to overwrite the defaults with the symbol's current values.  It will prompt for each attached record, so you don't have to overwrite all of the record formats unless you want to.




Make Symbol Unique.zip

Edited by Jesse Cogswell
Updated plug-in. Added functionality for mirrored symbols, layer elevations, and running on multiple instances of the same symbol at once.
  • Like 2
Link to comment

CreateDuplicateObject should work for duplicating a symbol. The following is basically from my old archives of the Vectorscript Mail List (sadly defunct) from 2009. Thanks to @Julian Carr @Gerard Jonker and Bill Wood for this information.


Procedure DupeSymbol;
        h1 : HANDLE;
    s1 : STRING;
       s1 := GetSymName(FSActLayer);
   h1 := GetObject(s1);
    IF (h1 <> Nil) & (GetType(h1) = 16) THEN BEGIN
          h1 := CreateDuplicateObject(h1, GetParent(h1));
        SetName(h1, Concat(s1, '-1'));


  • Like 2
Link to comment

After further testing, CreateDuplicateObject DOES INDEED work for duplicating symbol definitions, just not in Vectorworks 2019 where I was developing the original script.  I made a quick test file with the code Pat posted above, and it would not work in 2019 at all.  Opened the exact same file in 2021 and it worked just fine in duplicating symbol definitions.  I'm going to keep the original code as is to maintain backwards compatibility.

Link to comment
  • 5 months later...

Hi @Jesse Cogswell we are now in the progress of modeling an existing highly modular building. You plugin is a real timesaver! Thanks again! A college noticed a hybrid 2d/3d within a symbol cannot be made unique when in 3D edit mode. Making the symbol unique in 2D edit mode works correctly. But sometimes it's more difficult to select the object in 2D mode. Being able to make the symbol unique in 3D mode would be great. Can your take a look, perhaps it's a small fix? See screenshot and file below.


Best wishes for 2022!

Error plugin.JPG

Error plugin.vwx

Link to comment

@MarcelP102 It took me a bit to figure out what was causing the bug, but it was really easy to fix once I found it.  The script works by building a "blank" symbol definition using a locus point, then copying all of the components from the original symbol into the new symbol definition, then finally deleting the locus point.  It breaks when the script is run inside a symbol, as the locus point is created in the 2D component of the symbol, so the new symbol definition doesn't actually get created.  The fixed script will now pull your current view projection and create a 2D locus if in Top/Plan view or a 3D locus if you're in a 3D view.  I did some tests and couldn't make it break, so you should be good to go.


Happy holidays!

Make Symbol Unique.zip

  • Like 2
Link to comment
  • 3 weeks later...

Hi Jesse, can confirm it is working as expected. Thanks! 


Ps. Would it be an idea to start an github/gitlab account where you collect your plugins? That would make the discovering of your plugins better and gives us the possibility to share translated versions of you plugins. You can then simply link to the plugin instead of uploading it to all the different forum topics. 

Link to comment
  • 6 months later...

Hi @Jesse Cogswell


I found two bugs while working with 3D symbols.


1. When making the bars unique some bars gets duplicated. Sometimes even multiple times. See screenshots and attached file.








2. When making this symbol unique the mirrored symbols gets flipped. See screenshots and attached file.


Before /after


Make unique - duplicates.vwx Make unique - mirrored objects.vwx

Link to comment
  • 1 year later...

@Jesse Cogswell, I just found this script and it is awesome.  Just wanted to make everyone aware that besides the issues as noted by @MarcelP102 above the script also does not work well when the user origin is not the internal origin.  The symbol will displace and the symbol's internal origin will also be offset.  


Jesse if you figure out how to fix the origin issue please let me know as I have a drawing label aigning script that also has the same issue. 

Link to comment

Hmm, I'll need a little more time to investigate the issues that @MarcelP102 mentioned above (I must have been busy when he made the post all those years ago, I don't remember seeing those bugs), but I was able to fix the issue with the internal origin.


To compensate for the internal origin, you need to use GetOriginInDocUnits to pull the current User Origin, then subtract those values from the placement or movement script.  I had actually done that in the origin version of this script, but rather than applying those values directly to the Symbol call, I instead applied them to the Move3DObj call that moved the newly placed "unique" symbol to match the height of the original object.  This works great for objects on Design Layers, but doesn't seem to work with objects on Sheet Layers.  I moved added the user origin adjustment to the Symbol call and it seems to work properly.


I'll give @MarcelP102's issue a look.  I suspect the flip problems arise from having flipped symbols nested inside the symbol you are trying to make unique.  The script does do a flip check, but only on the original base symbol instance, not on any nested symbols.


Make Symbol Unique.vsm

Edited by Jesse Cogswell
  • Like 1
  • Love 1
Link to comment

After some further testing, this doesn't appear to work with flipped instances of symbols on a Sheet Layer, but works correctly on a Design Layer.  I'm currently chalking this up to some oddness with the Mirror function, which may be fixed with the newer MirrorN function added to VW2023.  Further testing required.

  • Like 2
Link to comment

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