Jump to content
Developer Wiki and Function Reference Links ×

Select all occurrences of a symbol.


Heath

Recommended Posts

I am sure this is simple for those of you here much smarter than I. I would like to have a tool (script) that I can select a symbol and have all of occurrences on the active layer of that symbol selected. I know I can use the custom selection tool, but I would sure like to just click on one of the symbols and have all occurrences selected without having to fill out all the custom search criteria.

Thanks in advance for any help given.

Heath

Link to comment

Heath,

See if this works for you:

Procedure SelectLikeSymbols;

{User clicks on symbol in drawing and selects all like symbols}

{Works on individual and symbols inserted in walls}

{? 2008, Coviana, Inc - Pat Stanford pat@coviana.com}

{Licensed under the GNU Lesser General Public License}

var H1,H2 :Handle;

B1 :Boolean;

X1,Y1 :Real;

N1 ,N2 :Integer;

S1 ,S2 :String;

Begin

{Gets the user click on an object}

B1:=False;

While Not B1 do

Begin

GetPt(X1,Y1);

B1:=GetPickObjectInfo(X1,Y1,H1,H2,N1);

End;

{end of Gets the user click}

{Handle the click}

If H2 <> Nil then H1:=H2;

N2:=GetType(H1);

If N2 = 15 then {If object is not a symbol don't do anything}

Begin

S1:=GetSymName(H1);

DSelectAll;

S2:=concat('S=',chr(39),S1,chr(39)); {CHR(39) is single quote}

SelectObj(S2);

End;

RedrawAll;

End;

Run(SelectLikeSymbols);

Pat

Link to comment

Heath,

I just noticed that you only wanted the objects on the current layer.

Replace the S2:= line with the following:

S2:=concat('(L=',Chr(39),GetLName(ActLayer),Chr(39),') & (S=',chr(39),S1,chr(39),')');

As an aside, if you have your layer options set to Show/Snap/Modify others, you can click on a symbol on a different layer and get all the symbols on the active layer selected.

Pat

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