custom

Linetype is a visual property assigned to geometric objects. Linetypes can be a pattern of dashes, dots, text, and symbols, or unbroken and continuous.

The current linetype setting defines the default appearance of all new geometric objects. You can see which linetype is current in the Properties panel of the ribbon Home tab when no objects are selected.

The standard linetypes that come with the product are stored in two different library files, the names of those files is dependent on which product or products have been installed:

  • AutoCAD and AutoCAD-based products – acad.lin and acadiso.lin
  • AutoCAD LT product – acadlt.lin and acadltiso.lin

A standard library of linetypes is provided with your product that can be used as they are or modified to suit your needs. You can also create your own custom linetypes.

Linetype Definitions

Linetypes are defined in one or more linetype definition files that have a .lin file extension.

The linetype name and definition determine the particular dash-dot sequence, the relative lengths of dashes and blank spaces, and the characteristics of any included text or shapes. You can use the linetypes as they are, modify them, or create your own custom linetypes.

The following is an example of a linetype definition. The numbers represent the lengths of dashes and spaces, and the 0 represents a dot.

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

A LIN file can contain definitions of many simple and complex linetypes. You can add new linetype definitions to an existing LIN file or you can create new definitions by editing a LIN file using a text editor.

After you create or modify a linetype, you must load the linetype into your current drawing before you can use it.

How to Create a Simple Custom Linetype?

You can define a custom linetype with different patterns of dots, spaces, and dashes by creating or editing a linetype definition (LIN) file using a text editor. Once defined, you can load and use the custom linetype in any drawing file.

Each linetype is defined on two lines in a linetype definition file.

The first line contains the linetype name and an optional description. The second line is the code that defines the actual linetype pattern.

The second line must begin with the letter A (alignment), followed by a list of pattern descriptors that define pen-up lengths (spaces), pen-down lengths (dashes), and dots. You can include comments in a LIN file by beginning the line with a semicolon (;).

Linetype Definition Format

The format of the linetype definition is

*linetype_name,description 
A,descriptor1,descriptor2, ...

For example, a linetype called DASHDOT is defined as

*DASHDOT,Dash dot __ . __ . __ . __ . __ . __ . __ . __ 
A,.5,-.25,0,-.25

The example indicates a repeating pattern starting with a dash 0.5 drawing units long, a space 0.25 drawing units long, a dot, and another space 0.25 drawing units long. This pattern continues for the length of the line, ending with a dash 0.5 drawing units long. The linetype would be displayed as shown below.

__ . __ . __ . __ . __ . __ . __ . __

LIN files must be saved in the ASCII format and use a .lin file extension.

Linetype Name

The linetype name field must begin with an asterisk (*) and should provide a unique, descriptive name for the linetype.

Description

The description of the linetype should help you visualize the linetype when you edit the LIN file. The description is also displayed in the Linetype Manager and in the Load or Reload Linetypes dialog box.

The description is optional and can include

  • A simple representation of the linetype pattern using ASCII text
  • An expanded description of the linetype
  • A comment such as “Use this linetype for hidden lines”

If you omit the description, do not insert a comma after the linetype name. A description cannot exceed 47 characters.

Alignment Field (A)

The alignment field specifies the action for pattern alignment at the ends of individual lines, circles, and arcs. The program supports only A-type alignment, which guarantees that the endpoints of lines and arcs start and stop with a dash. You must specify A-type alignment by entering A in the alignment field.

Pattern Descriptors

Each pattern descriptor field specifies the length of segments making up the linetype, separated by commas (no spaces are allowed):

  • A positive decimal number denotes a pen-down (dash) segment of that length.
  • A negative decimal number denotes a pen-up (space) segment of that length.
  • A dash length of 0 draws a dot.

You can enter up to 12 dash-length specifications per linetype, provided they fit on one 80-character line in the LIN file. You need to include only one complete repetition of the linetype pattern defined by pattern descriptors. When the linetype is drawn, the application uses the first pattern descriptor for the starting and ending dashes. Between the starting and ending dashes, the pattern dash specifications are drawn sequentially, beginning with the second dash specification and restarting the pattern with the first dash specification when required.

A-type alignment requires that the first dash length be 0 or greater (a pen-down segment). The second dash length should be less than 0 if you need a pen-up segment and more than 0 if you are creating a continuous linetype. You must have at least two dash specifications for A-type alignment.

How to Add a Simple Linetype to an LIN File?

  1. Open an LIN file in a text editor that saves in ASCII format.
  2. Create a header line that includes an asterisk and a linetype pattern name. The name of the linetype pattern is limited to 31 characters.
    • *BORDER,Border
  3. (Optional) Include a description on the header line, follow the linetype pattern name with a comma and description text.
    • *BORDER,Border __ __ . __ __ . __ __ . __ __ . __ __ .
  4. Create a descriptor line that follows these rules:
    • All linetypes must begin with a dash.
    • Enter zeros for dots.
    • Enter negative real numbers for spaces. The value defines the length of the space in drawing units.
    • Enter positive real numbers for dashes. The value defines the length of the dash in drawing units.
    • Separate each dot, dash, or space value from the next with a comma.
    • Use a space between a dot and a dash.
    • A,.5,-.25,.5,-.25,0,-.25

How to Create a Simple Linetype From the Command Prompt?

  1. At the Command prompt, enter -linetype.
  2. Enter c and press Enter.
  3. Enter a name for the linetype and press Enter.The linetype name can include up to 255 characters. Linetype names can contain letters, digits, and the special characters dollar sign ($), hyphen (-), and underscore (_). Linetype names cannot include blank spaces.
  4. In the Create or Append Linetype File dialog box, select an existing LIN linetype file or enter a new file name in the File Name box. Click Save.If you select an existing file, the new linetype name is added to the file.
  5. (Optional) Enter text that describes the new linetype and press Enter.
  6. At the Enter Linetype Pattern prompt, specify the pattern for the tinetype and press Enter. Follow these guidelines:
    • All linetypes must begin with a dash.
    • Enter zeros for dots.
    • Enter negative real numbers for spaces. The value defines the length of the space in drawing units.
    • Enter positive real numbers for dashes. The value defines the length of the dash in drawing units.
    • Separate each dot, dash, or space value from the next with a comma.
    • Use a space between a dot and a dash.
  7. Press Enter to end the command.

Note: When you create a linetype, it is not loaded into your drawing automatically. Use the Load option of the -LINETYPE or the Load button in the Linetype Manager (LINETYPE command).

How to Add Text in a Custom Linetype?

Characters from text fonts can be included in linetypes. Linetype pattern descriptors that include embedded characters is similar to that for simple linetypes.

For example, a linetype called HOT_WATER_SUPPLY is defined as

*HOT_WATER_SUPPLY,---- HW ---- HW ---- HW ---- HW ---- HW ---- 
A,.5,-.2,["HW",STANDARD,S=.1,U=0.0,X=-0.1,Y=-.05],-.2

This indicates a repeating pattern starting with a dash 0.5 drawing units long, a space 0.2 drawing units long, the characters HW with some scale and placement parameters, and another space 0.2 drawing units long. The text characters come from the text font assigned to the STANDARD text style at a scale of 0.1, an upright rotation of 0 degrees, an X offset of -0.1, and a Y offset of -0.05. This pattern continues for the length of the line, ending with a dash 0.5 drawing units long. The linetype would be displayed as shown below.

Character Descriptor Format

The format for adding text characters in a linetype description is as follows:

["text_string",text_style_name,scale,rotation,xoffset,yoffset]

Scale, rotation, x-offset, and y-offset values must be expressed as signed decimal numbers such as 1, -17, and 0.01.

Text string

The characters to display in the linetype.

Text style name

The name of the text style to be used. If no text style is specified, the currently defined style is used.

Note: Embedded text characters are associated with a text style in the drawing. Any text styles associated with a linetype must exist in the drawing before you load the linetype.

Scale

The scale factor to be used for the text style relative to the scale of the linetype. The scale factor provided must be prefixed with S=, for example S=.5 indicates a scale factor of 0.5. The height of the text style is multiplied by the scale factor. If the height of the text style is 0, the value for S=value alone is used as the height.

Rotation

The rotation angle of the characters to be displayed in the linetype. The rotation angle must be prefixed with U=R=, or A=.

  • U= specifies upright or easy-to-read text.
  • R= specifies relative or tangential rotation with respect to the line.
  • A= specifies absolute rotation of the text with respect to the origin; that is, all text has the same rotation regardless of its position relative to the line.

The value can be appended with a

  • d for degrees (degrees is the default value)
  • r for radians
  • g for grads

If rotation is omitted, 0 relative rotation is used. Rotation is centered between the baseline and the nominal cap height.

Note: Drawings containing legacy linetypes that do not use the U (upright) rotation flag can be updated to the latest linetype definition by reloading the linetype from the LIN files. Custom linetypes can be updated by changing the R (rotation) flag to the U (upright) flag prior to reloading a linetype definition.X-offset

The shift of the text on the X axis of the linetype, which is along the line. The offset provided must be prefixed with X=, for example X=.1 indicates an offset of 0.1. If an offset is omitted or is 0, the text is elaborated with no offset. Use this field to control the distance between the text and the previous pen-up or pen-down stroke. This value is not scaled by the scale factor defined by S=value, but it is scaled to the linetype.Y-offset

The shift of the text in the Y axis of the linetype, which is at a 90-degree angle to the line. The offset provided must be prefixed with Y=, for example Y=.1 indicates an offset of 0.1. If an offset is omitted or is 0, the text is elaborated with no offset. Use this field to control the vertical alignment of the text with respect to the line. This value is not scaled by the scale factor defined by S=value, but it is scaled to the linetype.

How to Add Shapes in a Custom Linetype?

A complex linetype can contain embedded shapes that are saved in shape files. Complex linetypes can denote utilities, boundaries, contours, and so on.

As with simple linetypes, complex lines are dynamically drawn as the user specifies vertices. Shapes and text objects embedded in lines are always displayed completely; they are never trimmed.

Linetype pattern descriptors that include shape objects is similar to that for simple linetypes.

The syntax for shape object descriptors in a linetype description is as follows:

[shape_name,shape_filename] or [shape_name,shape_filename,transform]

The following linetype definition defines a linetype named CON1LINE that is composed of a repeating pattern of a line segment, a space, and the embedded shape CON1 from the ep.shx file. (Note that the ep.shx file must be in the support path for the following example to work properly.)

*CON1LINE, --- [CON1] --- [CON1] --- [CON1]
A,1.0,-0.25,[CON1,ep.shx],-1.0

Character Descriptor Format

The format for adding a shape to a linetype description is as follows:

[shape_name,shape_filename,scale,rotate,xoffset,yoffset]

Scale, rotation, x-offset, and y-offset values must be expressed as signed decimal numbers such as 1, -17, and 0.01.

Shape name

The name of the shape to be drawn. This field must be included. If it is omitted, the linetype definition fails. If shape_name does not exist in the specified shape file, the linetype is loaded and can be used but without the embedded shape.

Shape filename

The name of a compiled shape definition (SHX) file. If it is omitted, the linetype definition fails. If shape_filename is unqualified (that is, no path is specified), the support paths of the program are searched for the file. If shape_filename is fully qualified and not found at that location, the path is removed and the support paths of the program are searched for the file. If the file is not found, the linetype is loaded and can be used but without the embedded shape.

Scale

The scale factor to be used for the shape by which the shape’s internally defined scale is multiplied. The scale factor provided must be prefixed with S=, for example S=.5 indicates a scale factor of 0.5. If the shape’s internally defined scale is 0, the S= value alone is used as the scale.

Rotate

The rotation angle of the shape to be displayed in the linetype. The rotation angle must be prefixed with U=R=, or A=.

  • U= specifies upright or easy-to-read text.
  • R= specifies relative or tangential rotation with respect to the line.
  • A= specifies absolute rotation of the text with respect to the origin; that is, all text has the same rotation regardless of its position relative to the line.

Note: Drawings containing legacy linetypes that do not use the U (upright) rotation flag can be updated to the latest linetype definition by reloading the linetype from the LIN files. Custom linetypes can be updated by changing the R (rotation) flag to the U (upright) flag prior to reloading a linetype definition.

X-offset

The shift of the shape in the X axis of the linetype computed from the end of the linetype definition vertex. The offset provided must be prefixed with X=, for example X=.1 indicates an offset of 0.1. If an offset is omitted or is 0, the shape is elaborated with no offset. Include this field if you want a continuous line with shapes. This value is not scaled by the scale factor defined by S=value.

Y-offset

The shift of the shape in the Y axis of the linetype computed from the end of the linetype definition vertex. The offset provided must be prefixed with Y=, for example Y=.1 indicates an offset of 0.1. If an offset is omitted or is 0, the shape is elaborated with no offset. Include this field if you want a continuous line with shapes. This value is not scaled by the scale factor defined by S=value.

How to Load the Custom Linetype?

  1. Command line enter “Linetype”
  2. In the Linetype Manager dialog box, click Load.
  3. In the Load or Reload Linetypes dialog box, use one of the following methods:
    • Choose the linetypes to load.
    • Click File to open a linetype definition (LIN) file, and choose the linetypes to load.
  4. Click OK to close each dialog box.

How to Unload the Linetype?

In the Linetype Manager dialog box, choose the linetype, and click Delete.

These linetypes cannot be unloaded:

  • BYLAYER
  • BYBLOCK
  • CONTINUOUS
  • Linetypes currently in use

Note: Use the PURGE command to remove all unused linetypes from a drawing.

How to Set the Linetype Scale for New Objects?

The linetype scale controls the size and spacing of repetitions of the linetype pattern per drawing unit.

  1. In the Linetype Manager, click Show Details.
  2. Enter a new value for Current Object Scale.

How to Change the Linetype Scale of Selected Objects?

  1. Select the objects.
  2. Right-click in the drawing area, and choose Properties from the shortcut menu.
  3. In the Properties palette, click Linetype Scale and enter the new value.

How to Change the Linetype Scale for All Objects?

  1. In the Linetype Manager, click Show Details.
  2. Enter a new value for Global Scale Factor.

Note: The object’s current linetype scale is multiplied by the global scale factor to get the displayed linetype scale.

Read more