Earlier this week I learned that I wasn’t understanding some fundamental programming concepts regarding GHpython/GH/Rhino, (thank you @piac for setting me straight!)
As a result, I wanted to better understand what the GHPython component would need to display something like hatches.
NOTE: Before going any further, if you want to do anything with hatches/layers/attributes…you should use Human or Elefront. Those plugins are much more robust/flexible/just plain better.
But… for the sake of taking an exercise to completion, I wanted to learn how to “create” hatches and have them previewed by GH, without baking.
The desired steps were to Read the hatch table, create the hatch Objects, then display them in the Rhino document without baking.
After some tooling around, the key item was Rhino.Geometry.Hatch.CreateDisplayGeometry()
Once again, thank you to all the people that help out those of us that sometimes struggle through. I do not know if this is the best way to achieve this, but it worked, and I consider it a successful conclusion to my exercise! GetHatchesAndDisplay_GHPY.gh (13.3 KB)
rather than adding the drop-down text, or in addition, you could set a new icon (GH standard) by dragging and dropping a 24x24 png image on top of the GhPython component.
there’s no need to import scriptcontext and rhinoscriptsyntax in these script, nor change the rhinoscriptsyntax target document, because you do all your work in RhinoCommon (import Rhino). Also, the Grasshopper SDK is not necessary, for the same reason.