Cadtales
Complex Linetypes
Fun with Complex Linetypes was the working title for this
lesson. To the novice or the un-trained AutoCAD user complex
linetypes are a bit confusing and probably not fun. To help
you understand and benefit from complex linetypes we?ll
break down the simple but cryptic code for creating these
useful objects so your drawings can present clear and
comprehensive information with these symbolic lines.
To introduce this subject we?ll review the basic properties
that make up a linetype, look at the ?code? that generates
the line, and analyze each component and its impact on the
resulting line. Standard linetype descriptions are stored in
the acad.lin file. You can add your custom linetypes to this
file or create your own ?.lin? file (See the Exercise at the
end of this lesson). To find the location of the acad.lin
file, open the Properties Tool Bar, Linetype list arrow and
click ?Other.? In the Linetype Manager dialog box click the
Load button. In the Load or Reload Linetypes dialog box note
that acad.lin is posted and highlighted in the file
selection window. Click the File button and note the
directory path to this file. The default path is
C:\Documents and Settings\?user name?\Application
Data\Autodesk\AutoCAD 2008\enu\support. This file can be
opened and edited with Notepad or any similar non-formatting
editor. Always make a backup copy before editing.
Figure 1, below, shows a sample of the Hidden linetype, with
dimension labels indicating the length of the line segment
and the space that follows. Note that all linetypes are
created with fixed elements with specific dimensions, then,
scaled up or down to make them useful for micro to macro
drawings. We?ll explore the scaling tools LTSCALE, CELTSCALE
and PSLTSCALE later in this lesson.

Figure 1
The start of the linetype descriptor is marked with an
asterisk ?*?. ?HIDDEN? is the technical name of the linetype
and is separated from the common name (Hidden) by a comma.
The ?graphic? information that follows is a proxy
representation of the linetype created with common keyboard
text characters: dashes, hyphens, plus signs, parentheses,
etc.
The second line contains the instructions AutoCAD will use
in creating the linetype on screen. A comma ?,? separates
each command element, and each line in the instruction set
must end with a carriage return (Enter key).
A stands for A-type alignment,
.25 is the length of the line segment in AutoCAD Units,
- indicates a space, and
.125 is the length of the space in AutoCAD Units. (Enter)
The line command will automatically repeat the above pattern
to fill the space between the two points picked on the
screen by the operator and, add the beginning line segment
to the end to form a completed line.

Figure 2
Figure 2 shows two companion linetypes for comparison. Note
that Hidden (.5x) and Hidden (2x) differ from the original
line type only in the length of the line and space segments.
These linetypes are ?pre-scaled? to accommodate a range of
common scale factors (1/16?, 1/8? and 1/4?) quickly and
without changing related drawing properties.
For our second example we?ll use the DHWC linetype used to
draw domestic hot water lines (pipes) in schematic drawings.
See Figure 3 below.

Figure 3
The English translation for this linetype sequence is:
A is for A-type alignment,
.75 is the length of the first line segment (all lengths in
AutoCAD Units),
-0.25 space,
0.25? line,
-0.25 space,
0.25? line,
-0.25 space,
0.25? line,
-0.25 space (Enter)
Simple Customizations - Creating a custom linetype is easy.
Open the acad.lin file with Notepad. Copy an existing
linetype to the clipboard (Ctrl+C), scroll down to the User
Defined section and paste the copy into the list. Change the
name and description in the first line, then, change the
line and space instructions in the second line to provide
the desired pattern. (Be sure you have an Enter key at the
end of each line). Save the file and Load the new linetype.
In the event of an error in the new, or any other linetype,
the Load function will give you an error message and list
the linetype name, the type of error and the line number in
the file.
Complex Linetypes with Shapes - Starting with any basic linetype we can add additional visual content and
information by adding text and shapes. The Tracks and
Batting linetypes are two examples that utilize the
ltypeshp.shx file to create illustrative patterns for rail
road tracks and wall insulation batting. (The location of
the SHP or SHX file must be set in the support path. Use the
instructions in the AutoCAD Customization Guide under
?Linetype Definition Files.? Customizing with shapes will
not be covered in this lesson).
Figure 4 lists the instructions for these linetypes and
Figure 5 shows the lines as created in AutoCAD.

Figure 4

Figure 5
Complex Linetypes with Text
- The Hot_Water_Supply and
Gas_Line linetypes are two examples that utilize text to add
information and convey meaning to a line and, save time by
avoiding other labeling methods. See Figure 6 for the
linetype instructions and Figure 7 for the lines as created
in AutoCAD.

Figure 6

Figure 7
Follow the instructions in the
Simple Customizations section
above to create simple linetypes with text. Change the name
& description and substitute your own letter(s) into the
?HW? or ?GAS? text string, keeping the letter count the same
and retaining the quotation marks.
Complex linetypes with text contain two essential elements:
1) Line & space descriptors and, 2) A Text Style reference
with height & offset transform. The ?complex? part of the
linetype description is contained within the square
brackets, i.e. [?GAS?,STANDARD,S=.1,R=0,X=-.1,Y=-.05].
Where:
[ ] Brackets enclose the string, stylename, and transform
?GAS? is the text string, including the quotation marks,
STANDARD is the text style,
S=.1 is the height of the text in this case, or scale of
height set in the text style,
R=0.0 is the rotation, set to zero relative (to the line)
rotation,
(Replace R=0 with A=0 to set the absolute angle of the
text).
X=-.1 is the x-offset, set to -.1 units, (-.1 shifts the
text to the left)
Y=-.05 is the y-offset, set to -.05 units. (-.05 shifts the
text down)
(X and Y are +/- values, not spaces)
Note: The -.25 parameter (following the brackets) is the
area between the dashes and spaces reserved for the text.
The only difference between the HW and GAS instructions in
Figure 7 are the ending text-space numbers, -.2 vs. -.25,
allowing for more, or less, letters. Each element in the
instruction set is separated by a comma and there are no
spaces. And, remember ? each line must end with an Enter
key.
The graphic in Figure 8 is labeled with the applicable
linetype definition parameters. The dimensions and text
labels have been applied to the second and subsequent
instances of lines, spaces and text to avoid the distortion
caused by the line command automatically extending the
beginning and ending line segments to fill to bridge the two
points picked on the screen.

Figure 8
It?s a little strange to this writer that Autodesk would use
the STANDARD text style for this and other complex linetypes
featuring text because it is the one most often changed by
users (through lack of understanding or simply in a hurry).
The best policy is to always leave ALL standard styles at
their default settings. Create one or more text styles to be
used exclusively with linetype definitions. For a new
linetype creation, start with the txt.shx font and set text
height to zero. This will insure that the ?S? transform is
the actual text height and not a scale factor of the text
height set in the Text Style. Also, be aware that some fonts
adhere to standards which may cause the center to be off.
After a new complex linetype is working properly you can
change to other fonts as desired ? making adjusts to the
transform parameters as necessary. If in doubt, create the
desired text at actual height with Mtext and use the
Distance command to obtain measurements.
In the examples in Figure 7 the ?HW? and ?GAS? text strings
are centered vertically in the line regardless of the line?s
orientation. The location of the text is controlled by the
relationship between: S, the text height; X, the x-offset;
Y, the y-offset and the -.25 space parameter at the end of
the instruction set. In these examples the y-offset is ? the
text height, the x-offset is equal to the leading space and,
the reserved text space (-.25) is approximately equal to the
space occupied by the (3) letters.
As noted in the first paragraph, all linetypes other than
?continuous? have line and space segments that are created
to specific dimensions. In order to use, and see, these line
segments on drawings scaled larger, or smaller, than the
nominal size of the linetype we apply a scaling factor. The
global scaling variable for linetypes is ltscale. The
default value is 1. This setting will yield the following
visibility characteristics:
Model Space:
Lines will appear normal in a nominal drawing,
Lines may appear continuous in a larger drawing, and
Lines may appear continuous or not at all in a smaller
drawing.
Paperspace:
Lines will appear normal in all drawings and
will plot correctly.
For visibility in Model Space, the ltscale system variable
can be set manually to match the relative scale at which the
drawing will be viewed and printed in paper space. For a
drawing scale of 1/8? = 1?-0? use an ltscale factor of 96.
(There are 96 1/8?s of an inch in a foot). For a drawing
scale of 1/4? = 1?-0? use an ltscale factor of 48. Other
drawing scaling factors can be calculated in the same
manner. In later versions of AutoCAD the plotting routine
will ignore the ltscale setting and plot the lines normally.
A wise operator will avoid confusion and visibility issues
by setting linetypes ?By layer,? and ltscale to 1. In Model
Space we can ignore the appearance of the line and trust
that if it?s on the correct layer it is correct and will
print correctly.
LTSCALE
LTSCALE is the Global Scale Factor (system variable) value
which changes the linetype scale globally for both new and
existing objects. ltscale factors <1 make line segments
smaller. ltscale factors >1 make line segments larger. The
default setting is 1.
CELTSCALE
CELTSCALE is the Current Object Scale (system variable)
value controls the linetype scale for new objects. The
celtscale value is a scaling factor applied to the current
ltscale value. The default setting is 1.
PSLTSCALE
0 = No special linetype scaling. Linetype dash lengths are
based on the drawing units of the space (model or paper) in
which the objects were created and scaled by the global
LTSCALE factor.
1 = Viewport scaling governs linetype scaling. If
TILEMODE
is set to 0, dash lengths are based on paper space drawing
units, even for objects in model space. In this mode,
viewports can have varying magnifications, yet display
linetypes identically. For a specific linetype, the dash
lengths of a line in a viewport are the same as the dash
lengths of a line in paper space. You can still control the
dash lengths with ltscale.
When you change PSLTSCALE or use a command such as
ZOOM with psltscale set to 1, objects in viewports are not
automatically regenerated with the new linetype scale. Use
the REGEN or REGENALL command to update the linetype scales
in each viewport.
EXERCISE
Create a custom linetype named SANDBAG. When creating
complex linetypes use the ?S? transform to assign the actual
text height (text height in the Text Style set to ?0?). The
linetype transform values for S=(text height) and
Y=(y-offset) are used to vertically position the text in the
line. The ?X? transform can be used to shift the text left
(-) or right (+). To center the text vertically Y should
equal S/2.
1. In AutoCAD, create a new Text Style: LTtxt.
a. Use the txt.shx font and set the text height to zero.
b. Accept the defaults for all the other settings.
2. Enter ltscale on the command line and set the value to 1.
3. Enter celtscale on the command line and set the value to
1.
4. Enter psltscale on the command line and set the value to
1.
5. In a text editor (Notepad) create a file named
Mylines.lin and enter the following text:
*SANDBAG,---- SANDBAG ----
A,1.0,-0.1,[?SANDBAG?,LTtxt,S=0.1,R=0,X=0,Y=.05],-.77 (See
note c)
6. Save the file.
Notes:
a) Syntax: No spaces inside the lines; Enter at the
end of each line.
b) Transforms are positive and negative values (not lines &
spaces).
c) Actual text width is 0.67 + 0.1 trailing space = -.77
ending space parameter.
Testing
-
Start a new drawing.
-
Load the SANDBAG linetype using
the Mylines.lin file.
-
Create a new layer and assign
the SANDBAG linetype to the layer.
-
In Paper Space draw a line.
Now change ltscale to 2. The line should change. If the text
disappears extend the line to reveal the text again.
Now change celtscale to 2 and draw additional lines. These
lines will be scaled 4x.
The dashes stay in proportion to the text and everything
will scale together.

This example will rotate the text relative to the line?s
angle and keep the text aligned with the dashes. To have the
text always be horizontal (right-reading), replace the R=0
transform with A=0 (Angle = zero).
Do you see a productivity and quality benefit in using
Complex Linetypes in your design and drafting environment?
Call your Hagerman sales representative about software
upgrades, training and customization.
We want you to succeed!