Search

2D DraftingBIMMechanicalApplications

Patterning Hatches - Customizing BricsCAD® - P18

By Ralph Grabowski 13 min June 14, 2020
Patterning Hatches - Customizing BricsCAD® - P18

In this post, you will learn how to use and customize pattern hatches in BricsCAD®. BricsCAD provides you with two ways to create custom hatch patterns: (a) simple patterns defined with the Hatch and -Hatch commands; and (b) edit the default.pat file or write new .pat files with a text editor. We look at both methods in this post.

Despite seemingly complex, hatch patterns consist of the same three basic elements as linetypes: dashes, gaps, and dots. The pattern repeats itself, which is done by specifying an offset distance and an angle, as illustrated below:

null

QUICK SUMMARY OF PATTERN DEFINITIONS

Hatch patterns are stored in .pat files and are applied with the Hatch command. Each hatch pattern definition consists of at least two lines of text, a header that labels the pattern, followed by one or more lines of data that describe the pattern. (Gradients are hardcoded and cannot be customized.)

LINE 1: HEADER

Example: *Name,Description

* (asterisk) --- indicates the start of the hatch pattern

Name --- names the pattern

, (comma) --- separates the name from the description

Description ---  describes the pattern

LINE 2: HATCH PATTERN DATA

Example: 45, 0,0, 0,0.125

45 --- specifies the angle of the line segment

0,0 --- specifies x,y coordinates of the start of the line segment.

0,.125 --- specifies ending coordinates of the line segment. dash definition --- defines dashes in the line segment using the same code is in linetypes:

  • Positive number: draws a dash, such as 0.25
  • Zero (0): draws a dot
  • Negative number: draws a gap, such as -0.25.

NOTE To include comments in the .pat file, prefix lines with a semi-colon ( ; ).


The result is like the samples illustrated below.

null

Examples of hatching patterns provided with BricsCAD

BricsCAD cannot create hatch patterns made of circles and other nonlinear objects, but BricsCAD can solid-fill and gradient-fill areas in any color.

BricsCAD comes with 87 hatch patterns, plus solid fill and nine, gradient fill patterns. Even so, your office drafting standard may well require additional patterns. In this post, we'll look at how to create hatch patterns and edit existing ones.

Where Do Hatch Patterns Come From?

The -Hatch command creates hatch patterns at the command line; Hatch displays a dialog box to do the same thing. Unlike linetypes, the pattern file is loaded automatically the first time you use the Hatch or -Hatch commands (formerly the BHatch command). Hatch patterns are defined in files external to BricsCAD:

  • default.pat contains the hatch patterns you use most commonly
  • pat contains hatch patterns as defined by the ISO
  • Other .pat files can also contain hatch patterns, but it is easier to keep all patterns in a single file

These are the folders in which BricsCAD stores its pattern files (replace <login> with your login name):

Windows: C:\Users<login>\AppData\Roaming\Bricsys\ BricsCAD\V20\en_US\support
Linux: /home/<login>/Bricsys/BricsCAD/V20/en_US/Support
macOS: /Users/<login>/Library/Preferences/Bricsys/BricsCAD/V20x64/en_US/Suppor

HOW HATCH PATTERNS WORK

When you apply hatching to an area, BricsCAD generates a repeating pattern of parallel lines and gaps based on the definition in the .pat file. The pattern comes to a stop when it reaches a boundary; if BricsCAD cannot detect a boundary, it refuses to place the pattern.

Once the hatch is in place, you can use the Move command to move the hatch pattern elsewhere in the drawing, if you so chose.

BricsCAD can create non-associative and associative hatch patterns; the Associative toggle is found in the Options area of the Hatch and Gradient dialog box.

  • Non-associative means the area of the pattern is fixed. When you change the boundary, the pattern remains in place, as illustrated below. This property is useful when you want the pattern to remain fixed.
  • Associative hatching means the pattern's shape updates as you change the boundary.

null

How associative hatching works

In either case, you can move the pattern independent of its boundary. This is because BricsCAD treats both kinds of hatches as blocks. You can use the Explode command to explode blocks into their constituent lines.

You can use the HatchEdit command or the Properties command to edit parameters of hatch, solid, and gradient patterns.

System Variables that Control Hatches

BricsCAD has system variables that control how hatches are created and report their most recent settings. In the Settings dialog box (Settings command), enter "hatches" in the search field:

null

Settings that affect hatches

Creating Custom Hatch Patterns

BricsCAD provides you with two ways to create custom hatch patterns: (a) simple patterns defined with the Hatch and -Hatch commands; and (b) edit the default.pat file or write new .pat files with a text editor. We look at both methods in this post. Unlike linetypes, you cannot create hatch patterns in Drawing Explorer.

When you create simple hatch patterns with the Hatch command, BricsCAD does not, save this (unlike custom linetypes created with Linetype.) For this reason, think of the first method of creating custom hatch patterns "on-the-fly".

Creating a Hatch "on-the-fly"

Your options for "creating a hatch "on-the-fly" are limited to simple patterns. Using the -Hatch command, you access the Properties option, followed by User defined, as follows:

  1. Enter the -Hatch command (formerly the Hatch command, with no hyphen prefix):

    : --hatch
    Current hatch pattern: ANSI31

  2. Select the P (properties) option, and then the U (user defined) option:

    Specify internal point or [hatch Properties/Select entities/Remove boundaries/Advanced options/Draw order/Origin/ANnotative/Layer/Transparency/Undo]p

    Enter a pattern name or [? to list patterns/Solid fill/User defined/Gradient] <ANSI31>u

  3. Specify three parameters for custom hatch patterns: Angle, Spacing, and Crosshatching. First, the angle:

    Set Angle for lines or [Proceed]<0>: 45

  4. Second, the spacing between parallel lines.

    Space between standard pattern lines <1>: 2

  5. Third, decide if you want the pattern crosshatched. That means the pattern is repeated at 90 degrees to the first one.

    Cross-hatch area? [Yes-cross hatch/No-one direction] <No>y

  6. Finally, you select the object or boundary to hatch:

    Specify internal point or [hatch Properties/Select entities/Remove boundaries/Advanced options/Draw order/Origin/ANnotative/Layer/Transparency/Undo]: (Pick a point in the drawing to apply the pattern.)

null

Defining a custom hatch pattern inside BricsCAD

BricsCAD draws the pattern, but  --- as mentioned earlier --- the custom hatch is not saved to a .pat file.

HATCH COMMAND

Creating custom hatch patterns with the Hatch command is more like filling out a form:

  1. From the Draw menu, select Hatch. (Alternatively, type Hatch at the command prompt). Notice the Hatch and Gradient dialog box.null

  2. From the Type drop list, select Custom.null

  3. BricsCAD allows you to enter values for Angle, Spacing, and Cross Hatch, as well as the color of the cross-hatching and the background color. Enter values such as these:

    Angle 45
    Spacing 2
    Cross Hatch Yes

  4. Click the + Pick points in boundaries button and then select the area you want hatched.

  5. Press Enter to return to the dialog box and then click OK. BricsCAD applies the custom pattern.

Understanding the .pat Format

Let's dig into the contents of the default.pat file to get a better understanding of how a pattern is constructed.

  1. Start a text editor (not a word processor), such as Notepad on Windows, Text Edit on Linux, or TextEdit on Mac.
  2. In Windows, open the default.pat file from the \Users<login>\AppData\Roaming\Bricsys\BricsCAD\V14x64\ en_US\support folder.
    In Linux, open the default.pat file from the /home/login/Bricsys/BricsCAD/V20/en_US/Support folder.
    In MacOS, open the default.pat file from the /Users/login/Library/Preferences/Bricsys/BricsCAD/V20x64/ en_US/Support/default.lin folder.
  3. Scroll down a bit and take a look at the seemingly-incomprehensible series of numbers and punctuation contained by this file. I've reproduced the first dozen lines here:

; Note: Dummy pattern description used for 'Solid fill'.
*SOLID, Solid fill
45,0,0,0,0.1
*ANSI31,ANSI Iron
45, 0,0, 0,0.125
*ANSI32,ANSI Steel
45, 0,0, 0,0.375 45, .176776695,0, 0,.375

COMMENT AND HEADER LINES

The definition of a hatch pattern consists of two or more lines of text. The first line is called the header, such as *SOLID, Solid fill.

Comment

The semicolon ( ; ) indicates a comment line, such as

; Note: Dummy pattern description used for 'Solid fill'.

That lets you include notes to yourself that are ignored by BricsCAD.

Start of Definition

The asterisk ( * ) is important because it signals to BricsCAD the start of a new hatch pattern definition.

Pattern Name

Following the asterisk comes the name for the hatch pattern, such as SOLID. The name must be unique in the file. If it isn't, BricsCAD uses the first pattern it finds by that name.

The comma following the name merely separates the name from the description. The comma is optional; it doesn't have to be there (a space works just as well).

Description

The text following the pattern name is the description displayed by the -Hatch ? command, such as "Solid fill." This description is also optional but highly recommended. You are limited to a maximum of 80 characters for the name, comma, and the description. If you need more room for the description, use comment lines, such as:

; Note: Dummy pattern description used for 'Solid fill'.

*SOLID, Solid fill

THE HATCH DATA

With the comment lines and the header line out of the way, let's get down to the nitty-gritty hatch pattern data and how it is coded. Lines 2 and following are the data, such as:

0, 0,0, 0,.275, .2,-.075 90, 0,0, 0,.275, .2,-.075

Every line of data uses the same format:

angle, xOrigin, yOrigin, xOffset, yOffset [, dash1, ...]

Angle

The angle is the angle at which this line of hatch pattern data is displayed. The "0" means the hatch line is drawn horizontally; a "90" means the line is drawn vertically, and so on. A comma ( , ) separates the numbers.

xOrigin and yOrigin

The xOrigin specifies that the first line of the hatch pattern passes through this x-coordinate. The value of the yOrigin means that the first line of the hatch pattern passes through this y-coordinate.

xOffset and yOffset

The xOffset specifies the distance between line segments, aka the gap distance. You use this parameter only to specify the offset for vertical or diagonal lines (To specify the distance between dashes, use the dash1 parameter.) In most hatch patterns, xOffset has a value of 0.0. Even though this parameter is rarely used, it is not optional.

The yOffset is the vertical distance between repeating lines, and is used by every hatch pattern.

Dash1,...

dash1 defines the dashes in the hatch pattern line (the code is the same as for linetypes):

  • A positive number, such as 0.25, is the length of the dash.
  • A 0 draws a dot.
  • A negative number, such as -0.25, draws a gap.

TIP The dot drawn by the hatch pattern may create a problem when it comes time to plot. If you find that the dots in a hatch pattern are not printed, use a very short line segment, such as 0.01, instead of a 0.


When you are finished editing a pattern, save the .pat file.

ADDING SAMPLES TO THE HATCH PALETTE

BricsCAD adds visual samples of your custom hatch patterns to the palette automatically. You can have more than one .pat file; however, the additional ones are limited to one pattern definition per file, and the definition's name must match the file name.

TIPS ON CREATING PATTERN CODES

Some miscellaneous comments on hatch pattern coding:

Tip 1: Hatch pattern lines are drawn infinitely long. What this means is that BricsCAD draws the line as long as necessary, as long as it reaches a boundary. BricsCAD will not draw the hatch pattern unless it does find a boundary.

Tip 2: At the very least, each line of pattern code must include the anglex- and y-origin, and the x- and y-offset. This draws a continuous line.

Tip 3: The dash1 parameter(s) is optional but when used draws a line with the dash-gap-dot pattern.

Tip 4: It's a lot easier for someone else (or you, six months from now) to read your hatch pattern code if you use tabs and spaces to format the code into nice columns.

Tip 5: To change the angle of a hatch pattern upon placing it in the drawing, you've got a couple of options:

  • Specify the angle during the Hatch command.

  • Set the angle in system variable SnapAng. The effect of SnapAng on the hatch pattern angle is additive: if the hatch pattern defines the lines drawn at 45 degrees and SnapAng is 20 degrees, then BricsCAD draws the hatch lines at 65 degrees. For example:

    : snapang
    New current angle for SNAPANG <0>: 20

The x-offset and y-offset parameters are unaffected by the angle parameter because x-offset is always in the direction of the line and y-offset is always perpendicular (90 degrees) to the line.
If you are uncomfortable using system variables, then the Snap command provides the same opportunity via the Rotate option:

: snap
Snap is off (x and y = 0.5000): ON/Rotate/Style/Aspect/<Snap spacing>r
Base point for snap grid <0.0000,0.0000>: 1,1
Rotation angle <0>: 45

Tip 6: You can specify a weight (or line width) for hatch patterns line. If you wish, you can also make thick-looking patterns by using closely spaced lines, like this:

Thick_Line, Closely spaced lines
0, 0,0, 0,.25 0, 0,.01, 0,.25 0, 0,.02, 0,.25

Tip 7: To draw dash and gap segments at an angle, use the sine of the angle in degrees, like this:

Angle Dash length (sine)
0 0
30 0.433
45 0.707
60 0.866
90 1.0

Tip 8: You cannot specify arcs, circles, and other round elements in a hatch pattern file. Everything consists of straight lines and dots. To simulate circular elements, use a series of very short dashes.


  1. Introduction
  2. 55 Tips for BricsCAD Users
  3. Settings
  4. Changing the Environment
  5. Custom User Interface
  6. Introduction to the Customize Dialog Box
  7. Customize the Menu Bar & Context Menus
  8. Customize Toolbars and Button Icons
  9. Writing Macros and Diesel Code
  10. Ribbon Tabs and Panels
  11. Keystroke Shortcuts, Aliases, & Shell Commands
  12. Customize Mouse, Double-click & Tablet Buttons
  13. Absolutely Everything You Need to Know About The Quad
  14. Rollover Properties
  15. Workspaces and the User Interface
  16. Designing Tool & Structure Panels
  17. Creating Simple & Complex Linetypes
  18. Patterning Hatches
  19. Decoding Shapes & Fonts
  20. Coding with Field Text
  21. Writing Scripts
  22. Programming with LISP (Introduction)
  23. LISP Functions

Explore BricsCAD

Download BricsCAD Free Trial | Sign Up For News & Updates | Shop Online For BricsCAD Desktop Software

Ralph Grabowski

by Ralph Grabowski - CAD Writer, publisher of upFront.eZine

Ralph is the publisher of the weekly 'upFront.eZine' e-newsletter on the business of CAD and the 'WorldCAD Access' blog on technology. Author of 240+ books and ebooks about computer-aided design, and producer of 220+ videos on using CAD.

September 17, 2024 3 min

Customizing Line Types in BricsCAD

Creating custom line types in BricsCAD can significantly enhance the detail and clarity of your drawings. Whether you’re working on complex engineering plans or simple layout designs, understanding how to create your own line types can give your projects a professional edge. Follow this step-by-step guide to learn how to create both simple and complex line types in BricsCAD.

September 10, 2024 3 min

BricsCAD Partner Apps for Civil and Survey Workflows

At Bricsys, we provide a solid foundation for our specialist survey and civil app developers to create specialist civil and survey tools that deliver robust and efficient workflows for BricsCAD users. Let’s see what updates and improvements our various developer partners have made to complement BricsCAD V24's civil and survey workflows.

These civil and survey applications are among multiple third-party applications supported by BricsCAD, with our developers working to improve their functionality and remain on pace with our new features introduced with every release.

September 9, 2024 4 min

Embracing Digital Transformation in the Construction Industry with Bricsys® 24/7

The construction industry continually evolves, and digital transformation is reshaping how teams manage projects, communicate, and handle project documentation. When embracing digital solutions for construction projects, a common data environment (CDE) like Bricsys 24/7 is an excellent place to start. With a significant variance in the level of digital adoption across the industry, embracing and leveraging digital tools can help firms differentiate themselves by elevating operational efficiency and improving project outcomes.

Follow us on social media