Rhino 5 had a command _RenderLoadMaterialFromFile. Is there a similar command in Rhino 6. I would like to be able to load rtml file from a script or Grasshopper and cannot figure out a solution
You can use RenderContent.LoadFromFile like this:
from scriptcontext import doc
from Rhino import Render
import rhinoscriptsyntax as rs
file = rs.OpenFileName()
mat = Render.RenderContent.LoadFromFile(file)
doc.RenderMaterials.Add(mat)
Thank you, that worked. Any chance you could help me with assigning it to a new or existing layer
from scriptcontext import doc
from Rhino import Render
import rhinoscriptsyntax as rs
file = rs.OpenFileName()
mat = Render.RenderContent.LoadFromFile(file)
layer = rs.GetLayer()
layerIndex = doc.Layers.Find(layer, True)
doc.Layers[layerIndex].RenderMaterial = mat
LayerRenderMaterial.py (271 Bytes)