Cadtales
Complex Linetypes II
How to create complex
linetypes
that comply with National CAD Standards
By guest author: Mark McDonough, CAD Systems Manager, Sasaki Associates
Among the most pervasive problems thwarting successful DWG file sharing is
that of missing shape files, those pesky little .shx files that people like
to use but frequently forget to include with their file transmittal. We need
to understand a little bit about shape files if we are to consider using
them in complex linetypes. Somewhat confusing is the fact that AutoCAD .shx
files can be one of three things: the familiar vector-based AutoCAD fonts;
bigfonts (extended font sets, such as Asian language characters); and, shape
files containing one or more symbols frequently used when defining complex
linetypes. AutoCAD ships with two shape file libraries of its own,
Ltypeshp.shx and Gdt.shx, found in the support folder where AutoCAD is
installed. To see what's inside the compiled .shx file, find and open the
source file that has a .shp file extension. Shown below is the content of
Ltypeshp.shp where six shapes are defined.

From within AutoCAD's linetype library file
ACAD.LIN, here is the ZIGZAG linetype definition which references the ZIG
shape within the Ltypeshp.shx file. Since Ltypeshp.shx is a standard AutoCAD
program file, defining linetypes using those shapes does not pose much of a
hazard to recipients of your drawings. However, if you create your own shape
file library and use it to define custom complex linetypes, you have created
an critical file dependency, and the shape files must be transmitted along
with any DWG files that reference them.

So what happens when you open a file and one or
more SHX files are missing? If the SHX is a font, one can easily substitute
a different font. If the SHX is a bigfont, then it's a problem because
substituting a different bigfont (AutoCAD ships with several bigfonts) is
like substituting apples for oranges. If the SHX is a shape file, then it
becomes a serious problem which can make drawings difficult and time
consuming to open and, sometimes resulting in file corruption. In my
experience (supporting a large CAD user base of over 200) we frequently
encounter land survey drawings where SHX shape files are missing - resulting
in DWG files that are agonizingly slow to open - taking up to 20 minutes or
more to open. The reason for the slowness - AutoCAD is looking, over and
over again, for perhaps thousands of instances of shapes used to describe
the linework.
The challenge remains, how do we define useful complex linetypes in our
drawings, yet mitigate the risk our drawings will not display properly when
opened by someone else because of missing or forgotten file dependencies.
Consider how important this mistake could be if, for example, your
architectural plans fail to show fire-rated wall linetypes when the drawings
are opened outside the realm of your own computer system. It is with this
concern in mind, that I set forth to create a series of custom complex
linetypes closely emulating symbology expressed in the
National CAD
Standards, specifically for fire-rated wall linetypes (see below). The
linetype graphics are specifically called out, using black diamonds; one
diamond for 1 hour, two diamonds for two hour, etc.


The solution chosen was to use Windows TrueType fonts, selecting fonts that
are
universal to all modern Windows operating systems, thereby assuring the
linetypes will display properly when opened on other computers. Wingdings
and Webdings are good fonts to experiment with as they contain shapes
potentially useful in complex linetypes, such as the solid diamond shape.
Caution: There may be, and probably are, many more Windows TrueType fonts on
your computer, other than those standard fonts universal to all modern
Windows systems. If a non-standard font is selected, you will have
introduced a similar problematic condition whereby linetypes might display
differently or wrong on other people's computers.
It is best practice to use only standard fonts.
In an article by Jim Rogers of CADreps on
linetype customization, we get a solid tutorial on how to go about
defining custom linetypes, so we’re not covering every aspect of custom
complex linetypes here. Instead, we'll build upon that earlier Cadtales
lesson. Let's review the standard AutoCAD "Hot_Water_Supply" linetype to get
a better understanding of the techniques required to implement our custom
fire-rated wall linetypes.
*HOT_WATER_SUPPLY,Hot water supply ---- HW ---- HW ---- HW ----
A,.5,-.2,["HW",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-.2
For complex linetypes, the important stuff is between the brackets, starting
out with the text we want to place into our linetype, which in this example
is the uppercase "HW". This is followed by the name of a pre-existing
textstyle, which is this case is: STANDARD. Since all AutoCAD drawings by
default have a textstyle named STANDARD, AutoCAD can typically depend on it
being there and available. The text size, rotation, and XY offset values
follow.
In our case we want to use a textstyle other then STANDARD, specifically, a
new textstyle named SYMB defined to use the Wingdings font. However, it's
important to note that if I attempt to load my custom linetype into a new
drawing, the load will fail because the textstyle named SYMB does not
pre-exist in the drawing. So, we'll need a mechanism to ensure that the
custom textstyle does exist prior to attempting to load the linetypes. We'll
get to that later. First, let's examine a new 1 Hour Fire-Rated Wall
linetype.
*1HR-FireRatedWall,1 hr fire-rated wall line ----t----t----t----
A,.20,-.09,["t",SYMB,S=.062,R=0.0,X=-0.072,Y=-.0285],-.0038
It starts out, as all linetype definitions do, with an asterisk followed by
the name of the linetype. Nest is a text description of linetype’s purpose,
and an optional visual representation of the linetype. The second line
begins with the letter A (as it must), followed by a line segment of .20
AutoCAD units, then a space or gap of .09 units. Next, we get to the text
portion within the brackets. It starts out entering a lower case "t," which,
when the font is set to Wingdings, corresponds to the diamond character.
Check it out, make a textstyle using Wingdings, then use the TEXT or MTEXT
command and enter "t" and, like magic, a diamond appears. It is followed by
text size, rotation, and XY offset values. Notice the use of three and four
decimal places for precise placement of the diamond. (It was necessary to
zoom in very close on the test linetype to fuss with the symbol positioning
to center it with the line. (Wingding symbols will often come in off center,
so it maybe necessary to tweak the XY offset values.)
Let's repeat the process for a 2 hour fire-rated wall linetype.
*2HR-FireRatedWall,2 hr fire-rated wall line ----tt----tt----tt----
A,.20,-.09,["t",SYMB,S=.062,R=0.0,X=-0.072,Y=-.0285],-.0038,["t",SYMB,S=.062,R=0.0,X=-.036,Y=-.0285],-.044
The first pattern is repeated, then appended with a second text portion to
add the second diamond. Notice in the second text portion, the X offset is
halved so that two diamonds actually touch. Also, the final gap amount is
changed to accommodate the wider text portion.
For the 3 hour fire-rated wall linetype, it's just a copy of the 2-hour
linetype, with yet one more text portion added to get the third diamond -
and the offsets and gaps tweaked accordingly. Because we're dealing with
offsets in the thousandth of a unit in some case, it may take some effort
and numerous reloads of the linetype to get it right. [Reloads may be faster
if your linetype development is done in a separate drawing, then use Design
Center to redefine the linetype.]
*3HR-FireRatedWall,3 hr fire-rated wall line ----ttt----ttt----ttt----
A,.20,-.09,["t",SYMB,S=.062,R=0.0,X=-0.072,Y=-.0285],-.0038,["t",SYMB,S=.062,R=0.0,X=-.036,Y=-.0285],.0038,
["t",SYMB,S=.062,R=0.0,X=-.001,Y=-.0285],-.079
The National CAD Standards include affiliated linetype standards for
fire-rated smoke barrier lines, the graphic representation is the same as
the fire-rated wall linetypes with an uppercase "S" placed next to the
diamond. Here is an example:
*1HR-SmokeBarrier,1 hr fire-rated smoke barrier line ----tS---tS---tS---
A,.20,-.09,["t",SYMB,S=.062,R=0.0,X=-0.072,Y=-.0285],-.0038,["S",STANDARD,S=.06,R=0.0,X=-0.015,Y=-.0285],-.047
In the example above, the first half of the linetype definition is the same
as the 1 hour fire-rated wall linetype. In the second portion we introduce
the "S" text using textstyle STANDARD, and the appropriate XY offsets,
followed by a final gap amount that ensures the gap on the left of the
symbol is equal to the gap on the right side. In our implementation of
AutoCAD, we ensure that textstyle STANDARD is defined with ROMANS.SHX
instead of TXT, to get smoother, better looking uppercase letter "S" in this
linetype, rather than the segmented "S" produced with the TXT.SHX font.
Implementation
Creating
custom linetypes, such as the fire-rated wall linetypes and fire-rated smoke
barrier linetypes, is the perfect opportunity to develop toolbars and lisp
utilities that will reinforce compliance with company CAD standards by
making useful tools that everyone can easily access. The tools are
compelling because they remove much of the tedious work that would go into
defining and loading linetypes, assigning those linetypes to appropriate
layers and, making sure that pre-existing standardized textstyles exist. The
linetypes themselves are sized to follow architectural standard scaling
i.e., to be the right size on 1/8"=1'-0" scale sheets (using the 12 x 8 = 96
LTSCALE factor associated with a 1/8"=1'-0" drawing), something to carefully
consider when first creating the linetypes in what can seem like a randomly
scaled environment.
For our custom toolbars, we have a button that shows a small section of the
1 hour fire-rated wall linetype, with a little fire above the diamond (one
of the fun parts of customizing lisp utilities is that you get to paint a
tool button icon). This brings up a dialog box that allows selecting from
among 8 different custom linetypes. The utility also has a command name and
a short alias name for those people who like to type; the command names are
FireRated and FR respectively.
After checking off the desired linetypes, the utility does the following: