About Working with Linetypes (VBA/ActiveX)

A linetype is a repeating pattern of dashes, dots, and blank spaces.

A complex linetype is a repeating pattern of symbols. To use a linetype you must first load it into your drawing. A linetype definition must exist in a LIN library file before a linetype can be loaded into a drawing. To load a linetype into your drawing, use the Load method.

Note: The linetypes used internally by AutoCAD should not be confused with the hardware linetypes provided by some plotters. The two types of dashed lines produce similar results. Do not use both types at the same time, however, because the results can be unpredictable.

Linetype Descriptions

Linetypes can have a description associated with them. The description provides an ASCII representation of the linetype. You can assign or change a linetype description by using the Description property.

A linetype description can have up to 47 characters. The description can be a comment or a series of underscores, dots, dashes, and spaces to show a simple representation of the linetype pattern. For example:

ThisDrawing.ActiveLinetype.Description = "Exterior Wall"

Load a linetype into AutoCAD

This example attempts to load the linetype “CENTER” from the acad.lin file. If the linetype already exists, or the file does not exist, then a message is displayed.

Sub Ch4_LoadLinetype()
  On Error GoTo ERRORHANDLER

  Dim linetypeName As String
  linetypeName = "CENTER"

  ' Load "CENTER" line type from acad.lin file
  ThisDrawing.Linetypes.Load linetypeName, "acad.lin"
  Exit Sub

ERRORHANDLER:
  MsgBox Err.Description
End Sub