| 1 |
divert(-1) |
| 2 |
# `datumarrow(linespec,wid,ht)' |
| 3 |
define(`datumarrow',`line `$1' |
| 4 |
M4_E: last line.end |
| 5 |
datum_ht = ifelse(`$3',,`textht',`$3') |
| 6 |
M4_P: vperp(last line,(datum_ht*2/sqrt(3))) |
| 7 |
M4_X: datum_ht/lin_leng(last line) between M4_E and last line.start |
| 8 |
{ifsvg(,`m4fshade(m4fill,')line from M4_E to M4_E+M4_P/2 dnl |
| 9 |
then to M4_X then to M4_E-M4_P/2 then to M4_E ifsvg(`fill_(0)',`)')}') |
| 10 |
|
| 11 |
# `Y14_frame( arg1, arg2, ... ) |
| 12 |
Each arg is a ;-separated sequence of 1 or more of |
| 13 |
"string"[ wid val], |
| 14 |
"(letter)", |
| 15 |
or tolerance symbol. |
| 16 |
The term "(letter)" expands to the circled letter. |
| 17 |
The frame contains as many boxes as arguments.' |
| 18 |
`Symbol definitions from ASME Y14.5 Appendix C' |
| 19 |
define(`Y14_frameht',`textht*2') |
| 20 |
define(`Y14_defaultwid',`textht*2') |
| 21 |
# |
| 22 |
define(`Y14_frame',`[ tmpthick = linethick; thicklines_ |
| 23 |
right_; B:[ Y14_fram_($@) ] |
| 24 |
box wid B.wid ht Y14_frameht at B |
| 25 |
linethick = tmpthick ]') |
| 26 |
define(`Y14_fram_',`ifelse(`$1',,, |
| 27 |
`stacksplit_(`Y14',`$1',;) stackreverse_(`Y14') |
| 28 |
Bx: [stackdo_(`Y14', |
| 29 |
`[ifelse(index(Y14,`"('),0, |
| 30 |
`circle diam textht*5/3 |
| 31 |
patsubst(Y14,`"(\(.\))"',`"\1"') ht textht*0.8 at last circle', |
| 32 |
index(Y14,`"'),0, |
| 33 |
`Y14 ifinstr(Y14,`wid ',,`wid textht*2/3*(len(Y14)-2)')', |
| 34 |
`Y14')] |
| 35 |
move right max(last [].wid+textht/2,Y14_defaultwid) with .c at last []; ')] |
| 36 |
ifelse(`$2',,,`{ line up Y14_frameht with .c at Here }') |
| 37 |
Y14_fram_(shift($@))') ') |
| 38 |
|
| 39 |
# Each symbol definition has an abbreviated version |
| 40 |
define(`Y14_straightness', |
| 41 |
`line right textht*2 ') |
| 42 |
define(`Y14_str_',`Y14_straightness($@)') |
| 43 |
|
| 44 |
define(`Y14_flatness', |
| 45 |
`line right textht*3/4 then down textht left textht/2 \ |
| 46 |
then left textht*3/2 then up textht right textht/2 \ |
| 47 |
then right textht*3/4 ') |
| 48 |
define(`Y14_fla_',`Y14_flatness($@)') |
| 49 |
|
| 50 |
define(`Y14_circularity',`circle diam textht*3/2 ') |
| 51 |
define(`Y14_cir_',`Y14_circularity($@)') |
| 52 |
|
| 53 |
define(`Y14_cylindricity', |
| 54 |
`circle diam textht |
| 55 |
Y14_C: last circle |
| 56 |
Y14_R: (Rect_(last circle.rad,-30)) |
| 57 |
Y14_A: (Rect_(textht,60)) |
| 58 |
line from Y14_C+Y14_R+Y14_A to Y14_C+Y14_R-Y14_A/2 |
| 59 |
line from Y14_C-Y14_R-Y14_A to Y14_C-Y14_R+Y14_A/2 ') |
| 60 |
define(`Y14_cyl_',`Y14_cylindricity($@)') |
| 61 |
|
| 62 |
define(`Y14_lineprofile',`arc from (textht,0) to (-textht,0) with .c at Here ') |
| 63 |
define(`Y14_lin_',`Y14_lineprofile($@)') |
| 64 |
|
| 65 |
define(`Y14_surfaceprofile', |
| 66 |
`arc from (textht,0) to (-textht,0) with .c at Here |
| 67 |
line from last arc.start to last arc.end ') |
| 68 |
define(`Y14_sur_',`Y14_surfaceprofile($@)') |
| 69 |
|
| 70 |
define(`Y14_perpendicularity', |
| 71 |
`line from (-textht,0) to (textht,0) |
| 72 |
line from (0,0) to (0,textht*3/2) ') |
| 73 |
define(`Y14_per_',`Y14_perpendicularity($@)') |
| 74 |
|
| 75 |
define(`Y14_angularity', |
| 76 |
`line from (textht*3/2,0) to (0,0) then to (textht*3/2,textht*sqrt(3)/2) ') |
| 77 |
define(`Y14_ang_',`Y14_angularity($@)') |
| 78 |
|
| 79 |
define(`Y14_parallelism', |
| 80 |
`line up textht*3/2*sqrt(3)/2 right textht*3/4 |
| 81 |
move right textht*0.6 |
| 82 |
line down textht*3/2*sqrt(3)/2 left textht*3/4 ') |
| 83 |
define(`Y14_par_',`Y14_parallelism($@)') |
| 84 |
|
| 85 |
define(`Y14_symmetry', dnl obsolete! |
| 86 |
`line from (-textht/2,0) to (textht/2,0) |
| 87 |
line from (-textht/3,textht/4) to (textht/3,textht/4) |
| 88 |
line from (-textht/3,-textht/4) to (textht/3,-textht/4) ') |
| 89 |
define(`Y14_sym_',`Y14_symmetry($@)') |
| 90 |
|
| 91 |
define(`Y14_position', |
| 92 |
`circle diam textht |
| 93 |
line up textht*3/2 with .c at last circle |
| 94 |
line right textht*3/2 with .c at last circle ') |
| 95 |
define(`Y14_pos_',`Y14_position($@)') |
| 96 |
|
| 97 |
define(`Y14_concentricity', dnl obsolete! |
| 98 |
`circle diam textht |
| 99 |
circle diam textht/2 at last circle ') |
| 100 |
define(`Y14_con_',`Y14_concentricity($@)') |
| 101 |
|
| 102 |
define(`Y14_circularrunout', |
| 103 |
`arrow ht textht*0.8 wid textht*0.6 up textht*3/2 right textht*3/2 ') |
| 104 |
define(`Y14_cir_',`Y14_circularrunout($@)') |
| 105 |
|
| 106 |
define(`Y14_totalrunout', |
| 107 |
`arrow <-> ht textht*0.8 wid textht*0.6 \ |
| 108 |
down textht*3/2 left textht*3/2 then right textht*1.1 \ |
| 109 |
then up textht*3/2 right textht*3/2 ') |
| 110 |
define(`Y14_tot_',`Y14_totalrunout($@)') |
| 111 |
|
| 112 |
define(`Y14_diameter', |
| 113 |
`circle diam textht |
| 114 |
line up textht*3/2 right textht*3/4 with .c at last circle') |
| 115 |
define(`Y14_dia_',`Y14_diameter($@)') |
| 116 |
|
| 117 |
# The following are not Y14.5 but go well with them: |
| 118 |
|
| 119 |
`r_box(angle,pos,string) |
| 120 |
Rotated text on a white background |
| 121 |
(requires pstricks)' |
| 122 |
define(`r_box', |
| 123 |
`ifpstricks(`M4tmp: ifelse(`$2',,Here,`$2') |
| 124 |
command sprintf("\rput{%g}(%g,%g){",`$1',crl(M4tmp.x),crl(M4tmp.y)) |
| 125 |
f_box(`$3') at Orig |
| 126 |
command "}%"')') |
| 127 |
define(`crl',`int(`($1)'/scale*1000000)/1000000') |
| 128 |
|
| 129 |
`r_dimen(linespec,offset,label,tic offset,<->,pos) |
| 130 |
dimension_ with rotated text on white background' |
| 131 |
define(`r_dimen', |
| 132 |
`M4tmp: dimension_(`$1',`$2',,,`$4',`$5') |
| 133 |
r_box(rp_ang*rtod_,ifelse(`$6',,M4tmp+vec_(0,`$2'),`$6'),`$3')') |
| 134 |
|
| 135 |
`ctrline(linespec,cycle len) |
| 136 |
Centerline' |
| 137 |
define(`cdashl',0.1*scale) |
| 138 |
define(`cgapl',0.03*scale) |
| 139 |
define(`ctrline',`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1')) |
| 140 |
define(`m4h',ifelse(`$2',,1*scale,`$2'))dnl |
| 141 |
m4xn = int(rp_len/2/(m4h))*2+1 |
| 142 |
for i=1 to m4xn do { |
| 143 |
line to rvec_(rp_len/m4xn/2-cdashl/2-cgapl,0) |
| 144 |
move to rvec_(cgapl,0); line to rvec_(cdashl,0); move to rvec_(cgapl,0) |
| 145 |
line to rvec_(rp_len/m4xn/2-cdashl/2-cgapl,0) } ') |
| 146 |
|
| 147 |
`ctrarcr(pos,radius,startang,endang,len) |
| 148 |
Arc cr centerline' |
| 149 |
define(`ctrarcr',`dnl |
| 150 |
define(`m5h',ifelse(`$5',,1*scale,`$5'))dnl |
| 151 |
rp_len = abs((`$2')*(`$4'-(`$3'))) |
| 152 |
m5n = int(rp_len/2/(m5h))*2+1 |
| 153 |
m5a = (rp_len/m5n/2-cdashl/2-cgapl)/(`$2') |
| 154 |
m5s = cdashl/(`$2') |
| 155 |
m5sa = `$3' |
| 156 |
for m4irr=1 to m5n do { |
| 157 |
arc from `$1'+(rect_(`$2',m5sa)) to `$1'+(rect_(`$2',m5sa+m5a)) \ |
| 158 |
with .c at `$1' |
| 159 |
m5sa = m5sa+m5a+cgapl/(`$2') |
| 160 |
arc from `$1'+(rect_(`$2',m5sa)) to `$1'+(rect_(`$2',m5sa+m5s)) \ |
| 161 |
with .c at `$1' |
| 162 |
m5sa = m5sa+m5s+cgapl/(`$2') |
| 163 |
arc from `$1'+(rect_(`$2',m5sa)) to `$1'+(rect_(`$2',m5sa+m5a)) \ |
| 164 |
with .c at `$1' |
| 165 |
m5sa = m5sa+m5a |
| 166 |
} ') |
| 167 |
|
| 168 |
define(`ASME_Y14-5_') |
| 169 |
|
| 170 |
divert(0)dnl |