AutoCAD Linetypes - Part 2

Simple Linetype Definition

The AutoCAD linetype syntax is pretty simple. Referring back to Part 1, recall the linetype definition that I copied, edited, and named MY-DASHED.


acad.lin file
Looking at the definition, the first item is an asterisk, followed by the name of the linetype, then a short description, and finally an ASCII representation of the linetype. This last part is totally up to you, just get it as close as you can. Look at some of the other linetypes as a reference.

On the second line is where the guts of the linetype are actually defined. Start with an "A", then a comma. Next comes a positive numeral that represents the starting dash length, followed by a negative numeral to represent a space segment (or pen up condition). In my example above, the dash segment is 0.4 units long followed by a space of 0.35 units. Also notice that my example ends here. So what happens? AutoCAD just repeats the linetype definition over and over. You get a 0.4 unit long dash followed by a 0.35 unit long space, followed by a 0.4 unit long dash followed by a 0.35 unit long space and so on.

You can enter more than 2 segments. Take a look at your stock ACAD.LIN file and look at the PHANTOM2 linetype. It is composed of 6 segments.

*PHANTOM2,Phantom (.5x) ___ _ _ ___ _ _ ___ _ _ ___ _ _
A,.625,-.125,.125,-.125,.125,-.125

Complex Linetype Definition - Text Based

Moving on to complex linetypes, let's look at Text based linetypes first. The general syntax is the same as a simple linetype, but where you want to insert text you must use this syntax

["text",textstylename,scale,rotation,xoffset,yoffset]

The first item is the Text characters themselves, such as "GAS". Next comes the text style name, the scale, rotation, and any X or Y offset. A completed linetype definition might look like this:

*GAS_LINE,Gas line ----GAS----GAS----GAS----GAS----GAS----GAS--
A,.5,-.2,["GAS",STANDARD,S=.1,U=0.0,X=-0.1,Y=-.05],-.25

So we start off with the "A", then a 0.5 unit long dash, followed by a 0.2 unit long space followed by the text "GAS", then followed by a 0.25 unit long space. Then the pattern repeats starting with the 0.5 unit long dash again. You generally put a space on both sides of your Text. Consult the AutoCAD Customization Guide for specifics. For example, there are three available "rotation" parameters. U = plan readable, R = relative to the line, and A = absolute rotation.

Complex Linetype Definition - Shape Based

Shape based linetypes are similar to the Text based ones with one exception. Instead of a text string, you use the shape name.

*BATTING,Batting SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
A,.0001,-.1,[BAT,ltypeshp.shx,x=-.1,s=.1],-.2,[BAT,ltypeshp.shx,r=180,x=.1,s=.1],-.1

Note that the shape name is BAT, the shape file is "ltypeshp.shx". Also notice that there are two shape calls in the definition, the only difference is the rotation. The Batting linetype is a series of looping shapes linked together. The distance for the dash and space segments is kept very small so that the shapes appear to be interlinked. Here is the Batting linetype.


batting linetype

Although there are things you just cannot do with AutoCAD linetypes, they are pretty versatile. Use your imagination and you can come up with some unique linetypes when needed. Use Wingdings or some other specialty font for odd characters in your linetypes. If you need quote (or "inch") marks in a text based linetype, use the trick found here. Check out the image below, yes even this is an AutoCAD linetype.


braid linetype

Comments

I find it much easier to create a custom linetype in Express Tools, Tools, Make Linetype. I create a visual sample, 1" long then active Make linetype. No writing code, much easier. If adding text to the line, be sure to use dtext, not mtext.

Thanks for your comment Anna. If you have Express Tools installed, then you can certainly take advantage of the MKLTYPE command. Users of AutoCAD LT and AutoCAD clones will not have this command however.

I would love to learn how to make a linetype similar to the braid above! I deal with cables and something similar to this linetype would be a Godsend! How do you get any custom linetype with thickness to follow a curve without overlapping and leaving gaps?

The trick is to chop up your shapes into very short pieces, then daisy chain them together in the LIN file. Not super easy, but not impossible either.

 


All content is copyright © CAD PANACEA 2005-2013 unless otherwise noted and may not be reproduced. All comments posted to this blog are the sole responsibility of the person making the comment.

Google, as a third party vendor, uses cookies to serve ads on this site. Google's use of their cookies enables it to serve ads to users based on their visit to your sites and other sites on the Internet. You may opt out of the use of these cookies by visiting the Google ad and content network privacy policy.

Powered by Drupal