Gas, water, sewer, storm drain and electric lines all need labels on a drawing. Instead of placing text by hand, you can build the label right into the linetype so it repeats automatically along any line, polyline or arc. This guide explains how it works, walks through a complete worked example, and gives you a free tool that writes the code for you.
Introduction & Theory: Why Text Linetypes Matter in Utility Drawings
A utility drawing is only useful if the reader can tell what each line is. A plain dashed line cannot say whether it is a gas main, a water service or a storm drain. The traditional fix is to place a text label beside the line by hand. That works on a small sketch, but on a real site plan it creates problems: labels are forgotten, spaced unevenly, or left behind when the line is moved, stretched or copied to another layer.
A complex linetype solves this by storing the label inside the linetype itself. The text travels with the geometry, repeats at a regular interval, and follows curves automatically. Change the line, and the labels update with it.
To understand the generator, it helps to know how AutoCAD reads a linetype. Linetypes are defined in a .lin file. In the pattern line, a positive number is a drawn dash, a negative number is a gap, and zero is a dot. A complex linetype adds a bracketed element, either a shape or a piece of text, that is placed at that point in the pattern. The bracket carries its own parameters: the text style, S for scale, R, A or U for rotation, and X and Y for offsets. If the text style has a height of 0, S sets the text height directly. If the style has a fixed height, S multiplies it, which is why a height of 0 is recommended.
Scale is the other key idea. Every number in the pattern is multiplied by the linetype scale (LTSCALE, and CELTSCALE for individual objects). That includes the text height, so the label grows and shrinks together with the dashes and gaps. This keeps the printed result consistent at any drawing scale.
Finally, remember that what a gas line or a water line should look like is usually set by your client, agency or office standard. Common references include the APWA uniform color code for marking utilities in the United States, the National CAD Standard for layer naming, and ISO 128 for line conventions in technical drawings. Use this guide to build the linetype, but always match the standard your project requires.
Try the generator
Type your text (for example GAS), choose a preset or set your own values, then copy the code or download a .lin file.
Step-by-Step Practical Application: Labeling a Gas Main on a Site Plan
Here is a complete worked example. Imagine a site plan drawn in feet at a scale of 1 inch = 40 feet, and you need a gas main labeled GAS with letters that print 0.1 inch tall.
- Set the generator values. Choose the GAS preset. Keep text height
0.1, dash length1, space each side0.05, char width factor1, and leave auto-center on. - Check the math. The estimated text width is 3 letters × 0.1 × 1 = 0.3. The total gap is 0.3 + (2 × 0.05) = 0.4, so each side of the label gets 0.2. The offsets come out at
X=-0.15andY=-0.05, which is half the text width and half the text height. The full pattern length is 1 + 0.4 = 1.4 units. - Create the text style. Type
STYLE, make a style namedSTANDARD(or your own) and set its height to0. - Load the linetype. Save the code as
custom.lin, typeLINETYPE, click Load, and chooseGAS_LINE. - Set the scale. For a 1 inch = 40 feet plot, set
LTSCALEto 40. Every number in the pattern is multiplied by 40, so the text height becomes 4 drawing feet, which prints at 0.1 inch, and the pattern repeats every 56 feet (1.4 × 40). - Draw and verify. Draw a 280-foot polyline with the linetype. You should see five repeats of the dash and the
GASlabel. If the letters touch the line, raise the space value to 0.08 or increase the width factor slightly and reload.
Repeat the same steps for WATER, SS and SD. Because longer words are wider, the generator widens the gap automatically, so every label stays clear of the line. Assign each linetype to its own layer and color according to your project standard, and the whole utility set stays consistent from sheet to sheet.
Watch the video tutorial
Prefer to see it in action? This video walks through the process step by step.
What is a complex linetype?
A simple linetype is made only of dashes, dots and gaps. A complex linetype also embeds a shape or a piece of text inside the pattern. That is how utility lines such as —— GAS —— GAS —— are drawn.
Anatomy of the .lin code
The generator produces two lines like these:
*GAS_LINE,Gas line ---- GAS ----
A,1,-0.2,["GAS",STANDARD,S=0.1,R=0.0,X=-0.15,Y=-0.05],-0.2
The first line is the name and description. The second line is the pattern, read left to right:
| Part | Meaning |
|---|---|
A | Alignment code. Always A for AutoCAD linetypes. |
1 | A solid dash of length 1. |
-0.2 | A gap before the text (the space on one side). |
"GAS" | The text to embed. |
STANDARD | The text style. It must already exist in the drawing. |
S=0.1 | Text height (scale). |
R=0.0 | Rotation. R is relative to the line, A is absolute, U is upright. |
X=, Y= | Offsets that position the text so it sits centered on the line. |
-0.2 (last) | A gap after the text. |
The settings explained
Dash length
The visible line between two labels. A longer dash means labels are spaced further apart.
Space each side of text
The gap left on both sides of the label so the text does not touch the line. Increase it if the text looks cramped.
Text height
The height of the letters. Because the text style height should be 0, this value controls the size.
Char width factor
The tool estimates how wide the text is so it can size the gaps. A factor of 1 is a good start. Different fonts have different widths, so adjust it if the gap looks too big or too small.
Auto-center
When on, the tool calculates the X and Y offsets so the text is centered on the line, including when you use a rotation angle.
How to load the linetype in AutoCAD
- Copy the code and paste it into a plain text file. Save it as
custom.lin(or use the Download .lin button). - Type
STYLEand create a text style whose height is 0. Use the same name you entered in the generator (defaultSTANDARD). - Type
LINETYPE, click Load…, pick your file, then select the linetype. - Apply it to a line or layer and adjust
LTSCALEorCELTSCALEuntil the text looks the right size.
.lin file.Troubleshooting
The text touches the line
Increase Space each side of text or the Char width factor.
The text is the wrong size
Make sure the text style height is 0. Then change the text height in the generator or adjust LTSCALE.
AutoCAD says the text style is not found
Create the style first with STYLE, using exactly the same name as in the generator.
The linetype does not appear on short lines
The line is shorter than one full pattern. Lower LTSCALE or reduce the dash length.
Text is upside down on some lines
Try rotation type R (relative) so the text follows the line direction, or U to keep it upright.
Frequently asked questions
Is the generator free?
Yes. It runs in your browser and nothing is uploaded.
Does it work in other CAD software?
The code follows the standard AutoCAD .lin format. Other CAD programs that read AutoCAD linetypes, such as BricsCAD or ZWCAD, can usually load it too, though results may vary.
Can I use any text?
Yes. Short labels such as GAS, SS, SD, OH, T or FO work best.
No comments:
Post a Comment