Modifying line types in Autocad
Line types in Autocad can be modified with a text processor. Notepad is
recommended. Each linetype is defined on two lines in a LIN file. The first line defines the linetype name and provides for an optional description.
*linetype-name [, description]
This line must begin with an asterisk and must be immediately followed by the linetype name. If the description is provided, it must be separated from the name by a comma and no longer than 47 characters. The description is not used by AutoCAD; it is intended to help you visualize the appearance of the linetype.
The second line is the code that describes the actual pattern.
This line begins with the alignment code (currently only A is allowed), followed by a comma-delimited list of pattern descriptors (no spaces are allowed).
When you create a linetype, it is not loaded into your drawing automatically. Use the Load option of the LINETYPE commandThe following simple linetype, DD1, is an example of a repeating pattern:
Dash, 0.5 drawing units long
Space, 0.25 drawing units long
Space, 0.25 drawing units long
The linetype would be defined as
*DD1,____ . ____ . ____ . ____ .
DD1 is the linetype name, and the description field is the description of the linetype displayed by the LAYER Ltype ? command sequence. In this case, the description is a simple representation of the dash-dot pattern.
The description is optional and can be a sequence of dots, spaces, and dashes, or a comment such as "Use this linetype for hidden lines." If you omit the description, do not put a comma after the linetype name. If you include a description, it should be no longer than 47 characters long.
The alignment field specifies the action for pattern alignment at the ends of individual lines, circles, and arcs. Currently, AutoCAD supports only one alignment action. You specify it by entering A in the field. The alignment action is entered into the definition automatically when you use the LINETYPE Create option. However, if you create the linetype definition using a text editor, you need to include the A yourself. AutoCAD rejects any other character in the alignment field.
Each pat-n field specifies the length of a segment making up the linetype. If the length is positive, a pen-down segment will be drawn. A negative length denotes a pen-up (blank) segment. 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.
With A-type alignment, AutoCAD guarantees that the endpoints of lines and arcs start and end with a dash. For example, suppose you create a linetype called CENTRAL that displays the repeating dash-dot sequence commonly used as a centerline. AutoCAD adjusts the dash-dot sequence on an individual line basis so that dashes and line endpoints coincide. The pattern fits the line so that at least half of the first dash specification begins and ends the line. If necessary, the first and last dashes are lengthened. If a line is too short to hold even one dash-dot sequence, AutoCAD draws a continuous line between the endpoints. For arcs, the pattern is also adjusted so that dashes are drawn at the endpoints. Circles do not have endpoints, but AutoCAD adjusts the dash-dot sequence to provide reasonable displays.
The A-type alignment requires that the first dash length be 0 or greater (a dot or pen-down segment). The second dash length should be less than 0 (a pen-up segment). You must have at least two dash specifications for this alignment. Between the start and end 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.
Complex linetype descriptions are placed in LIN files along with simple linetypes. A complex linetype specifies a single, possibly broken, line interspersed with symbols. This linetype 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.
The syntax for complex linetypes is similar to that of simple linetypes in that it is a comma-delimited list of pattern descriptors. Complex linetypes can include shape and text objects as pattern descriptors, as well as the dash-dot descriptors of simple linetypes.
The syntax for both shape and text object descriptors in a linetype description is as follows:
where transform is optional and can be any series of the following (each preceded by a comma):
R=## Relative rotation
A=## Absolute rotation
X=## X offset
Y=## Y offset
In this syntax, ## is a signed decimal number (1, –17, 0.01, and so on), the rotation is in degrees, and the remaining options are in linetype-scaled drawing units. The preceding transform letters, if they are used, must be followed by an equal sign and a number.
Shapes in Complex Linetypes
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 es.shx
file. (Note that the es.shx file must be in the support path for the following example to work properly.)
*CON1LINE, --- [CON1] --- [CON1] --- [CON1]
Except for the code enclosed in square brackets, everything is consistent with the definition of a simple linetype. This example shows the minimal linetype definition that embeds a shape in a linetype.
As previously described, a total of six fields can be used to define a shape as part of a linetype. The first two are mandatory and position-dependent; the next four are optional and can be ordered arbitrarily. The following two examples demonstrate various shape definition field entries.
This code draws the CAP shape defined in the es.shx shape file with a scale of two times the unit scale of the linetype, a tangential rotation of 10 degrees in a counterclockwise direction, and an X offset of 0.5 drawing units before shape elaboration takes place.
This code draws the DIP8 shape defined in the pc.shx shape file with an X offset of 0.5 drawing units before shape drawing takes place, and a Y offset of one drawing unit above the linetype with a scale equal to the unit scale of the linetype and 0 rotation.
The following syntax defines a shape as part of a complex linetype.
The definitions of the fields in the syntax follow.
The name of the shape to be drawn. This field must be included. If it is omitted, linetype definition fails. If shapename does not exist in the specified shape file, continue with linetype drawing without the embedded shape.
The name of a compiled shape definition file (SHX). If it is omitted, linetype definition fails. If shapefilename is unqualified (that is, no path is specified), search the library path for the file. If shapefilename is fully qualified and not found at that location, remove the prefix and search the library path for the file. If it is not found, continue with linetype elaboration without the embedded shape.
S=value. The scale of the shape is used as a scale factor by which the shape's internally defined scale is multiplied. If the shape's internally defined scale is 0, the S=value alone is used as the scale.
R=value or A=value. R= signifies relative or tangential rotation with respect to the lines elaboration. A= signifies absolute rotation of the shape with respect to the origin; all shapes have the same rotation regardless of their relative position to the line. The value can be appended with a d for degrees (if omitted, degree is the default), r for radians, or g for grads. If rotation is omitted, 0 relative rotation is used.
X=value. This field specifies the shift of the shape in the X axis of the linetype computed from the end of the linetype definition vertex. If xoffset 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=.
Y=value. This field specifies the shift of the shape in the Y axis of the linetype computed from the end of the linetype definition vertex. If yoffset is omitted or 0, the shape is elaborated with no offset. This value is not scaled by the scale factor defined by S=.
Text in Complex Linetypes
Complex linetypes with text are used primarily for incorporating text as the shape to be elaborated. The primary difference between the use of shapes and the use of text is that text is associated with a text style in the drawing while shapes are associated directly with a shape file. The style associated with the linetype must be loaded into the drawing prior to loading the linetype.
The following is an example of a complex linetype definition that includes a text style.
*MCline, --- MC --- MC --- MC
MCline is the name of the linetype, and "--- MC --- MC --- MC" is the ASCII description. The syntax of the second line of the linetype definition is as follows:
The definitions of the fields in the syntax follow.
The text to be used in the complex linetype.
The name of the text style to be elaborated. The specified text style must be included. If it is omitted, use the currently defined style.
S=value. The scale of the style is used as a scale factor by which the style's height is multiplied. If the style's height is 0, the S=value alone is used as the scale.
Because the final height of the text is defined by both the S=value and the height assigned to the text style, you will achieve more predictable results by setting the text style height to 0. Additionally, it is recommended that you create separate text styles for text in complex linetypes to avoid conflicts with other text in your drawing.
R=value or A=value. R= signifies relative or tangential rotation with respect to the lines elaboration. A= signifies absolute rotation of the text with respect to the origin; all text has the same rotation regardless of its relative position to the line. The value can be appended with a d for degrees (if omitted, degree is the default), r for radians, or g for grads. If rotation is omitted, 0 relative rotation is used.
Rotation is centered between the baseline and the nominal cap heights box.
X=value. This field specifies the shift of the text in the X axis of the linetype computed from the end of the linetype definition vertex. If xoffset is omitted or is 0, the text is elaborated by using the lower-left corner of the text as the offset. Include this field if you want a continuous line with text. This value is not scaled by the scale factor that is defined by S=.
Y=value. This field specifies the shift of the text in the Y axis of the linetype computed from the end of the linetype definition vertex. If yoffset is omitted or is 0, the text is elaborated by using the lower-left corner of the text as the offset. This value is not scaled by the scale factor that is defined by S=.