Create Hatch Pattern from Selection



A Graph that can make a hatch pattern file from a selection of ANY straight lines!
Ever wanted to make a fancy new tile pattern? Do you hate your gravel pattern?
Then just draw a new one and use it instead! The days of Hatch Pattern restrictions are OVER!
This graph can handle diagonal lines. Welcome All to the days of ULTRA HATCH!

Ultra Hatch.dyn (138.6 KB)

This Graph is made to run in the Dynamo Player.
Dynamo Release 2.0; No Packages Required.

Create orthogonal Hatch Patterns to TXT
Turn Any Type of Curve into Lines
Batch add pattern files?

It is Dynamo 2.0. Any chance you share it for Dynamo 1.3?




I will look into it. The graph is pretty intense; I had to condense my node groups into code blocks just to keep it from being too cumbersome. It is concise, but comlex. Maybe there is an easy way to downgrade without having to rewrite the whole graph.
Is there a particular reason why you are unable to upgrade?


It’s ok, if it is not just “save as” and do you need to re-do it don’t bother.

Eventually I’ll update to 2.0…just every time I want to update something I need to ask somebody with administrator rights to do it.

It’s fine, thanks anyway :slight_smile:


After some experimentation, I found a limitation to my graph; patterns were being restricted to a Square Boundary.
This made it impossible to make certain types of patterns repeat properly where the length and height could not be the same. See below:

At one point, I did not think it was possible to fix this, but that problem has been remedied!
Now you can upload a pattern of any Rectangular Boundary!
This solution also provided a way to adjust irregular slopes with more tolerance - at least, depending on the bounds of your sketch.
I also took the opportunity to improve the output of the Slope Tolerance Results.
Now you will only see the specific angles you drew, compared to the corrected versions. That way it is easier to notice how much your hatch pattern will be corrected from the original sketch. The new version of the graph has been uploaded in the very first post.


It seems like the “save as” option for 1.3 is not available. If anybody else knows how to do this, feel free to reply to this post.
franciscusm, when you are able to use the graph, let me know what you think.


Dynamo 2.0 graphs are not compatible with earlier versions.


Thanks John. I suspected that this might be the case, but it is nice to have confirmation.


It seems like the working name “Super Hatch”, as shown in earlier pics of the dynamo player, is already in use by a published AutoCAD addon. In order to avoid any copyright issues, the name has been updated to “Ultra Hatch” instead.


For anyone wanting to make a hatch pattern from curved lines, refer to this post:

It is particularly useful if you trying to convert a DWG import from Adobe Illustrator.
All those pesky splines will convert into segments of their straighter counterparts.


If any of you have looked closely at the hatch patterns that result from this graph, you may have noticed how angled lines can tend to produce tiny gaps and intersections where they used to connect. For an explanation of why this happens, well - I will get back to that another day! To be brief, let’s just say that the angle corrections are necessary to produce a hatch pattern that works.
But for those who want a perfect pattern from sloped lines, now the option is available to plot the corrected lines nearby. Then you can just ‘clean them up a bit’. Just be sure not to change the angles of the corrected lines; you’ll also want to use the same Slope Tolerance when you run the graph again on the new selection.

Here’s the gravel pattern the was generated from the cleaned sketch. Just change the extension from .txt to .pat and it should be good to go in Revit.
Gravel -Cleaned.txt (307.3 KB)


Hi @dcmasten1

I am attempting to use your script in player but am receiving an error xmlerror

Is there anything in the script I need to make sure is set correctly? How does the script write to a .txt file? Do I need to create one beforehand?

Thank you!


Hi Kloffredo,

Just to rule these out, are you using Dynamo 2.0 and Revit 2018?
With 2018, you should be able to select the file path from the player interface. If you are using Revit 2017, you’ll need to search for the file path node from inside the graph, towards the end.

On my computer, a new file was created automatically, but only in the default directory. If I changed the path, I would need to create a new text file and change the extension to (.pat). Then I could select it from the input instead.


I am using 2018 and when I load it into Dynamo player it says the script needs attention. When I check out the script, it tells me a few warnings but one is that, the variable list has multiple definitions. I was able to create a hatch in 2017 by doing what you suggested and it worked great. I am confused on how to make the boundary box but I think I can figure that out with enough testing. I know you state somewhere that it can be any line type you just need to specify which one.

Let me know your thoughts and thank you this script is a life saver!



Not sure what is going on with Revit 2018 on your side. Glad you could get it to work though in 2017!
As for boundaries, the script find the bounds of your selection and makes that the boundary.
So if you drew a border and didn’t want to see it in your hatch, just change the border lines to a different type and type that into the node that is titled “Border Line Style”.


Awesome, thank you! What version of 18 are in you? Maybe that is the issue.


I would love to get player working for my other co workers who are not as dynamo savvy. I tried to load the script into another persons dynamo player and got the same xml error. If you end up figuring this out please let me know!


It is Revit 2018.3
I installed it on two separate computers with 16 gigs of ram.
I’ll keep looking into it.
If anyone else has a similar problem or solution, please let us know. Thanks.


This is great. Love it.
Is there some kind of units option in the graph?


Which version of Dynamo are you using? The xml error sounds very much like an issue with the graph being made for version 2.0 (json) and you using 1.3.x (xml) :slight_smile: it can also be you have some packages clashing with the default nodes and you need to add e.g. DSCore. to some code blocks :slight_smile: