Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/dpv/PlateDPV.m4

raw
1 .PS
2 # ASME_Y14-5.m4
3 # https://en.wikipedia.org/wiki/Geometric_dimensioning_and_tolerancing
4 # See the ASME Y14.5 standard, Figure 6-30.
5 scale = 100/3
6 cct_init
7 include(../ASME_Y14-5.m4def)
8 ifsvg(`svg_font(sans-serif,9.5bp__)',
9 `textht = 10bp__*2/3
10 iflatex(`command "{\sf"')')
11 # ASME Y14.5 specs:
12 arrowht = textht*0.8
13 arrowwid = textht*0.6
14 maxpswid = 12
15
16 # Diameters
17 d1 = (20.13+20.00)/2
18 d2 = 31.7
19 d3 = 36
20 d4 = (40.60+40.45)/2
21 d5 = 57
22 d6 = 86
23 d7 = 100
24 d8 = 8.0
25 adj = 1.5
26
27 Section: [
28 Orig: (0,0)
29 T0: (0,-d7/2)
30 T1: (6,-d5/2)
31 T2: (15.5,-d3/2)
32 T3: (22,-d3/2-adj)
33 T4: (32,-d2/2)
34 T5: (41.3,0)
35 T6: (9.5,-d4/2)
36 # for_(0,5,1,`"m4x" at T`'m4x')
37 # Hatching
38 H: hatchbox(invis ht d7 wid 41.3,2,thick 0.4,-45) with .w at Orig
39 box invis fill_(1) wid T5.x-T1.x ht T1.y-H.s.y with .se at H.se
40 box same with .ne at H.ne
41 box invis fill_(1) wid T3.x-T2.x ht T2.y-T1.y with .nw at T2
42 box same with .sw at (T2.x,-T2.y)
43 box invis fill_(1) wid T4.x-T3.x ht T3.y-T1.y with .nw at T3
44 box same with .sw at (T3.x,-T3.y)
45 box invis fill_(1) wid T5.x-T4.x ht T4.y-T1.y with .nw at T4
46 box same with .sw at (T4.x,-T4.y)
47 # Section outline lower
48 line from (0,-d4/2) to T0 then right T1.x-T0.x then up 1
49 arcto(T1,(T2,T1),1)
50 line to (T2,T1) then up 1
51 arcto(T2,(T3,T2),1)
52 arcto((T3,T2),T3,0.5)
53 arcto(T3,(T4,T3),0.5)
54 arcto((T4,T3),T4,1)
55 arcto(T4,(T5,T4),1)
56 line to (T5,T4) then to (T5.x,-T4.y) then left 1
57 # Section outline upper
58 line from (0,d4/2) to (0,-T0.y) then right T1.x-T0.x then down 1
59 arcto((T1.x,-T1.y),(T2.x,-T1.y),1)
60 line to (T2.x,-T1.y) then down 1
61 arcto((T2.x,-T2.y),(T3.x,-T2.y),1)
62 arcto((T3.x,-T2.y),(T3.x,-T3.y),0.5)
63 arcto((T3.x,-T3.y),(T4.x,-T3.y),0.5)
64 arcto((T4.x,-T3.y),(T4.x,-T4.y),1)
65 arcto((T4.x,-T4.y),(T5.x,-T4.y),1)
66 line to (T5.x,-T4.y)
67
68 box wid 6 ht d8 fill_(1) with .w at (0,d6/2)
69 box wid 6 ht d8 fill_(1) with .w at (0,-d6/2)
70 box invis wid T6.x ht d4 fill_(1) with .w at Orig
71 box wid T5.x-T6.x ht d1 fill_(1) with .e at T5
72
73 line from (Orig.x,-T6.y) to (Orig.x,T6.y)
74 arcto(T6,(T6,Orig),1)
75 arcto((T6.x,-T6.y),(0,-T6.y),1)
76 line to (0,-T6.y)
77
78 define(`dialabel',
79 `[tmpthick = linethick; linethick_(1)
80 [Y14_dia_]; [$1 wid ifelse(`$2',,textht,`$2')] with .w at last [].e+(0.5,0)
81 linethick_(tmpthick)]')
82
83 thinlines_
84 dimension_(from (0,T6.y) to (0,-T6.y),40,dialabel("40.60" "40.45",12),textht*3)
85 line up 4 from AE_dimen_.end
86 Y14_frame(Y14_per_,Y14_dia_;"0";"(M)","A") with .sw at Here
87 Y14_frame("B") with .s at last [].n+(0,6)
88 thicklines_(1)
89 datumarrow(from last [].s to 2nd last [].n)
90 thinlines_
91 dimension_(from T2 to (T2.x,-T2.y),30,
92 dialabel("35.5" "36.0",12),textht*3)
93 dimension_(from T0 to T0+(T1.x,0),-8," 6.1 " " 5.9 ",textht)
94 dimension_(from S_dimen_.end to S_dimen_.end+(T2.x,0),-9,
95 "15.4" "15.6",textht*4)
96 line from E_dimen_.start to (T2,T1) chop 0 chop 1
97 dimension_(from S_dimen_.end to S_dimen_.end+(T3.x,0),-9,
98 "21.9" "22.1",textht*4)
99 line from E_dimen_.start to T3 chop 0 chop 1
100 dimension_(from S_dimen_.end to S_dimen_.end+(T4.x,0),-9,
101 "31.9" "32.1",textht*4)
102 line from E_dimen_.start to (T4,T3) chop 0 chop 1
103 dimension_(from S_dimen_.end to S_dimen_.end+(T5.x,0),-9,
104 "41.2" "41.4",textht*4)
105 line from E_dimen_.start to (T5,T4) chop 0 chop 1
106 line from S_dimen_.start to T0 chop 0 chop 1
107 dimension_(from (0,d7/2) right T6.x,8,"9.6" "9.4",3*textht)
108 line from E_dimen_.start to (T6.x,d4/2) chop 0 chop 1
109 ctrline(from (-3,0) to T5+(3,0),T5.x/2)
110 ctrline(from (-3,d6/2) right T1.x+6)
111 ctrline(from (-3,-d6/2) right T1.x+6)
112 dimension_(from T5-(0,d1/2) to T5+(0,d1/2),-14,
113 dialabel("20.13" "20.00",4*textht),textht*3)
114 dimension_(from T5-(0,d2/2) to T5+(0,d2/2),-35,
115 dialabel("31.8" "31.6",3*textht),textht*3)
116 arrow <- from (T5.x+6,d1/2) by (Rect_(20,75)) then right 6
117 Y14_frame(Y14_cir_,"0.06" wid 3*textht,"A","B") with .w at Here
118 Y14_frame("C") with .n at last [].se+(-6,-8)
119 thicklines_(1)
120 datumarrow(from last [].n up 8)
121 thinlines_
122 arrow <- from (T5.x+6,-d2/2) by (Rect_(10,-75)) then right 4
123 Y14_frame(Y14_cir_,"0.1" wid textht*2,"C") with .w at Here
124 arrow <- from ((T3.x+T4.x)/2,d3/2+adj) by (Rect_(30,75)) then right 4
125 "M42 X 1.5 - 6g" wid 9*textht ljust
126 Y14_frame(Y14_pos_,Y14_dia_;"0.1" wid textht*2;"(M)","C";"(M)") \
127 with .nw at last "".sw+(0,-2)
128 line from (T2.x,-T1.y) up 25 chop 1 chop 0
129 Y14_frame(Y14_par_,"0.06" wid 3*textht,"A") with .sw at Here
130 Y14_frame(Y14_sur_," 0.1 " wid 3*textht,"A") with .sw at last [].nw
131 arrow <- from (0,-d6/2+10) left 13
132 Y14_frame(Y14_fla_,"0.02" wid 4*textht) with .e at Here
133 Y14_frame("A") with .n at last [].s+(0,-6)
134 datumarrow(from last [].n up 6)
135 ]
136
137 Topview:[
138 C: circle diam d7
139 for i=0 to 7 do { circle diam d8 at C+(Rect_(d6/2,i/8*360)) }
140 C5: circle diam d5 at C
141 C4: circle diam d3+2*adj at C
142 C3: circle dashed diam d3 at C
143 C2: circle diam d2 at C
144 C1: circle diam d1 at C
145
146 thinlines_
147 dimension_(from C.w-(0,10) to C.e-(0,10),-C.rad-15,
148 dialabel("100" "99",textht*3),textht*5)
149 dimension_(from C5.w-(0,5) to C5.e-(0,5),-C.rad-5,
150 dialabel("57.2" "56.8",textht*4),textht*5)
151 arrow <-> from C+(Rect_(d6/2,-120)) to C+(Rect_(d6/2,60))
152 line from last arrow.end to C+(Rect_(d7/2+6,60)) then right 4
153 dialabel("86.2" "85.8",textht*4) with .w at Here+(1,0)
154 ctrline(from (C.x-(d6-d7/2),C.y) to (C.x+(d6-d7/2),C.y))
155 ctrline(from (C.x,C.y-d6/2+d8/2) to (C.x,C.y+d6/2-d8/2))
156 for_(0,315,45,`ctrarcr(C,d6/2,(m4x-22.5)*dtor_,(m4x+22.5)*dtor_)
157 ctrline(from C+(Rect_(d6-d7/2,m4x)) to C+(Rect_(d7/2,m4x))) ')
158 arcdimension_(from C+(0,d7/2) to C+(Rect_(d7/2,135)) with .c at C,
159 8,"8X 45`'iflatex($^\circ$)" wid textht*3.5,15,1)
160 ifsvg("svg_deg" wid textht*2/3 with .w at last "".e)
161 move to C+(0,d6/2)
162 arrow <- from Here+(Rect_(8/2,75)) to Here+(Rect_(25,75)) then right_ 3
163 "8X" wid 2*textht ljust
164 linethick_(1); [Y14_dia_] with .w at last "".e+(1,0)
165 "7.9 - 8.1" wid 8*textht ljust
166 Y14_frame(Y14_pos_,Y14_dia_;"0.14" wid 3*textht;"(M)","A","C") \
167 with .nw at 2nd last "".sw+(0,-2)
168
169 ] with .C at Section.Orig+(4.5*scale,0)
170
171
172 command iflatex(`"}"',ifsvg(`"</g>"'))
173 .PE