Hi,
I would like to find a way to convert a hatch to a surface to be recognized on GH after .
Could you help me to resolve this issue?
many thanks
There does not seem to be a native command to convert a hatch to a surface.
You can run the following Python script, which is an example script from mcneel which i slightly altered:
import Rhino
import scriptcontext
def ExplodeHatch():
filter = Rhino.DocObjects.ObjectType.Hatch
rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select hatch to explode", False, filter)
if rc != Rhino.Commands.Result.Success: return
hatch = objref.Geometry()
if not hatch: return
hatch_geom = hatch.Explode()
if hatch_geom:
for geom in hatch_geom:
if geom.ObjectType == Rhino.DocObjects.ObjectType.Brep:
scriptcontext.doc.Objects.AddBrep(geom)
scriptcontext.doc.Views.Redraw()
if __name__=="__main__":
ExplodeHatch()
This will take a hatch you select and add a surface representation of that hatch to the rhinodoc.
EDIT:
Totally forgot _Explode
works on hatches!
@Piotr is totally right
Exploding solid hatch makes it a surface, but it happens outside GH. You can load it afterwards.
Thanks for your help
! I think the curve are to complex for it. It give the same result as explode it
They are, certainly, not to complex for this operation but rather messy.
Post the file, please.
1906_test3.3dm (846.3 KB)
hope it can help…
Human and elefront have some great hatch/deconstruct Hatch tools.
If you are on Rhino 6, you could use something like this in a GhPython component.
set your type hint for input X to GUID.
Refernce your Hatch into a GUID parameter and feed into x of ghpython:
import Rhino
obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(x)
ghHatchPattern = Rhino.RhinoDoc.ActiveDoc.HatchPatterns.FindIndex(obj.HatchGeometry.PatternIndex)
RawGeo = obj.HatchGeometry.CreateDisplayGeometry(ghHatchPattern,1)
a = RawGeo[0]
b = RawGeo[1]
c = RawGeo[2]
#https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Hatch_CreateDisplayGeometry.htm
NOTE: I did not test this with your file.
I think it’s a tolerance problem…
You model in meters and your tolerance is set to 1 Centimeter, while many features of your curves are less then 1cm in length. This is bound to produce problems.
Two ways to fix this:
- scale your geometry by facto of 100 or 1000
- set your tolerance tighter, for example 0,001 or 0,0001
yes i did the model in autocad in centimeter. but i’m drawing in rhino a model that need to be in meter… So i did a scale… I will have look to the tolerance many thanks !
yeahh it was that! the tolerance ! Many thanks !!!