Rhino Mac- Create Hatch Pattern

Loving the development of rhino for mac having been a big fan of windows version.

I have never needed to do it but before but is there a function to create custom hatch patterns within rhino?

Hi Ned,
A while ago I needed to do just that, so I wrote a little python script:
Special Hatch.py (2.9 KB)
I tried to make it self-explanatory, hope you can use it.

Max.

1 Like

Hey Max,
Thanks, looks great , will give it a whirl later.
How do you geniuses do these thingsā€¦?
N

Step by stepā€¦:relaxed:

Hi Ned,

Rhino uses AutoCAD-style hatch patterns. So if you Google ā€œAutoCAD Hatch Patternsā€ youā€™ll find much of free stuff you can download and import into a document (File -> Settings -> Hatch -> click the gear and pick "Load hatch patterns from file.

ā€“ Dale

1 Like

A post was split to a new topic: Importing hatch pattern

Hi Max,
I tried your script last year but I couldnā€™t get it working (probably because it was all new territory).
I am now trying again but unsuccessfully.

I have:

  • Drawn curve that I want to use as hatches with a bounding box but am not sure what to do next.

Thanks

Hi Ned,

To begin with: it is not a foolproof script, if you do anything the script does not expect, you will get an extensive report where exactly the script could not cope. But no harm done, nothing will change in your drawing.

The steps:

  • draw something you want to repeat as a hatch pattern. Draw a rectangle outside that something, which will serve as the repeated space of your pattern, i.e. how far the individual pattern elements are apart.

  • run the script. You will be prompted to select the objects you want to repeat. Select and hit Enter.

  • the next prompt will ask you to identify the repeat-space element, i.e. the rectangle. Select and hit enter.

  • now you will be asked to select the curves that bound the area to be hatched. Select and hit enter. Click somewhere in the area to be hatched.

  • the hatch pattern appears selected, but it will run over the selected boundary lines. Move the pattern until you are happy how it sits. Hit enter, and everything outside the requested boundary will be trimmed off.

Thatā€™s it.
Max.

P.S., you could do away with the space-repeat element, just select the hatch elements again and hit enter. The script will then use the bounding box encompassing those elements as your ā€œspace-repeat elementā€

Hi Max,
How do I run a script in rhino mac??

Hi Ned,

I am not sure if you can store scripts in any location and use the path in the command, but I store my python scripts in User/{user name}/Library/Application Support/McNeel/Rhinoceros/scripts/{script name}.py

I then use the command RunPythonScript, which opens that directory, and select the script in question.

1 Like

Thatā€™s works great, is there any way I can embed the the hatch to be available as a hatch within the rhino library? So I can easily apply it when necessary?

What Iā€™m making is a new grass hatch pattern for some large 2d drawings

Hi Maxz. This is an incredibly handy script. One thought: in addition to the ā€˜moveā€™ command that allows you to shift the position of your hatch I wonder if it would be possible to add a ā€˜rotate commandā€™ to allow us to re-orient our hatch. This would be a game changer for me as I toil away through my masters degree. Anyways, thanks so much for the script!

Hi Justin, I have just read your posting, only half a year late :roll_eyes: . Too late for your Masters probably (hopefully?).
But anyway, here is my reply. I have added the Rotate command as you requested, but I have to warn you that the result may not be what you expect.
The way the script works is that it creates a matrix of your hatch curves, just enough to cover the target area. The Move command is only there to tweak the ā€œsitā€ with small amounts. When you start rotating this matrix, it is likely to leave voids which will not be filled automatically with more copies of your hatch curves, see the image attached here.
The best thing to do is to copy/rotate the hatch curves with varying angles (not the rectangle!), before you run the script, and just pick the one that best suits the shape of your area.
This is the updated script:
Special Hatch.py (2.9 KB)

Max.

1 Like

great script thanks Max!