Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
Heath

Select all occurrences of a symbol.

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

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

Pat,

Thanks for your expertise on this. It does exactly what I wanted.

Heath

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
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.

×