Jump to content
Sign in to follow this  
Henry Finch

select by color script - what color is that?

Recommended Posts

I want to select objects by color from a file sent to me. How do I find what out what that color is to put in custom selction tool script?

Share this post


Link to post

If you select one of the objects, you can see in the Object Info Palette where in the polor palette the color falls. This will let you use the color picker in the Custom Selection dialog box to pick the same color.

If you want to manually edit the script and change the color numbers, you need to dig a little deeper. The information you want is in the VectorScript Appendix of the on-line help.

Select Help from the VectorWorks Help Menu. Select VS Function Reference. In the Right hand window click the link for the VS Function Reference.html. This will open a new browser window. In the top left pane, select Additional Resources, then the in bottom left pane select VectorScript Appendix.

Once you get to the appendix, scroll down until you see the color chart. Each cell in the chart has the reference number that you need for the script.

Pat

Share this post


Link to post

Thanks Pat,

However, when selecting the object with the unknown color and then looking at the attributes color palette, the object color is not shown or highlighted in the 16x16 color chart.

Henry

Share this post


Link to post

Henry,

That is very strange, I though all the colors were mapped to their closest match on the 16x16 palette. Ok, how about this script.

Procedure SelectColorMatch;

{Patrick Stanford, Coviana, Inc.}

{www.vectortasks.com, www.podcad.tv}

{Copyright 2007, Coviana, Inc.}

{Released for public use}

Var H1:Handle;

R1,G1,B1,R2,G2,B2:LongInt;

Procedure SelectIt(ThisObject:Handle);

Begin

GetPenFore(ThisObject,R2,G2,B2);

If ((R1=R2) & (G1=G2) & (B1=B2)) then SetSelect(ThisObject);

End;

Begin

H1:=FSActLayer;

GetPenFore(H1,R1,G1,B1);

DSelectAll;

SetSelect(H1);

ForEachObject(SelectIt,ALL);

End;

Run(SelectColorMatch);

If you are looking for something other than the primary line color, you could replace teh GetPenFore with GetFillFore or GetFillBack or even Get Pen Back.

Copy everything between (and including) the Procedure SelectColorMatch) and the Run(SelectColorMatch); and paste them into a blank Vectorscript (created from the Resource Browser).

Touse the script, select one object of the desired color and run the script. Every object in the drawing with the same color will be selected.

Hope this helps.

Regards,

Pat

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.

×