Jump to content
Developer Wiki and Function Reference Links ×

Placing all symbols from the recourse browser on a Design Layer


Recommended Posts

  • 1 month later...

Hello,

I've been using this script for a long time, and I've integrated it into the menu via the Plugin Manager because it's so practical and frequently used.

 

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;
             numSymbols := numSymbols + 1; {Increment symbol count here for accurate tracking}
             X := X + XSpacing;
             IF (X >= (StartX + (NumAcross * XSpacing))) THEN
             BEGIN
                     X := StartX;
                     Y := Y - YSpacing; {Move to next row}
             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);
                             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);

 

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