cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Macro select by RGB value

jsvejkovksy
1-Visitor

Macro select by RGB value

I'm trying to create a macro that will select a fill by an RGB value (R:252, G:249, B:206). So far I haven't been able to get this to work, can anyone help? Please & Thanks

ACCEPTED SOLUTION

Accepted Solutions

You'll need to load both the macro and submacro, but this should work for your specific need.

Macro SelectFill

Define el as Element

Define RedGreenBlue as String

Define id as String

Select None

#Select if Type is not equal to "Line"

Select All

el = ActiveDoc.FirstSelectedElement

On Error Goto skipError

While (exists(el))

RedGreenBlue = el.fill.colSpec.rgb

#message "~" + RedGreenBlue + "~"

if(RedGreenBlue <> "{RGB 252 249 206}")

Create object_info el

id = el.info.id

Select Object id Toggle

else

end if

RedGreenBlue = ""

el = el.nextSelectedElement

End While

End Macro

SubMacro skipError

End SubMacro

View solution in original post

5 REPLIES 5
rdiaz
12-Amethyst
(To:jsvejkovksy)

Hi Justin,

Could you let us know what product you are working on this for, and what process you have tried so far that has been unsuccessful?

I'm using IsoDraw 7.1. Most of the time I can just record the steps i'm doing and that's good enough. I usually go Edit>Select and they choose how/what i want from there. There are no options for select by rgb or cmyk. Thats about where i got stuck.

You'll need to load both the macro and submacro, but this should work for your specific need.

Macro SelectFill

Define el as Element

Define RedGreenBlue as String

Define id as String

Select None

#Select if Type is not equal to "Line"

Select All

el = ActiveDoc.FirstSelectedElement

On Error Goto skipError

While (exists(el))

RedGreenBlue = el.fill.colSpec.rgb

#message "~" + RedGreenBlue + "~"

if(RedGreenBlue <> "{RGB 252 249 206}")

Create object_info el

id = el.info.id

Select Object id Toggle

else

end if

RedGreenBlue = ""

el = el.nextSelectedElement

End While

End Macro

SubMacro skipError

End SubMacro

This worked perfectly, thank you!


Hello Trevor,

Is there any way to fill the closed contour line with Color using macro? I am using IsoDraw CAD Process 7.3

Announcements

Top Tags