Jump to content
Sign in to follow this  
Pat Stanford

Convert Nested Symbols to Groups

Recommended Posts

Someone on the Vectorworks mail list needed a way to convert nested symbols to groups. The attached script converts all nested symbols in placed symbols in a drawing to groups. It does not purge the drawing, but that functionality could be easily added.

Copy everything in the code block and paste it into a new blank vectorscript.

Let me know if you have problems.

Procedure UnNest_Symbols;

{Converts nested symbols to Groups}
{Converts sub-symbols in all placed symbols in a drawing to groups}
{It will convert the 2D portion of the symbol if used in Top/Plan the 3D portion otherwise.}
{All sub-symbols will also be converted.}

{August 12, 2011  Version 1}
{? 2011, Coviana, Inc - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}
{No rights reserves}
{Use at your own risk. May cause pimples or hysterical blindness}

PlacedSymbol:	Handle;

Procedure Doit(ProcessObject :Handle);

	MyDefinition:	Handle;
	NestedObject:	Handle;
	SymDefName:		String;

	SymDefName:=GetSymName(ProcessObject);  {get the name of the symbol definition}
	MyDefinition:=GetObject(SymDefName);	{use the name to get a handle to the definition}

	If GetType(MyDefinition)=16 then		{only work on symbol definitions}
			NestedObject:=FInSymDef(MyDefinition);	{Get the first object in the symbol def}
			While NestedObject <> Nil do 	{make sure you process all the objects in symbol def}
					If GetType(NestedObject)=15 then SymbolToGroup(NestedObject,1); 	{if a symbol convert to a group}
					NestedObject := NextObj(NestedObject);	{get a handle to the next object in the symbol}



Share this post

Link to post

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.

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.

  • Create New...