In this post learn how to create your own custom linetypes in BricsCAD®.

The BricsCAD package includes many simple and complex linetypes plus, you can create your own!

BricsCAD supports two styles of linetypes, simple and complex:

  • Simple linetypes --- consist of lines, gaps, and dots strung together in a variety of patterns.
  • Complex linetypes --- add text and shapes to simple linetypes.

Creating Simple & Complex Linetypes - 1-2

Top: Simple linetype consisting of dashes, dots, and gaps. Above: Complex linetype for hot water pipes.

QUICK SUMMARY OF LINETYPE DEFINITIONS

Linetypes are stored in .lin files and loaded with the Linetype command. Each linetype definition consists of two lines of text, a header that labels the linetype, followed by a line of data that describes the linetype format.

LINE 1: HEADER

Example: *Name,. _ . _ . _

* (asterisk) --- indicates the start of the linetype definition.

Name --- names the linetype.

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

. __ . __ ---  illustrates the linetype pattern, to a maximum of 47 characters.

LINE 2: SIMPLE LINETYPE DATA

Example: A, .25,-.1,0,-.1

A --- specifies the alignment flag to force the linetype to begin and end a line segment adjusted to the overall length of the object.

.25 --- specifies the length of the dash, when LtScale = 1.0.

-.1 --- specifies the length of the space, using a negative value.

 0 (zero) --- specifies a dot.

LINE 2: COMPLEX LINETYPE DATA

Complex linetypes provide additional parameters within square brackets, as shown in boldface below. Example:

A,1.0,-.25,["HW",STANDARD,S=.2,R=0.0,X=-0.1,Y=-0.1],-.40

"HW" --- specifies the letters to be displayed by the linetype.

STANDARD --- specifies the text style. Optional; when missing, current style is used.

S=.2 --- specifies the height of the text or its scale factor, depending on the following:

  • When style's height  = 0, then S specifies the height (0.2 in this case).
  • When style's height is not 0, then S multiplies the style's height (0.2x).

R=0.0 --- rotates the text relative to the direction of the linetype. Optional; when missing, angle = 0. Default is in degrees; can use r and g to specify radians or grads.

A=0.0 --- rotates text relative to the x-axis to ensure that the text is always oriented in the same direction. Optional.

X=-0.1, Y=-0.1--- offsets the text in the x and y directions.

NOTES: Every data line must begin with a dash; every dash and dot must be separated with a space. To include comments in the .lin file, prefix lines with a semi-colon ( ; ).


About Simple and Complex Linetypes

Creating Simple & Complex Linetypes - 1 a

What dashes, gags, and dots look like

Simple linetypes consist of lines, gaps, and dots ordered in a variety of patterns. This is the most common type of linetype, and its components are shown by the figure below.

And here are some of the simple linetypes included with BricsCAD. Notice that they all consist of the gaps, dashes, and/or dots in a variety of patterns:

Creating Simple & Complex Linetypes - 3-3

Simple linetypes consisting of lines, gaps, and dots in a variety of patterns

Also included with BricsCAD are standardized linetypes defined by ISO, the International Organization of Standards. Complex linetypes are like simple linetypes, but include text, such as ones that indicate fence and gas lines, as illustrated below:

Creating Simple & Complex Linetypes - 4-4

Complex linetypes adds characters to simple linetypes

As with colors, the convention is to assign linetypes to objects in drawings through  layers --- not with the Linetype command! Using the Layer command, you assign different linetypes to various layers.

You can, however, apply linetypes to objects directly, like colors, through the Entity Properties toolbar or Properties pane.

COMMANDS AFFECTING LINETYPES

Linetypes are not stored in drawings; instead, they have to be loaded from .lin files. There is one workaround: add all linetypes to all template drawings.

BricsCAD provides two commands for loading linetypes into drawings, Linetype and -Linetype.

Loading Linetypes

The Linetype command opens Drawing Explorer for loading, listing, renaming, and deleting linetypes. (In older days, this command was known as ExpLTypes, short for "explore linetypes.") As an alternative, you can access Drawing Explorer from the Tools menu: choose Drawing Explorer | Linetypes.

Creating Simple & Complex Linetypes - 5-1024x312

Drawing Explorer handles all aspects of loading and assigning linetypes

The other command is -Linetype, and it operates at the command prompt. It loads linetypes, lists the names of those already loaded, and can define new ones. It is meant mainly for use with scripts and LISP programs.

The two commands load linetypes from these .lin files:

  • lin --- definitions for imperial linetypes
  • lin --- definitions for metric (ISO) linetypes
  • shx --- source for characters used by complex linetypes

BricsCAD stores linetypes in the following support folder:

Window  ---C:\Users<username>\AppData\Roaming\Bricsys\BricsCAD\V20\ en_US\support

Linux --- /home/<login>/Bricsys/BricsCAD/V20x64/en_US/Support

Mac --- /Users/<login>/Library/Preferences/Bricsys/BricsCAD/V20x64/en_US/Support

Scaling Linetypes

Like text, linetypes can be tricky to size. You have to scale the gaps and dashes in just the right way. Too small a scale, and linetypes look solid --- but takes a suspiciously long time to redraw. Too large, and the linetype also looks solid. Here's what the problem looks like:

Creating Simple & Complex Linetypes -6-1-1024x299

The effects of scale on linetypes

And to solve the problem, BricsCAD has the LtScale system variable, short for "linetype scale." It sets the scale of linetypes. Typically, the scale factor you use for text, dimensions, and hatch patterns also applies to linetypes. Nice, eh?

SYSTEM VARIABLES AFFECTING LINETYPES

There are many system variables that control the look and size of linetypes. They happen to be scattered all around the Settings dialog box, and so I provide this complete list of them. This first set of variables determine the linetypes used for drawings:

  • MeasureInit --- sets the initial unit of measurement for new drawings (metric or Imperial), and so determines which .LIN files are used (ANSI or ISO)
  • Measurement --- changes the units for the current drawing between metric and Imperial, and so determines which ANSI or ISO.LIN files are used
  • SrchPath --- specifies the path to LIN definition files

These are the system variables that relate to linetypes applied to entities in drawings:

  • CeLtype --- holds the name of the linetype currently in effect; short for "current entity linetype"
  • CeLtScale --- specifies the current linetype scale
  • LtScale --- stores the current linetype scale factor; short for "linetype scale" (default = 1.0)
  • PLineGen --- determines how linetype cross polyline vertices; short for "polyline generation"
  • VisRetain --- determines whether changes made to xref layers, such as linetypes, are saved with the drawing

In addition to regular entities, linetypes can also be specified for parts of regular and dynamic dimensions, and for visual styles.

  • DimLType --- specifies the linetype for dimension lines
  • DimLtEx1 and DimLtEx2 --- specifies the linetype for the first and second extension lines
  • DynDimLineType --- specifies the linetype displayed by dynamic dimensions as they are being moved
  • ObscuredLType --- specifies the linetype of an obscured line; independent of zoom scale

A final set of variables specifies the linetype scale factor in outside of traditional model space:

  • MsLtScale --- annotatively scales linetypes in model space
  • PsLtScale --- scales linetypes in paper space; short for "paper space linetype scale"

The CeLType system variable reports the name of the current linetype. You can use it as a keyboard shortcut to change the name of the current linetype, like this:

: celtype
New value for CELTYPE, or . for none/<"ByLayer">: continuous

The Special Case of Paper Space

Because linetypes are affected by scale, their scale becomes a problem in paper space. A linetype scale that looks fine in model space will look wrong in paper space, because paper space almost always has its own scale factor. By default, the scale of linetypes in paper space is 1.0 --- no matter what it may be in model space.

The solution comes with the PsLtScale system variable. Its job is to scale all linetypes relative to paper space.  Say, for example, the paper space scale is 1/4" = 1′ (that's 1:48). By setting PsLtScale to 48, BricsCAD automatically displays linetypes 48 times larger in paper space than in model space.

The Special Case of Polylines

Then there's a trick to employ when it comes to polylines. To understand the problem, it helps to know how BricsCAD generates linetypes. In an attempt to apply linetypes as nicely as it can, the software generates the linetype based on (a) the length of the object and (b) the linetype scale factor.

Essentially, BricsCAD starts at one end of the object, and then works its way to the other end. The program then centers the linetype pattern so that it looks nice and even at both ends. You'll never see the linetype pattern abruptly ending midway at one end of the object.  Here is how a line looks with a linetype applied centered:

Creating Simple & Complex Linetypes - 7-3-e1589881233723-1024x238

Centering a linetype on a line segment

Consider, then, the polyline. While it looks like one long connected line-arc-spline, it contains many vertices, even when you do not see them. Each vertex signals the start and end of a line or arc segment. BricsCAD faithfully restarts the linetype pattern each time it encounters a vertex.

When the vertices are close together, BricsCAD never gets around to restarting the pattern, resulting in a polyline that looks solid, or continuous. This drives some people nuts, like cartographers who use polylines for drawing contours.  The solution is to use the PlineGen system variable.  When turned off (the default), BricsCAD works as before, generating the linetype from vertex to vertex. When changed to on, BricsCAD generates the linetype from one end of the polyline to the other end --- ah, instant relief! (This problem does not affect splines.)

Customizing Linetypes

BricsCAD has two ways of creating custom linetypes: at the command prompt, or with a text editor.

Let's look at the first one first.

AT THE COMMAND PROMPT

Follow these steps to create new linetypes at the command prompt through the -Linetype  command:

  1. Start BricsCAD, and then enter the -Linetype Create command:

    : --linetype

    Linetype: ? to list/Create/Load/Set: c

  2. Give a name to the linetype, which can be as long as 31 characters.

    Name for new linetype: dit-dah

    Unlike creating a custom hatch pattern on-the-fly, BricsCAD actually stores the new linetype in a .lin file, allowing you to reuse it later.

  3. At this point, BricsCAD pops up the Create or Append Linetype dialog box.

    Creating Simple & Complex Linetypes - 8-2-585x354

    Accessing linetype files

    The dialog box lets you create a new linetype file or append the linetype definition in an existing, depending on your next step:

    • To create a new linetype file, enter the name of a new .lin file.
    • To append to an existing file, select the name of a .lin file.

    I find it easiest to keep all linetypes in one file, so I recommend accepting default.lin --- or iso.lin if I tend to work with ISO (international standard) linetypes.

  4. After clicking the Save button to dismiss the dialog box, BricsCAD checks:
    One moment... Checking existing linetypes for "dit-dah".


TIP If two linetypes have the same name, BricsCAD would only read the first one it came across. If you accidently (or otherwise) enter a linetype name that already exists --- such as Dashed --- BricsCAD warns:

DASHED already exists. Current definition is:
DASHED __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 0.50,-0.250\
Overwrite? <N>:

In this case, press enter and then try naming it again.

  1. Describe the linetype with any words you want up to 47 characters long. A good descriptive text would be the pattern you plan to create, using dots, underlines, and spaces.

    Linetype description: . __ . __ . __ . __

  2. Finally! You get to define the linetype pattern.

    Linetype definition (positive numbers for lines, negative for spaces): A,

    But, what's this A? The letter A forces the linetype to align between two endpoints. That's what causes the linetypes start and stop with a dash, adjusted to fit.
    Type the codes after the A, as follows:
    A, .25,-.1,0,-.1

    I could go on for a total of 78 characters but I won't.

  3. I press Enter to end linetype definition, and I'm done.

    Linetype "dit-dah" was defined in C:\Users...\support\default.lin.
    Linetype: ? to list/Create/Load/Set: (Press enter.)

    Well, not quite done. I still need to test the pattern. By the way, new linetypes are added to the end of the default.lin file.

Testing the New Linetype

It is important to always test a new customization creation. As simple as they are, linetypes are no exception. Test the Dit-Dah pattern, as follows:

  1. Use the Linetype Load command to load the pattern into the drawing:

    -linetype
    Linetype: ? to list/Create/Load/Set: L
    Enter linetype to load: dit-dah

  2. Up pops the Select Linetype File dialog box. Select default.lin, and then click Open. BricsCAD confirms:

    Linetype DIT-DAH loaded.

  3. Use the Set option to set the linetype, as follows:

    ?/Create/Load/Set: s
    New entity linetype (or ?) <BYLAYER>:

  4. Here you can type either the name of a loaded linetype (such as "dit-dah") or type ? to see which linetypes are already loaded.

  5. This time, get serious and set the current linetype to "dit-dah":

    ?/Create/Load/Set: s
    New entity linetype (or ?) <BYLAYER>dit-dah
    ?/Create/Load/Set: (Press enter.)

  6. Now, draw a line, and appreciate the linetype it is drawn with. Your debugging session is over.

CREATING LINETYPES WITH TEXT EDITORS

You can edit the default.lin linetype file directly to create custom linetypes. Here's how:

  1. Start a text editor (not a word processor), such as NotePad in Windows, Text Editor in Linux, or TextEdit in macOS.

  2. Open the default.lin file. You find it in one of the following locations:
    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/Support

    Creating Simple & Complex Linetypes - 9-1

    Adding linetype definitions with a text editor

  3. When you scroll down to the end of the file, you see the Dit-Dah pattern you defined as per the earlier tutorial.

  4. You can modify an existing linetype, or add a new linetype. The process is exactly the same as when you did it within BricsCAD, with two exceptions: (1) BricsCAD isn't there to prompt you; and (2) you don't need to use the "A" prefix.

  5. Save the .lin file with the same name (default.lin) or a new name, then test it within BricsCAD.


TIP If you can't be bothered burrowing all the way down to the \C:\Users<login>\AppData\Roaming \ Bricsys\BricsCAD\ V20\en_US\support\ folder, use the SUPPORTFOLDER command.


Linetype Format (.lin)

The linetype definition consists of two lines of text:

LINE 1: HEADER

Line one is the header, such as *dit-dah,. _ . _ . _ where:

* Asterisk indicates the start of a new linetype definition. DIT-DAH Name of the linetype.

, Comma separates the name from the description.

. __ . __ Dot-space-spline pattern describes the linetype (to a maximum of 47 characters), which is displayed by the Linetype ? command.

LINE 2: DATA

Line two is the data, such as A, .25,-.1,0,-.1 , where:

A --  "A" is the alignment flag, which forces BricsCAD to start and end the linetype with a line segment adjusted to the overall length of the object.

.25 -- First number specifies the length of dashes when LtScale = 1.0. Every linetype data line must begin with a dash.

-.1 -- Numbers with negative signs specify the length of gaps when LtScale = 1.0; every linetype data line must follow the initial dash with a gap.

0 -- Zeros draw dots.

You can use a semicolon ( ; ) to prefix any line as a comment line. Anything after the semicolon is ignored by BricsCAD.

COMPLEX (2D) LINETYPES

"Complex" linetypes include text characters. Truth be told, that's all they are: text --- or, more accurately, shapes.

Creating Simple & Complex Linetypes - 9-2-1024x76

Text placed in linetypes

The complex linetype is a mixture of text and simple linetype codes --- the dash, gap, and dot you learned of earlier. The text are characters that can come from any .shx font file.

You could make complex patterns using ASCII art. For example, a square can be made from a pair of square brackets to create the box effect: [ and ]. A zig-zag linetype can use the slash and backslash characters, / and .

Here, ASCII characters created smiley faces:

Creating Simple & Complex Linetypes - 10-3

Symbols created from punctuation and other characters

The text used in complex linetypes comes from the .shx file. The shape file format is arcane, written to be a highly efficient form of symbol for the slow running personal computers of the 1980s. Shapes were quickly superseded by blocks, but remain on the scene due to their use in linetypes and so on.

If you want to write a custom shape definitions, see post 19. Be warned, however, that coding shapes requires a knowledge of trigonometry. Jason Bourhill recommends that you use the MkShape (make shape) utility provided by Martin Drese.

The Express Tools collection also contains MkLType utility that makes linetypes, without needing to code them.

EMBEDDING TEXT IN LINETYPES

The hot water linetype combines a dash and a gap with the letters HW using the Standard text style (which uses the arial.ttf font file).

Here is the code for hot water:

*HOT_WATER, Hot Water ----HW----HW----HW----HW----HW----HW-- A,1.0,-.25,["HW",STANDARD,S=.2,R=0.0,X=-0.1,Y=-0.1],-.40

Much of this looks familiar, with the exception of the colored text between the square brackets, shown in boldface. That is how text is embedded in linetypes, and here's what it means:

Text

"HW" Prints the letters between the dashes.

Text Style

STANDARD Applies this text style to the text. This is optional; when missing, BricsCAD uses the current text style, whose name is stored in system variable TextStyle.

Text Scale

S=.2 S specifies the text size or scale factor. It can mean one of two things:

  • When the height defined by the text style is 0 (as is often the case), then S defines the height; in this case, the text is drawn 0.2 units tall).
  • When the text style height is not 0, then this number multiplies the text style's height; in this case, the text is drawn at 0.2 times (or 20%) of the height defined in the text style.

Text Rotation

R Rotates the text relative to the direction of the line; R=0.0 means no rotation. The default measurement is degrees; other forms of angular measurement are:

  • r for radian, such as R=1.2r (there are 2pi radian in a circle).
  • g for grad, such as R=150g (there are 400g in a circle).

The R parameter is optional and so can be left out. In this case, BricsCAD assumes zero degrees.

Absolute

A Rotates the text relative to the x-axis (the "A" is short for absolute). This ensures the linetype text is drawn so that it is always oriented in the same direction, no matter the angle of the line. Rotation is always performed within the text baseline and capital height. That's so the text isn't rotated way off near the orbit of Pluto.

The A parameter is optional and can be left out.

X and Y Offset

X Shifts the text in the x-direction from the linetype definition vertex, which helps center the text in the line. For example, X=-0.1 shifts it to the right by 0.1 units.

Y Shifts the text in the y-direction from the linetype definition vertex. Y=-0.1 shifts text down by 0.1 units. In both cases, the units are in the linetype scale factor, which is stored in system variable LtScale.

Creating Simple & Complex Linetypes - 11-3-585x226

Parameters for positioning text in a linetype

Summing up, you can create a text-based linetype with a single parameter, such as ["HW"], or you can exercise fine control over the font, size, rotation, and position with the six parameters listed above. BricsCAD can work with any .shx font file you have on your computer.

Parameter Meaning Optional? Example
“” Text Required “HW”
filename Name of text style Default style STANDARD
S= Text size or scale factor Style height S=0 .5
R= Rotation angle Angle = 0 R=45
A= Absolute rotation angle Angle = 0 A=0
X= Horizontal offset Offset = 0 X=0 .1
Y= Vertical offset Offset = 0 Y=-0 .1

BricsCAD does not recognize the U parameter, used by recent releases of AutoCAD® to keep shapes upright.


Download BricsCAD free for 30-days

Start Using BricsCAD Today

Permanent or subscription licenses that work in all languages, in all regions.


  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. Toolbars and Button Icons
  9. Writing Macros and Diesel Code
  10. Ribbon Tabs and Panels
  11. Keystroke Shortcuts, Aliases & Shell Commands
  12. 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