Hatch creation

I would love a command that creates a hatch in a similar method to drawing a polyline with persistant close turned on.

Im constantly having to create geometry in order to produce a hatch, which I then delete.

What are people’s thoughts?

1 Like

Good suggestion:

Command: Hatch
Select curves ( Boundary=No  Polyline ):

-Willem

you’re kind of missing my point-?

I want to do this without creating line geometry…

The example is a architectural section that at its extents is left open- aka the context exists beyond the extents of the drawing. I want to fill elements of the section / but due to it being open at one end then requires me to close all the open shapes before; and then delete the line geometry after…

Willem got the point, he just sketched up the “UI” based on standard Rhino logic. One would just click the “polyline” option to activate the direct-draw-hatch-mode. (It also opens up for a makro in a button like this: “-Hatch Polyline” to have a one-click-solution.

I just made a quick proof of concept script for this but it isn’t bullet proof yet, I’ll see if I can share it tomorrow.

Right now my biggest wish for hatches is the ability to insert point/knot.

1 Like

Here is that proof of concept script, it isn’t done but you can test it out.

Make a new button and copy paste this into it:

-_RunPythonScript (

import rhinoscriptsyntax as rs
import scriptcontext


pts=[]



while True:
    rs.Sleep(10)
    newPt=rs.GetPoint()
    if newPt:
        try:
            rs.DeleteObject(tmpCrv)
        except:
            rs.Sleep(10)
        pts.append(newPt)
        if len(pts)>1:
            tmpPts=list(pts)
            if len(pts)>2:
                tmpPts.append(tmpPts[0])
            tmpCrv=rs.AddPolyline(tmpPts)

    else:
        break      #get out of the loop




if rs.IsCurve(tmpCrv):
    if rs.IsCurveClosed(tmpCrv):
        newHatch=rs.AddHatch(tmpCrv)
        rs.DeleteObject(tmpCrv)
        rs.SelectObject(newHatch)

)

Woh amazing! Thanks so much!

sorry~ it would appear it jumped the gun and misinterpreted what you were saying… thanks!

instead of being about choosing points without refrence, is there a way it can be developed to allow for angle snapping based on the previous point?

Could it also be forumlated like this?

  1. draw polyline with persistant close on
  2. select last
  3. hatch
  4. select last > delete

sorry my python skills are only at the very beginning.

Great idea to use the default polyline… :smiley:

(I could not get it to work in a macro so here it is as a script)


import rhinoscriptsyntax as rs
import scriptcontext

pts=[]
rs.Command("! _Polyline _PersistentClose=Yes")

crv=rs.LastCreatedObjects()
if crv:
    if rs.IsCurve(crv[0]):
        if rs.IsCurveClosed(crv[0]):
            newHatch=rs.AddHatch(crv[0])
            rs.DeleteObject(crv[0])
            rs.SelectObject(newHatch)