Page 1 of 1

Randomize Object ID Colors for Rhino 5

Posted: Thu May 14, 2015 6:50 pm
by adamwade
Hey JD,

I've had trouble using the old code you wrote for randomizing Object ID colors. I'm in Rhino 5 (64bit) now and I can't seam to create a button that functions properly. Can you assist please (or anyone else)?

Thanks

Here is the original code you wrote that worked in Rhino 4:

_NoEcho
-_RunScript (
Dim obj, key, r, g, b
key = "MWR_OBJIDCOLOR"
obj = Rhino.FirstObject
While Not IsNull(obj)
r = "255:" & Cstr(Int(Rnd * 256))
g = ":" & Cstr(Int(Rnd * 256))
b = ":" & Cstr(Int(Rnd * 256))
Rhino.SetUserText obj, key, r & g & b
obj = Rhino.NextObject(obj)
Wend
Rhino.Print "Done Randomizing Maxwell Object IDs."
)

Re: Randomize Object ID Colors for Rhino 5

Posted: Thu May 14, 2015 6:53 pm
by JDHill
Give this a try, instead:
Code: Select all
_Maxwell_RandomizeObjectIDs
:)

Re: Randomize Object ID Colors for Rhino 5

Posted: Fri May 15, 2015 9:33 pm
by adamwade
Perfect !!!! :!: :mrgreen:

Thanks JD.