Creating Complex Linetypes
The syntax for complex linetypes is similar to that of simple linetypes in that it is a comma-delimited list of pattern descriptions. The difference is, is that complex linetypes can include shape and text objects as pattern descriptors, as well as the normal dash-dot descriptors of simple linetypes. In this tutorial we are going to look at creating a complex linetype using a text object as a descriptor.
The syntax for text object descriptors in a linetype definition is as follows :
["string" , stylename]
or
["string" , stylename , transform]
That's great Kenny, but I haven't a clue what this all means!
O.K. Don't worry, we'll go through it step by step. Open up your Afralisp.lin file that you created in the previous tutorial and add the following :
;; [CODE_PAGE] ANSI_1252 *dashdot3,_ . . . _ . . . _ . . . _ A,0.5,-0.25,0,-0.25,0,-0.25,0,-0.25 ;; *AFRALISP,---- AL ---- AL ---- AL ---- AL A,1.0,-0.25,["AL",STANDARD,S=1,R=0,X=0,Y=-0.25],-1.25
If you loaded and set this linetype, it would look like this :
If we put this into words, we would be saying, "Draw a line 1 unit long, lift the pen for 0.25 of a unit, then add "AL" as text using "STANDARD" font style, now lift the pen for 1.25 units, and then repeat the process".
Let's have a wee look at the "AFRALISP" linetype :
*AFRALISP,---- AL ---- AL ---- AL ---- AL
The first line, of course is the linetype name followed by the description.
A,1.0,-0.25,["AL",STANDARD,S=1,R=0,X=0,Y=-0.25],-1.25
The second line contains the linetype definition. Lets, zoom into this.
"A
" is the alignment which is defaulted.
"1.0
" and "-0.25
" are pen commands as is "-1.25
" at the end of the definition.
["AL",STANDARD,S=1,R=0,X=0,Y=-0.25]
is the one that interests us.
The syntax of these fields are as follows :
string ("AL")
The text to be used in the complex linetype.
style (STANDARD)
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.
scale (1)
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.
rotate (0)
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.
xoffset (0)
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=.
yoffset (-0.25)
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=.
Well that's about it for complex linetypes. But before I go, here's a few more custom linetypes that you can play around and practice with :
;; [CODE_PAGE] ANSI_1252 ;; ;; AfraLISP Linetypes ;; *dashdot3, _ . . . _ . . . _ . . . _ A,0.5,-0.25,0,-0.25,0,-0.25,0,-0.25 ;; *AFRALISP,---- AL ---- AL ---- AL ---- AL A,1.0,-0.25,["AL",STANDARD,S=1,R=0,X=0,Y=-0.25],-1.25 ;; *DIESEL,---- DIESEL ---- DIESEL ---- DIESEL ---- DIESEL ---- DIESEL A,50,-2,["DIESEL",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-6.5 ;; *BEER,---- BEER ---- BEER ---- BEER ---- BEER ---- BEER A,50,-2,["BEER",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-6.5 ;; *DRINKING_WATER,---- DRINKING H20 ---- DRINKING H20 ---- DRINKING H20 A,50,-2,["DRINKING H20",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-14 ;; *ELECTRICAL,---- ELECT ---- ELECT ---- ELECT ---- ELECT ---- ELECT A,50,-2,["ELECT",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-5.5 ;; *HIGH_TENSION,---- HT ---- HT ---- HT ---- HT ---- HT ---- HT ---- A,50,-2,["HT",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-2 ;; *OIL,---- OIL ---- OIL ---- OIL ---- OIL ---- OIL ---- OIL ---- A,50,-2,["OIL",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-3 ;; *OPTIC,---- OPTIC ---- OPTIC ---- OPTIC ---- OPTIC ---- OPTIC ---- A,50,-2,["OPTIC",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-5.5 ;; *PHONE,---- PHONE ---- PHONE ---- PHONE ---- PHONE ---- PHONE ---- A,50,-2,["PHONE",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-6 ;; *PLANT_WATER,---- PLANT H20 ---- PLANT H20 ---- PLANT H20 A,50,-2,["PLANT H20",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-11 ;; *SECURITY_FENCE,---- X ---- X ---- X ---- X ---- X ---- X ---- A,50,-2,["X",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-1 ;; *SEWER,---- SEWAGE ---- SEWAGE ---- SEWAGE ---- SEWAGE ---- A,50,-2,["SEWAGE",STANDARD,S=1.25,R=0.0,X=-1,Y=-.5],-7
O.K. Now I'll put you all out of your misery! Under the Express Tools pull down menu (
) you will find the Make Linetype command. This is a shortcut for creating your own linetype files. The command can also be found on the Ribbon: Express tab, Tools panel. Now don't say I'm not nice to you!For further information on complex linetypes, take a look at Controlling Complex Linetypes