Creating Linetypes

There are many ways that companies handle adding text to lines – from the Land Desktop routines that trimmed a line into multiple segments and through the text in between to using blocks (or now just Mtext) and masking. However, the most common way to add text to lines is to create a special linetype. Let’s just create a few linetypes of our own.

A linetype is defined in a .lin file which is just a text file with certain values in the right order.

LTAdd1[1]

For example, in the image the first four lines are comments and are ignored by AutoCAD because they have a semicolon to begin the line.

;; AutoCAD Linetype File, for Complex Line Styles

;; InMotion Consulting

;;

A linetype definition begins with a name of the linetype (preceded by an asterisks) and a sample of the linetype. The name and sample are separated by a comma. In fact all parts of the linetype are separated by a comma.

*SILTFENCE,—-XX—-XX—-XX—-XX

Right below the linetype name and sample is the actual definition.

You start the linetype definition by add “A”. It is an alignment parameter but there are no other options currently than A.

From there, a linetype definition is just made of lines and gaps. Think of it like this. When you had the old pen plotters, they had to know when to draw a line and when to lift off the paper.

That is all we are doing with a linetype definition. A positive number represents the PEN DOWN and negative number represents the PEN UP.

So in the sample below, there will be a line (pen down) drawn that is 0.4375 units long in a 1:1 scale (a line is always first even if you put a gap first) with a gap (pen up) of –0.0625. From there we add our text (or any shape in a shape file for that matter).

The text part of the line definition has its own parameters.

  • The text to write
    • This is the actual text that will appear in the line.
  • The text style
    • The style must exist in the drawing for the linetype to work.
  • The size of the text.
    • Keep in mind this is all defined at a 1:1 scale.
  • The Rotation of the text
    • There are three ways to define rotation in a linetype now.
      • U = Upright or easy to read text. Compare Civil 3D Label Style’s Plan Readable Setting.
      • R = Relative rotation to the line.
      • A = Absolute rotation. 90 degree text is 90 degree text no matter which way the line is angled.
    • Degrees is the default value format but you can add R for Radians or G for Grads following the rotation value.
  • The X or horizontal offset of the text from the last pen up/down.
  • The Y or vertical offset of the text from the last pen up/down.

All of this is surrounded by brackets.

From there you can add as many or as few pen up/down patterns as you wish. Just remember that AutoCAD is smart enough to repeat that pattern as much as it needs to to create a linetype. So we have the following linetype definition.

*SILTFENCE,—-XX—-XX—-XX—-XX

A,0.4375,-0.0625,[“XX”,STANDARD,S=0.0625,R=0.0,X=-0.03125,Y=-0.03125],-.125

LTAdd2[1]

From there shapes are pretty easy! See if you can figure out how the shape complex linetype below works.

*GUARDRAIL,——-[]——-[]——-[]——-[]——-

A,.0625,[BOX,ltypeshp.shx,s=.0078125,y=-.0078125],-.015625

9 comments

  1. Andrew Stewart says:

    However much I’ve tweaked linetype definitions I can’t find a solution to a few problems: if a Pline starts off with too short a segment, or if a single line segment is too short, the line just shows up as a Continuous linetype. I can get it to show up reasonably well by changing the LTSCALE of the line, but then the text has a weird size to it. I can also get it to show up if I toggle LTGEN on/off, but that sometimes causes a space to fall on a bend in the line, so I can’t see where the corner of a line is, and that’s no good either.

    My solution has been to create Civil 3D label styles for all the linetypes we use. You can’t automate their interval without creating an alignment, but I’ll sacrifice that for having control over where the labels appear and being able to drag them around to avoid text overlap. I just keep all the basic linetypes that don’t involve text or shapes, like dashed, hidden, centerline, etc. All linetypes I can think of are variations of those anyway.

  2. A tip for Joshua’s post… If you decide to use a text style instead of a custom shape for text, make sure the text style is only used for dimensions and/or linetypes. Set the root style height to 0 and then you can control the actual text height easier within the linetype definition. The reason you don’t want to use a text style that is used for other notes and general text is that if someone changes the root height in the style manager all the linetypes that contain that text style will now vary from what was originally set.

    On the other hand…
    Andrew’s solution using a Civil 3D label style has been a great solution for many of my clients. Especially for all the utility linetypes.

  3. Bret Tremblay says:

    I’m interested in the plan readability portion of the text rotation. How did you do that?

  4. Bruce Dana says:

    Using unicode to get to charater set symbols from fonts opens another opportunity to create fancy line styles without shapes.

    See: http://www.cadforum.cz/cadforum_en/dotted-and-arrow-linetypes-tip7481

  5. Igor Khomyakov says:

    I have been using this tool for a long time, but recently needed to change text to italic (for as-built) and no luck. I tried STORM text style – it recognized it, but showed it straight again.