June 22, 2011

Revit Patterns: Defined


Patterns. I have a love/hate relationship with patterns. I am a recovering AutoCAD addict and have been working with AutoCAD *.pat files for as long as I can remember. I thought once I moved on from AutoCAD into Revit, I would be saying goodbye to programmatically creating patterns. Well, for better or worse, I still have to create them.

What I can say, is that Revit does a better job of handling them. Working on the MEP side of things, my exposure to patterns is rather limited in comparison to the Revit Architecture folks out there. I think because of that, I look at things a bit differently and it may work to my advantage.

Lets start with the basics.

Where are these magical pattern files? Well, that’s an easy one.
..\Program files\Autodesk\\Data\

What are the file names?
Well here is what is in my Revit 2011 Architecture Data folder:
Revit.PAT
 Default Imperial pattern definition file
Revit metric.PAT
Default Metric pattern definition file
Revit metric custom.PAT
Ported Metric autocad pattern definition file

Great. Now how do they work?

Here is the rub.

They are very similar to AutoCAD patterns. If you are familiar with them, you may start to doze off here in a moment, but for those uninitiated pay close attention.

The *.PAT files contain a list of patterns that are broken down into the math of each repeating line.  These patterns can consist of a single repeating line or dozens of line segments of different angles to produce wood-grain effects. (What fascinates me... is imagine your boss asked "what did you do today?"  your response: "Coded 50 lines of text to create a wood-grain pattern, it took 4 hours!")

Examples: (Click Image for Full Size)

Kind of Intense right?! I promise, It's not that bad. We can tackle this topic together.

The default pattern file (Revit.PAT) has a great header portion that describes the entire process of creating patterns.  However, I have taken the liberty of breaking the pattern definitions down for you graphically to help ease you into it. To illustrate the definitions, I have selected the  "Block 8x16" pattern because of it's relative simplicity.


Pattern File Format
Unit Structure
%UNITS=INCH
Defines the default unit structure of the pattern. This helps to define scale.  Units are set to Inches in the above pattern
Version
%VERSION=3.0
This identifies the file as a Revit Fill Pater for the specified version. (include this for future compatibility)

Pattern Definition Format
Name, Comment
*Bock 8x16, 8 x 16 blocks Running Bond
This defines the name of the Pattern and the Description separated by a comma
Type Directives
%=MODEL
This defines the Type of Pattern. This can either be "Model" or "Drafting" If this line is omitted, it will default to Drafting

Each pattern line is defined by the following criteria and needs to be in the following order:
Angle
Value
This is the angle based off the origin points below. "0" Represents a Horizontal line and "90" represents vertical. The value of this angle can be any radial angle you many need
X-Origin
Value
This is the origin point for the "x" direction. Most commonly, this will have a 'null' value.
Y-Origin
Value
This is the origin point for the "y" direction. Most commonly, this will have a 'null' value.
Shift
Value
Shift moves the pattern of dashes and spaces along the length of each new parallel line. Shift is ignored if the line is solid.
Offset
Value
Offset defines the distance between parallel lines.  Zero Offset is not allowed.





The dash-space sequence defines a repeating pattern of dashes and spaces for a line. If it is omitted, the line is solid.
Dash
Value
Positive numbers define dashes
Space
Value
Negative numbers define spaces.
  
Each line of the definition represents a new pattern line.  So for the block 8x16 pattern,  the first line defines the horizontals and the second line defines the verticals. The images below should illustrate the process.







0
0
0
0
8
Angle
X-Origin
Y-Origin
Shift
Offset








90
0
0
0
8
8
-8
Angle
X-Origin
Y-Origin
Shift
Offset
Dash
Space

Hint:
If you begin a pattern with a space, do not alternate dashes and spaces, or do not end with a space, Revit will introduce tiny dashes or spaces to compensate. Revit expands dots and very short dashes into dashes of a minimum size.

For those coming from AutoCAD and think they have the pattern mastered, here are the changes in Revit.


Differences from AutoCAD:
  • AutoCAD has an 80-character line size limit, Revit's is 4096. 
  • AutoCAD allows arbitrary sequences of dashes, spaces and dots, Revit coerces them into dash-space format by inserting zero spaces and dashes. 
  • AutoCAD has a notion of dots, Revit expands them (including the zero dashes it inserted) into short dashes. 
  • AutoCAD has a maximum of 6 components to a line pattern, Revit has no limit. 
  • AutoCAD does not allow spaces in a pattern name, Revit does. 
  • AutoCAD allows only one pattern per a custom file, with pattern name matching file name, and with the file residing in a known location. Revit has none of these restrictions. 
  • AutoCAD and Revit utilize different logic to decide whether a pattern is acceptable.
Note: that when Revit exports its models into AutoCAD formats, such as DWG, it makes sure to comply with the more stringent AutoCAD requirements.

'Til next time. Happy Reviting.



Matthew Nelson
MEP Solutions Application Specialist

Matthew has a deep understanding of Autodesk products. He studied Mechanical Engineering at SUNY Stony Brook. He has been a BIM manager and CAD manager for a leading international consulting services firm utilizing AutoCAD MEP, Civil 3D and Revit MEP. During that time, he focused his skills on understanding the dynamics of inter-discipline coordination on large scale civil and building engineering projects. At Ideate, Matthew provides training and support for Revit MEP, Navisworks and AutoCAD MEP. @MNelsonIdeate

Get it. Know it. Use it.