Rhino is slow when hatching

I have a decent computer. However, when I hatch many curves in one go. Rhino seems to hang for a while. I am talking about only 1000 curves and I apply the hatch function.

  1. Is there a way to speed it up? At the moment, I have to do the hatch in batches, as the time it takes seem to me is growing exponentially.

  2. Rather than doing hatch, is there a way easier way to color in the curves with a color?


hatch one row or even just one and make an array, then make 2 different rows and make an array again,
done in less than 1 minute.

I cannot use the array function. The image above is just an example. The holes can be located randomly and the size can be different. So array is not an option.

Have you tried to hatch 1000 or 10000 holes?

There is a solution:

if you access hatching by code you can significantly improve performance by not passing the curves as a collection, but rather iterating through each curve and say hatch me.

If you have Grasshopper, you can access this little script: 10000 crvs took < 30 milliseconds for everything

HatchBake.gh (372.1 KB)

code is very simple:

if (bake)
      for (int i = 0; i < crvs.Count; i++)
           RhinoDocument.Objects.AddHatch(Hatch.Create(crvs[i], pattern, rotation, scale)[0]);

Seems to be a bug in Rh V5

A couple of years later this is still a problem! The standard hatch command took more than 5 minutes to process something in the magnitude of 10k circles. This is basic functionality, something should be done about it!

Something tells me this may be due to the Rhino hatch function’s “boundary” option. Even if it’s not active, if you preselect the curves (with 10K for example) it will spend all of its time “sorting”… Here 10K circles also take 4.5 minutes - in V6. And Esc cannot quit the command… :confounded:

Using a Python adaptation of Tom’s GH script above, I can hatch the same 10K circles in 5.6 seconds.

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino, time

crvIDs=rs.GetObjects("Select curves",4,preselect=True)
crvs=[rs.coercecurve(crvID) for crvID in crvIDs]
for crv in crvs:
    [sc.doc.Objects.AddHatch(hatch) for hatch in hatches]
print "Elapsed time={:.2f}".format(time.time()-st)

@pascal, I don’t see anything in youtrack on this, the current WIP appears to have the same problem here, so can someone check this on your end?

Checking it, thanks.

Yes… something ain’t right. Thanks. 1.9 seconds via py here.


@pascal, all
I was thinking about this some more this morning… there is a difference between running the scripted procedure and the Rhino command.

The Rhino command Hatch looks for nested curves - for example if you have one closed curve inside another, it hatches between the curves. So, when you have a lot of curves selected, it has to check them all against each other for “nestedness”. With a brute-force approach, the time to check goes up exponentially with the number of curves. Certainly with some smart programming (tree, etc.) the time to check and classify can be substantially reduced, but it will still be significant I think.

With the scripted procedure above, you are just asking it to make one hatch per curve, without worrying about the relationships between them. That’s really simple, so it just runs - bang!

That is not to say the current implementation of the Hatch command cannot be improved - perhaps the nesting check is not optimized yet - but it also perhaps argues for an additional command/option of “one hatch per curve - just do it”. Of course that is easily scripted as above.



I was genuinely confused by this post title :slight_smile:
image http://i.imgur.com/YHwWuHe.png
:rhinoceros: :egg:


Hi Mitch - yes, good point… Here, or rather there, at the office, on a proper machine, 10,000 circles never finished, I had to stop Rhino from Task Manager… So for sure there is something to look into at least - thanks for the heads-up everyone.


any news on this one?

when you see the hatch in preview, pressing ok still takes lots of time for the ‘real’ hatch to complete.

A post was split to a new topic: Help needed:script for gradient hatch