Jump to content
Sign in to follow this  
Nico_be

Place all symbols present in the file on the drawing. Help!

Recommended Posts

Hallo,

Here is un script found on another site. This script place all symbol include in the file, in all folders, on the drawing.

Marvelous to create after that a tablelist and edit directly in the table.

But the script crashes at the end of the process!! :(

is somebody could take a look at it and see the error?

Pleeaase ! :crazy:

PROCEDURE ShowAllSymbols;

{?1999 Graphsoft,  Inc.}
{The traverseSymbolList procedure was developed by Craig Hollinshead.}


VAR
     numFolders, numNestedFolders, numSymbols : INTEGER;
     messageString : STRING;
     OK : BOOLEAN;
     NewPtSize : INTEGER;
     OldPtSize : INTEGER;
     SelectedObj : HANDLE;
     TheSymbolName : STRING;
     SymFolderName : STRING;
     TheSymDef : HANDLE;
     SymDef2 : HANDLE;
     ChangeAllLines : BOOLEAN;
     CurrLayer : HANDLE;
     X,Y : REAL;
     XSpacing, YSpacing : REAL;
     NumAcross : INTEGER;
     StartX,StartY : REAL;
     LayerNames : ARRAY[0..200] OF STRING;
     Index : INTEGER;

{=============================================================================}

     PROCEDURE TraverseSymbol(theSym:Handle);

     VAR
             symObjClass : STRING;
             origLineWt : INTEGER;
             symName : STRING;
             symInstance : HANDLE;
             sX1,sX2,sY1,sY2 : REAL;

     BEGIN
             symName := GetSDName(theSym);
             symName := GetName(theSym);
             Symbol(symName,X,Y,0);
             symInstance := LNewObj;
             GetBBox(symInstance,sX1,sY1,sX2,sY2);
             TextFace([bold]);
             TextOrigin(sX1,sY2-1);
             BeginText;
                     symName
             EndText;
             X := X + XSpacing;
             IF (X > (StartX + (NumAcross * XSpacing))) THEN
             BEGIN
                     X := StartX;
                     Y := StartY - YSpacing;
             END;
             Message(concat('The Sym#',Num2Str(0,numSymbols),' is   -   ',symName));
     END; {PROCEDURE TraverseSymbol}

{==============================================================}

     PROCEDURE traverseSymbolList (itemHdl:HANDLE);
     BEGIN
             WHILE (itemHdl <> NIL) DO BEGIN
                     CASE GetType (itemHdl) OF

                             16:BEGIN
                                     TraverseSymbol(itemHdl);
                                     numSymbols := numSymbols + 1;
                             END;

                             92:BEGIN
                                     SymFolderName := GetName(itemHdl);
                                     numFolders := numFolders + 1;
                                     numNestedFolders := numNestedFolders + 1;
                                     LayerNames[numFolders] := SymFolderName;
                                     Layer(SymFolderName);
                                     X := StartX;
                                     Y := StartY;
                                     TraverseSymbolList (FInFolder (itemHdl));
                             END;
                     END; {CASE GetType (itemHdl)}
                     itemHdl := NextObj (itemHdl);
             END; {WHILE (itemHdl <> NIL)}
             IF numNestedFolders > 0 THEN
                     numNestedFolders := numNestedFolders - 1;

     END; {PROCEDURE traverseSymbolList}

{==============================================================}

BEGIN
{*/// Main program ///*}

     XSpacing := DistDialog('Enter Horizontal Spacing Distance:','');
     YSpacing := DistDialog('Enter Vertical Spacing Distance:','');
     NumAcross := IntDialog('Enter the number of symbols per row','');
     Message('Click on top left corner of the grid');
     GetPt(StartX,StartY);
     CurrLayer := ActLayer;
     numFolders := 0;
     numNestedFolders := 0;
     numSymbols := 0;
     X := StartX;
     Y := StartY;
     LayerNames[0] := GetLName(ActLayer);
     IF FSymDef <> NIL THEN
             TraverseSymbolList (FSymDef);

     Index := 0;
     Layer(LayerNames[index]);
     WHILE (FInLayer(ActLayer) = NIL) DO
     BEGIN
             Index := Index + 1;
             Layer(LayerNames[index]);
     END;
     SetLayerOptions(1);
     Redraw;
     ClrMessage;
END; {PROCEDURE ShowAllSymbols}
RUN (ShowAllSymbols);

Thanks!!

jab

Edited by Jab_be

Share this post


Link to post

I tried the script on a small file and it did not crash. Perhaps it has to do with a specific object in your file. In a copy of your file, you might try removing symbols to try and locate the offending object. If it still crashes with an empty symbol folder then it is something else. Write back with more info and hopefully someone will be able to help further.

Please, work in a COPY of your file.

Raymond

Share this post


Link to post

After hours and hours, i've found something :

If one plant is setup with "show 2D details", the script craches....

Why? I don't know...

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.

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