Creating Custom AutoCAD Linetypes

As one of the instructors here at CAD Masters, I’d have to say one of my favorite topics to teach is creating custom AutoCAD linetypes. While not too difficult, it tends to be a task many users choose to leave to their company’s CAD manager. If, in the event that you know exactly what linetypes you would like to create yourself, use either of the two methods below to do so.

Adding to the Existing acad.lin File

The first method consists of adding the definition of your custom linetype to your acad.lin file. To find the location of this file, at the command line, type (findfile acad.lin). The acad.lin file is where the definitions of many of the default linetypes reside. Let’s take a look at one of the existing definitions to see how they work.

*BORDER,Border __ __ . __ __ . __ __ . __ __ . __ __ .
A,.5,-.25,.5,-.25,0,-.25

Every linetype definition consists of two lines of text. The first line consists of a standard asterisk, the linetype name, and a description including a text preview of the linetype. The second line is where it starts to get tricky. First we have a standard letter A to specify the alignment type (always A in AutoCAD linetypes), then a series of values to define the actual pattern. Positive values represent a line of that length, negative values represent a space of that length, and zeroes represent periods. Below you can see how these values relate to the actual linetype.Linetypes with text become a bit more complicated by including a portion specific to the text in brackets. This bracket portion defines the linetype text, text style, text size, rotation angle, horizontal offset, and vertical offset.

*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

The most difficult part about this is determining the horizontal and vertical offsets, but even those are not too hard to figure out by experimenting and giving your linetype a few test runs.  Choose a text style that exists in all of your drawings, such as the Standard text style.  Make sure the text height for that style is set to 0 in the drawing so that the text height is controlled by the height setting in the linetype (s=.1) and the LTSCALE, rather than a static value.

At the bottom of the acad.lin file is space to add your own custom linetype. Compose your own, and save the file. If done correctly, you should now be able to load this file using the LINETYPE command. Load your new custom linetype, and you’re done!

Custom AutoCAD Linetypes with Express Tools

The second method of linetype creation doesn’t require you to create your own linetype definition in the acad.lin file, but does require AutoCAD Express Tools to be installed. On the Express Tools tab of the Ribbon, expand the Tools panel to find the Make Linetype and Make Shape buttons.

Make Linetype Make Shape ScreenshotThe advantage to using the Express Tools method is that it allows you to easily create shapes and incorporate these into your linetypes. Draft your shape, and then use the Make Shape tool to create a .shp file for it. Use the SHAPE command to insert your shape into your drawing, and draft the pattern of your linetype.Custom AutoCAD Linetype Shape ExampleNow, use the Make Linetype tool to create your linetype based on this pattern. It will prompt you for a location for the new .lin file and the linetype’s name and description. When it asks for the starting and ending points for the line definition, specify the region that will be repeating throughout the linetype.Custom AutoCAD Linetype Shape GapSelect the objects that compose your linetype, and ta da! You have your own custom linetype incorporating a custom shape.Custom AutoCAD Linetype With Shape FinalIn order for linetypes using shapes to work properly, both the .lin and .shp need to be in a Support File Search Path, such as the location of your acad.lin file.

10 Comments
  1. Thank you for your input… it has been awhile since I played with line types (ver 2000) its nice to know not much has changed

  2. Thanks for the great info!
    Question: When I do this I have to set the linetype scale very small for the shape to show up at the size in which I created it. Am I doing something wrong?

  3. thank you very much admin for your important news to share with us. And more thanks for i get best idea read this article about this topics. many more days i was searched this topics, finally i got it.

  4. You have posted such helpful content. Thank you so much for sharing this information with us. Hopefully, it will help other people in the future.

    1. A represents the start of the line that has code. (The previous line had information like linetype name and description).

      The commas separate different parameters in the code.

      Positive numbers like .5 are dashes of that length.

      Negative numbers like -.2 are spaces of that length.

      The brackets indicate that text is embedded into the linetype, and the stuff in the brackets sets the text.

      The first part, in quotes, is the text that will be embedded.

      “Standard” is a text style. Every drawing comes with a standard text style so it is a reliable choice. If you have a linetype that attempts to access a style that ISN’T in the drawing, this is a recipe for errors and warnings.

      S codes for the height of the text.

      R tells the text how far to rotate from the line. O, or no rotation, is typical.

      X= codes for offset in the direction of the line. The reason this is sometimes negative is because the text has a default spacing of .5 from the previous parameter, so sometimes a negative value is used here to shorten that default spacing.

      Y= codes for offset up or down from the line. A negative value here helps center the text on the line. Note that this value is often half the S value, because that captures the true middle.

      I hope this helps!

  5. Thank you for this. How do I put the shape at the beginning of a Linetype. all the examples I have seen have them in the line. I would like an arrow head at the beginning.

    1. Armin,

      I’m wondering if a polyline with varying widths may be a solution.

      If you are drawing a polyline, you could go to the width subcommand, and give it a starting width of 0, and an ending width of 5, before drawing a line segment with a length of 5. These lengths are examples. if you do this, you should see an arrowhead.

      If you go back to the width subcommand, you can give it a starting and ending width of zero for subsequent segments.

      This polyline could then use any linetype you like, but it has an arrowhead at the beginning.

Leave a Reply

Your email address will not be published.

Back to blog

Copyright ©2017, CAD Masters, Inc.. All Rights Reserved.