Jump to content

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
Link to comment

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

Link to comment
  • 9 years later...

This script is pretty handy, and still works pretty well despite being 22(!) years old.

 

The only small issue I've encountered is that after the second row of symbols, subsequent rows are placed on top of the second row, rather than repeating the Y offset each time. Any thoughts on how to correct that? The script is still useful despite this.

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.

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.

×
×
  • Create New...