ScriptSpot

Forum topic · General Scripting

Select by 3 wirecolors

By Mrjacks2o · 2015-03-19

Description

Hi cant seem to figure out how to select objects in the scene with 3 wirecolors

so lets say i have 6 objects
1 object is ( blue ) color 8 8 136)
1 object is ( red ) color 135 6 6 )
1 object is ( green ) color 6 135 6 )

the rest are pink so how can i select blue - red and green at once
so far with my code i can only select 1 color at once.

select (for o in objects where o.wirecolor == (color 8 8 136) collect o)

any help would be appreciated
thanks

Comments (3)

re: select 3 wirecolors

pixamoon · 2015-03-19

Hi,

I think it can work this way:


select (for o in objects where o.wirecolor == (color 135 6 6 ) or o.wirecolor == (color 8 8 136) or o.wirecolor == (color 6 135 6) collect o)

Hope it helps :)

barigazy · 2015-03-19

Short way ;)

select (for o in objects where (findItem #(red,green,blue) o.wirecolor) != 0 collect o)

.

miauu · 2015-03-19


(	 
	objsArr = for o in objects collect
		(
			case o.wirecolor of
			(
				(green): o
				(blue): o
				(red): o
				default: dontCollect
			)
		)
	selectMore objsArr
)