BILT

BILT
Speaker

Saturday, 27 June 2015

Defining Revit Custom Hatch Patterns

Over the years I have defined quite a few Revit custom hatch patterns, and each time I do it I get a headache!  It is usually about 6 months between each attempt at this so I pretty much have to learn it all over again each time.   The format for defining the hatch files (.pat) is so bizarre that it almost defies logic.  Almost, but not quite . . . .

The Autodesk help files have never changed much over the years, and just reading them gets me baffled each time.  So I decided to write my own help file that is actually understandable by human beings, so I can refer to in six months time.  And well, why not put it out there to see if anyone else finds it useful?  Of course there are now lots of  clever little hatch builder programs available, but sometimes you just want something quick and you may not have access rights to download and install that hatch builder.

The example I am showing here is a series of octagons that are quite widely spaced - I originally created it to represent those 'tactile surface indicators' at the base and top of stairs.  The octagons do a pretty good representation of circles on a stair drawing.

The first step is to create a sample of the pattern using lines - say detail lines on a drafting view.  You probably need to show a couple of repeats in each direction - true octagons are simple to create using the 'Polygon Tool' with only two mouse-clicks.



When the octagon is repeated in a Revit pattern, it does not replicate the octagon shape - it actually treats each line as totally separate, and repeats those in two possible directions.  So in order to understand which lines are repeated where, I have colour coded them.  This pattern is based on a 1000 mm square grid with the space between each octagon exactly the same as the octagon width, which means that the orthogonal lines are repeated every 1000mm, exactly offset from each other - a very simple pattern.  The diagonal spacing between octagons is quite different to the octagon width - so the repeats of diagonal lines are much more complex . . . .

Pattern Definition Format

The pattern file is just a text file, saved with a '.pat' extension.
The overall file can have descriptions at the beginning;  it can also have an overall definition of units (important for metric):
;%UNITS=MM

Each pattern definition needs a header prefixed by an *:   a title and description separated by a comma
      *Octagons 1 x spaced,   1000mm spaced and width octagons
It also needs a type definition (Drafting or Model)
      ;%TYPE=MODEL

Each line repeat (in the pattern) is described in one line of text, with comma delimited format.  eg:
0,     1200, 1000,         0,  1000,       400,  -1500
  • Angle  = angle of line from horizontal measured in an anti-clockwise direction
  • Origin x = horizontal distance of start of line from setout point (always orthogonal)
  • Origin y = vertical distance of start of line from setout point (always orthogonal)
  • Shift u (x) = offset distance of start of repeat line measured parallel to start of line
    (in the direction of the line,  ie. to match the angle)
  • Shift v (y) = offset distance of start of repeat line measured perpendicular to start of line
  • Pen down = length of solid line measured in the direction of the line
  • Pen up = length of gap in the line before the next segment of the line starts repeating (measured in the direction of the line);  is always a minus value.
Notes.
  • The Shift values define the repeats in the direction perpendicular to the line.  The Autodesk help files mislead by calling them x and y values - I prefer to think of them as u and v values, which are not necessarily orthogonal.  The Autodesk help files completely omit to mention that they are measured parallel & perpendicular to the line.
  • The Shift values are measured from the start of the line, not from the setout point - another vital piece of information that the Autodesk help files neglect to tell you.
  • The pen down/up values effectively define repeats in the direction of the line.  They are optional.  If they are omitted, you get a continuous line
  • The pen down/up repeat is inconsistent with origin & shift because the coded value of Pen up is the distance from the end of the line to the start of the next - the repeat distance is actually the total of Pen down and (minus) Pen down.

Octagon Pattern Example

The horizontal lines (black)
Angle = 0
Start line x from origin = 1292.9
Start line y from origin = 1000
Shift u of repeat from line start = 0   (ie. it is a direct perpendicular offset)
Shift v of repeat from line start = 1000
Pen down = 414.2    (length of octagon side)
Pen up =   -1585.8   (distance to start of next octagon line from end of first)

0,   1292.9, 1000,         0,          1000,       414.2,  -1585.8


The vertical lines (blue)
90,  1000,    1292.9,     0,          1000,       414.2,  -1585.8

The 45° angle lines (red)
45,  1707.1, 1000,        1414.2, 1414.2,    414.2,  -2414.2

The opposite 45° angle lines (purple)
45,  1000,    1707.1,     1414.2, 1414.2,    414.2,  -2414.2


The -45° angle lines (green)
-45, 1000,   1292.9,      1414.2, 1414.2,    414.2,  -2414.2

The opposite -45° angle lines (orange)
-45, 1707.1, 2000,        1414.2, 1414.2,    414.2,  -2414.2

Pattern File
*Octagons 1 x spaced,
;%TYPE=MODEL
0,   1292.9, 1000,         0,          1000,       414.2,  -1585.8
90,  1000,    1292.9,     0,          1000,       414.2,  -1585.8
45,  1707.1, 1000,        1414.2, 1414.2,    414.2,  -2414.2
45,  1000,    1707.1,     1414.2, 1414.2,    414.2,  -2414.2
-45, 1000,   1292.9,      1414.2, 1414.2,    414.2,  -2414.2
-45, 1707.1, 2000,        1414.2, 1414.2,    414.2,  -2414.2


This needs to be saved as a '.pat' file type before it can be used in Revit.  It can be edited in a simple text editor like 'Notepad'.

Notes:
  • The angle for the last two could be 135° instead of -45°, but the measurement direction would then be in a backward direction, which could be confusing to figure out.
  • If the width and spacing of octagons are not the same, you would need to define two lines at zero and two at 90 degree angles (like the 45 degree line definitions).


I hope this saves me hours of grappling with the file format and help files next time I need to create a quick pattern in Revit.

14 comments:

  1. This is something you have to relearn everytime you need it. Thanks for the eternal reference.

    ReplyDelete
  2. Thanks Tim. Echoes my own experience and very nicely explained. I usually resort to some trial and error flailing around until the pattern looks right :) I think we should start an open source repository for Revit fill patterns.

    ReplyDelete
  3. try that/...
    http://www.cadhatch.com/download/i/mark_dl/u/4013003604/4618102748/TILE-HATCH-CREATOR2.xls
    and there is also the HatchMaker.lsp for Autocad that can help you manage almost everything after a few trial and errors

    ReplyDelete
  4. Hi Tim,

    try this one for standard brick hatches:
    http://www.revitlog.nl/index.php?option=com_content&view=article&id=382:revithatchbuilder-englisch&catid=98:revit-hulpprogrammas&Itemid=69

    Otherwise: hatch22 is great.
    http://mertens3d.com/tools/tools.php

    Cheers,

    Jan

    ReplyDelete
    Replies
    1. Hi Jan
      It seems your website is down. Otherwise, the tool looks promising!

      Delete
  5. Thank you a lot for all these explanations, it is really helpful. I'm trying to draw a herringbone pattern that would represent a 8''x24'' ceramic tile. The herringbone pattern is made of two lines, a horizontal one and a vertical one, so I've written the code as you described it, but I can't understand why, the vertical one is going down whereas it should be going up... Here is the code as I've written it:
    *HERRINGB8,Herringbone ceramic tile, 24x8"
    0, 8, 8, 8,8, 36,-16
    90, 16,8, 8,8, 36,-16
    Anybody knows why...?

    ReplyDelete
  6. Thank you a lot for all these explanations, it is really helpful. I'm trying to draw a herringbone pattern that would represent a 8''x24'' ceramic tile. The herringbone pattern is made of two lines, a horizontal one and a vertical one, so I've written the code as you described it, but I can't understand why, the vertical one is going down whereas it should be going up... Here is the code as I've written it:
    *HERRINGB8,Herringbone ceramic tile, 24x8"
    0, 8, 8, 8,8, 36,-16
    90, 16,8, 8,8, 36,-16
    Anybody knows why...?

    ReplyDelete
  7. Here's an 8"x24" herringbone pattern


    ;%VERSION=3.0
    ;%UNITS=INCH
    *herring24x8,24"x8" weave=1/1
    ;%TYPE=DRAFTING
    0,-8,0,8,8,32,-16
    -90,0,32,40,8,32,-16


    We have added herringbone patterns to HatchKit's inbuilt Brick & Tile wizard.

    You can download a demonstration version from our website here: http://hatchkit.com.au/download.php

    Hope this helps
    Hugh Adamson
    www.hatchkit.com.au

    ReplyDelete
  8. Hugh, could you look into a Herring bone for 9" x 59"?

    ReplyDelete
  9. Hugh, could you look into a Herring bone for 9" x 59"?

    ReplyDelete
  10. How can I change the code in this example to a working .pat file min mm instead of inches
    ;%VERSION=3.0
    ;%UNITS=INCH
    *herring24x8,24"x8" weave=1/1
    ;%TYPE=DRAFTING
    0,-8,0,8,8,32,-16
    -90,0,32,40,8,32,-16

    ReplyDelete
  11. John, since it is a drafting pattern you dont need to worry about units so much - just change the import scale when adding the pattern in Revit. But if you need precision then change the units to mm in the pattern file, and multiply all the length numbers by 25 (or 25.4); don't change the first number in each line as it is an angle.

    ReplyDelete
  12. Hi. i'm on a project where I need a pattern for a plywood wall. This is simply too complicated for my brain. If a draw the pattern, is there anyway you can make a .pat file for me that i can use?

    Kind regards

    Søren

    ReplyDelete
    Replies
    1. Hi Soren, As Revit consultant I would charge for that service. However, I would recommend using many of the add-ins available for such tasks. See other comments.

      Delete