Shapes in Custom Linetypes (Concept)

AutoCAD

 
Shapes in Custom Linetypes
Concept Quick Reference
 
 
 

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.

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 dash-dot descriptors.

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

[shapename,shxfilename] or [shapename,shxfilename,transform] 

where transform is optional and can be any series of the following (each preceded by a comma):

R=## Relative rotation

A=## Absolute rotation

S=## Scale

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.

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

Except for the code enclosed in square brackets, everything is consistent with the definition of a simple 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 entries in the shape definition field.

[CAP,ep.shx,S=2,R=10,X=0.5] 

The code above draws the CAP shape defined in the ep.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.

[DIP8,pd.shx,X=0.5,Y=1,R=0,S=1] 

The code above draws the DIP8 shape defined in the pd.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 0 rotation and a scale equal to the unit scale of the linetype.

The following syntax defines a shape as part of a complex linetype.

[shapename,shapefilename,scale,rotate,xoffset,yoffset] 

The definitions of the fields in the syntax follow.

shapename

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 drawing the linetype but without the embedded shape.

shapefilename

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 drawing the linetype but without the embedded shape.

scale

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.

rotate

R=value or A=value. R= signifies relative or tangential rotation with respect to the line's 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.

xoffset

X=value. 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=.

yoffset

Y=value. 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=.