Hello!
What’s the simplest way to get the areas of a list of hatches with holes? Sounds trivial, but it ain’t.
Tried already:
The ootb Area component cannot digest hatches (Why actually, because the area command in Rhino can).
“Elefront Deconstruct Hatch” casts a “Solution exception” error.
As does “Human Hatch Explode”.
Besides them not working, both would output boundary curves, which are tricky to get the area from when there were holes in the hatch.
If you’re amenable to using Rhino 8 WIP, then we have a couple of pretty easy ways to do this. I just made some modifications to the code base so it wont be available until next Tuesday when the next WIP is released. There’s a sorta hacky way to do it now, but I’d prefer to show you the easier process when the next WIP build is released next week. Is that ok?
import Rhino
rObj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(ID)
if type(rObj) == Rhino.DocObjects.HatchObject:
hatchGeom = rObj.Geometry.Explode() # Type: GeometryBase. An array of geometry that formed the appearance of the original elements.
if hatchGeom:
for geom in hatchGeom: # Breps
if geom.ObjectType == Rhino.DocObjects.ObjectType.Brep:
area = geom.GetArea()
The idea behind is that hatches can be used quite nicely for areas of a building, because they, well, define an area, and also display it. That’s so intuitive that it’s a bit odd why they don’t have a GetArea() method.