Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5892

Select text by color

$
0
0

@Tudor_Chirila wrote:

Hi.
My current challenge is to select all texts from a rhino document, and then append each text to new lists, but by color. A short example: I have 10 text objects, 3 are red, 3 are green and 4 are blue. I need to select all objects, and 3 lists are to be made: 1 list containing the red text objects, 1 list containing the green objects and the last one containing the blue objects.

This is what I've tested so far.

objs = rs.GetObjects("Select Objects")
color1 = (255,0,0)
color2 = (255,255,255)

for i in objs:
if rs.IsText(i):
l1 = rs.ObjectsByColor(color1)
rs.DeleteObjects(l1)
l2 = rs.ObjectsByColor(color2)
rs.DeleteObjects(l2)

With these lines of code, the script deletes all my objects that have those colors, even though I never selected them.
Any help is appreciated.
Thanks, T.

Posts: 10

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles