Hi all,
I am trying to output some colored surfaces through a python function which I intend to use in a headless compute environment.
import rhinoscriptsyntax as rs
import scriptcontext
import Rhino
ghdoc = scriptcontext.doc
my_doc = Rhino.RhinoDoc.CreateHeadless(None)
my_doc.ModelUnitSystem = Rhino.UnitSystem.Meters
Rhino.RhinoDoc.ActiveDoc = my_doc
doc_object = my_doc.Objects.Find(G)
if doc_object is not None:
attributes = doc_object.Attributes
geometry = doc_object.Geometry
scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
# We add both the geometry and the attributes to the Rhino doc
rhino_brep = scriptcontext.doc.Objects.Add(geometry, attributes)
# Set print color if provided
if C:
rs.ObjectColor(rhino_brep, color=C)
scriptcontext.doc = ghdoc
a=rhino_brep
Unfortunately this doesn’t return the colored geometry.
Thanks
1 post - 1 participant