Rhino3DE
develop
design
educate
v3 plugins
v3 vbscript
v2 vbscript
tutorial
color match
convert curve equichordal
history hide
mesh mapper
open with V4
sel pts on crv
     
 

Match LayerColor and LayerMaterialColor

The first script sets all layers LayerMaterialColor to the LayerColor if a custom LayerMaterial is defined.

The second script sets all layers LayerColor to LayerMaterialColor. The change may not be visible in the Layer window until it will be updated.

These scripts are ready to copy and paste into buttons.
 

 

 

 

-_RunScript (
Sub LayerMaterialColor_To_LayerColor
Dim strLayer, intIndex
For Each strLayer In Rhino.LayerNames
	intIndex = Rhino.LayerMaterialIndex(strLayer)
	If IsNumeric(intIndex) Then
		If intIndex <> -1 Then
			Rhino.LayerColor strLayer, Rhino.MaterialColor (intIndex)
		End If	
	End If
Next
End Sub
LayerMaterialColor_To_LayerColor
)



-_RunScript (
Sub LayerColor_To_LayerMaterialColor
Dim strLayer, intIndex
For Each strLayer In Rhino.LayerNames
	intIndex = Rhino.LayerMaterialIndex(strLayer)
	If IsNumeric(intIndex) Then
		If intIndex = -1 Then
			intIndex = Rhino.AddMaterialToLayer(strLayer)
		End If
	Rhino.MaterialColor intIndex, Rhino.LayerColor (strLayer)
	End If
Next
End Sub
LayerColor_To_LayerMaterialColor
)

© 3DE < ^ >