Macro request, objects display color -> layer assigned color


#1

I often work with files coming from other people.
Some of their layers have set object’s color to be different from Layer color.
Can somebody help me with a macro that makes all objects display color to match the layer assigned color?

Thanks,
Yianni


(Dale Fugier) #2

You don’t a macro. Just select all objects (Ctrl+A) then from the Properties panel, change the object color to “By Layer.”


#3

Oh I see.
Over the long time I m using Rhino, I got a good knowledge of its use, but I now strive to increase my work speed.
Since its not possible to be done with a macro, can it be scripted?
Any volunteers? :smile:
(I wish I had the time to learn a bit scripting…)


(Pascal Golay) #4

Hi Yianni -

! _SelAll _NoEcho _-Properties _Object _Color _Layer _EnterEnd

-Pascal


#5

I am most Grateful Pascal !


(Dale Fugier) #6

This button macro should do the trick:

_-SelAll
_-Properties _Object _Color _Layer _Enter _Enter
_-SelNone

And here is the RhinoScript equivalent:

Sub ResetObjectColor
	Dim arrObjects : arrObjects = Rhino.AllObjects
	If IsArray(arrObjects) Then
		Call Rhino.ObjectColorSource(arrObjects, 0)
	End If
End Sub

#7

Thank you Dale !