Hi all
I know there are a few posts on this already but I cant quite find what I’m looking for, maybe someone can help.
What would the correct ghpython approach be, using RhinoCommon, to bake a hatch defined with the gh Model Hatch component?
Nothing I have tried seems to actually add anything to the rhino file.
Im not sure if I actually have to create the hatch in the script, but the component supplies an object of type hatch already…
Attached the gh script and below one of the code approaches I have tried:
import Rhino
active_doc = Rhino.RhinoDoc.ActiveDoc
for hatch in i_hatches:
attr = Rhino.DocObjects.ObjectAttributes()
active_doc.Objects.AddHatch(hatch, attr)
active_doc.Views.ActiveView.Redraw()
import Rhino
import Grasshopper.Kernel as GK
from Grasshopper.Rhinoceros.Model import *
active_doc = Rhino.RhinoDoc.ActiveDoc
for obj in i_objects:
# Convert input to a ModelObject
# If input is already a ModelObject it will preserve all attributes (Layer, Color, Material, etc...)
modelObject = ModelObject.Cast(obj)
# Bake the resulting ModelObject
GK.IGH_BakeAwareData(modelObject).BakeGeometry(active_doc, None)
Be sure to use a ModelObject to keep all the properties in this case the hatch-pattern.