How can I load a material from file in Rhino 6+ in Rhinoscript? This is what was working in Rhino4:
Function LoadMaterialToLayer(MatFilename, LayerName)
Set RDK = Rhino.GetPlugInObject("Renderer Development Kit")
MatID = RDK.ContentLoadFromFile(MatFilename)
MatIndex = Rhino.LayerMaterialIndex(LayerName)
If MatIndex < 0 Then MatIndex = Rhino.AddMaterialToLayer(LayerName)
LoadMaterialToLayer = RDK.SetMaterialInstanceId(MatID, MatIndex)
End Function
It works so far as loading the material in Rhino 6, but it won’t get assigned to the layer. Instead. an “unnamed” generic material gets created and assigned to the layer. I can manually assign the newly imported material to the layer, so what am I missing? Thanks.
1 post - 1 participant