Surface to hatch (inverse of explode hatch)

Just say i have 22,000 trimmed planar surfaces

I want to hatch them, like the reverse of explode hatch

is there any possible way to do this? using rhino common or C# / vb / python /

thanks

arkadius

this should work:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc


def hatchPlanarSrfs():
    """
    hatch all selected planar surfaces
    tested in Rhino 6
    """
    
    
    
    srfs = rs.GetObjects("select planar surfaces to hatch",8)
    if not srfs:
        return
    for srf in srfs:
        
        srf = rs.coercebrep(srf)
        face = srf.Faces[0]
        if not face.IsPlanar():
            continue
        edges = srf.Edges
        edges = [edge.DuplicateCurve() for edge in edges]
        edges = Rhino.Geometry.Curve.JoinCurves(edges)
        
        hatch = Rhino.Geometry.Hatch.Create(edges, 0, 0, 0)
        sc.doc.Objects.AddHatch(hatch[0])
    sc.doc.Views.Redraw()

if __name__ == "__main__":
    hatchPlanarSrfs()
1 Like

@Gijs,

With this script, you completely solved this issue here :stuck_out_tongue_winking_eye:
Clipping Plane Fills! Please

don’t quite get this? can we access the intersection boundary curve then?

Yes this works in a sense, we can also do this in gh, say get brep edges and create hatch, however i was wondering how rhino computes surface from hatch, and if there was a completely inverse method, as it only takes a matter of seconds to explode loads of hatches to srf, but the inverse option above takes along time to compute [but still works].

thanks,

arkadius

So a hatch can be queried if it has a ‘BrepForm’

“[HasBrepForm]”

and:

“Returns true if the Brep.TryConvertBrep function will be successful for this object”

"TryConvert:

Provides implementation for type conversion operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another."

So would there be a way to impliment a conversion like this> :?

HasHatchForm

Hatch.TryConvertHatch???

not sure what’s your problem, because I just tested it at 12000 surfaces and it took only a few seconds?

whereas doing it in Rhino directly gives me an endless ‘sorting… press esc to cancel’ prompt

yes, in that thread I posted a script that gives you the surface of the intersection. converting that to hatch and you’re done :stuck_out_tongue_winking_eye:

can you point me to it? can’t seem to find it

Follow the link on this post: