Debian Codegraph @

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

raw
1 .PS
2 # This is the source for a prototype svg library of electric circuit
3 # elements. Each element is a compound svg object with corners on grid points.
4 #
5 # Processing svg.m4 and this file thought dpic -v gives
6 # output that can be read into Inkscape.
7 #
8 define(`SIdefaults',`
9 scale = 25.4
10 arcrad = 5
11 arrowht = 2.5
12 arrowwid = arrowht/2
13 boxht = 12
14 boxrad = 0
15 boxwid = 20
16 circlerad = 5
17 dashwid = 1.5
18 ellipseht = 12
19 ellipsewid = 16
20 lineht = 12
21 linewid = 12
22 moveht = 12
23 movewid = 12
24 textht = ifsvg(3,0)
25 textoffset = 1
26 textwid = 0
27 ')
28
29 log_init(svg_font(sans-serif,11bp__))
30 SIdefaults
31
32 # Assume dpic scale is in mm
33 gunit = 1 # Inkscape grid dimension
34 divert(-1)
35 define(`elen_',`(10*gunit)') # default 2-terminal element length
36 define(`dimen_',`(10*gunit)')# reference dimension for element bodies
37 define(`L_unit',`(2*gunit)') # logic gate grid size
38 define(`N_diam',1) # L_unit size of `not' circles
39
40 # grid round and chop
41 define(`g_round',`(int((`$1')/gunit+100000.5 )-100000)*gunit')
42 define(`g_chop', `(int((`$1')/gunit+100000.9999)-100000)*gunit')
43 # snap to grid
44 define(`g_snap',`(g_round((`$1').x),g_round((`$1').y))')
45
46 # Box containing an element. The element must be in a box that is
47 # intersected by a horizontal or vertical line from entry to exit.
48 define(`Gridbox',`[ command "<g>"
49 S: Here; `$1'; F: Here
50 if S.y == F.y then {
51 move from (max(S.x,F.x),F.y+g_chop(last[].n.y-F.y)) \
52 to (min(S.x,F.x),F.y-g_chop(F.y-last[].s.y)) } \
53 else {
54 move from (F.x+g_chop(last[].e.x-F.x),max(S.y,F.y)) \
55 to (F.x-g_chop(F.x-last[].w.x),min(S.y,F.y)) }
56 command "</g>" ] ')
57
58 # Place compound object corners at grid intersections
59 define(`Below',
60 `with .n at g_snap(ifelse(`$1',,`last []',`$1').s) \
61 - (0,ifelse(`$2',,1,`$2')*gunit)')
62 define(`Right',
63 `with .w at g_snap(ifelse(`$1',,`last []',`$1').e)+(2*gunit,0)')
64
65 # for debug
66 define(`prpos',`print (`$1').x/gunit,(`$1').y/gunit')
67 divert(0)dnl
68
69 [
70
71 rpoint_(down_ elen_)
72 A:Gridbox( resistor )
73 Gridbox( resistor(down_ dimen_*1/2) ) Right
74 Gridbox( resistor(,,E) ) Right
75 Gridbox( resistor(,,Q) ) Right
76 Gridbox( resistor(,,H) ) Right
77 Gridbox( resistor(,,N) ) Right
78 Gridbox( inductor(,W) ) Right
79 Gridbox( inductor(,W,,M) ) Right
80 Gridbox( inductor(,L) ) Right
81 Gridbox( inductor ) Right
82 Gridbox( inductor(,,,M) ) Right
83 Gridbox( capacitor ) Right
84 Gridbox( capacitor(,C) ) Right
85 Gridbox( capacitor(,P) ) Right
86 Gridbox( capacitor(,E) ) Right
87 Gridbox( capacitor(,K) ) Right
88 Gridbox( diode ) Right
89 Gridbox( diode(,K) ) Right
90 Gridbox( diode(,Z) ) Right
91 Gridbox( diode(,S) ) Right
92 Gridbox( diode(,L) ) Right
93 Gridbox( diode(,V) ) Right
94 Gridbox( diode(,v) ) Right
95 Gridbox( diode(,T) ) Right
96 Gridbox( diode(,CR) ) Right
97 Gridbox( diode(,D) ) Right
98 Gridbox( diode(,B) ) Right
99 Gridbox( diode(,LE) ) Right
100 Gridbox( [circle diam dimen_*0.7] ) Right
101 Gridbox( xtal ) Right
102 dot(at g_snap(last [].e+(2*gunit,0)))
103
104 A:Gridbox( source ) Below(A)
105 Gridbox( source(,I) ) Right
106 Gridbox( source(,i) ) Right
107 Gridbox( source(,V) ) Right
108 Gridbox( source(,v) ) Right
109 Gridbox( source(,AC) ) Right
110 Gridbox( source(,S) ) Right
111 Gridbox( source(,X) ) Right
112 Gridbox( source(,F) ) Right
113 Gridbox( source(,P) ) Right
114 Gridbox( source(,U) ) Right
115 Gridbox( source(,R) ) Right
116 Gridbox( source(,T) ) Right
117 Gridbox( source(,L) ) Right
118 Gridbox( nullator ) Right
119 Gridbox( norator ) Right
120 Gridbox( consource ) Right
121 Gridbox( consource(,I) ) Right
122 Gridbox( consource(,i) ) Right
123 Gridbox( consource(,V) ) Right
124 Gridbox( consource(,v) ) Right
125 Gridbox( source(,Q) ) Right
126 Gridbox( source(,G) ) Right
127
128 A:Gridbox( battery(up_ elen_) ) Below(A)
129 Gridbox( battery(up_ elen_,3) ) Right
130 Gridbox( ttmotor ) Right
131 Gridbox( memristor ) Right
132 Gridbox( tline ) Right
133 Gridbox( fuse ) Right
134 Gridbox( fuse(,D) ) Right
135 Gridbox( fuse(,B) ) Right
136 Gridbox( fuse(,C) ) Right
137 Gridbox( fuse(,S) ) Right
138 Gridbox( fuse(,HB) ) Right
139 Gridbox( fuse(,HC) ) Right
140 Gridbox( cbreaker ) Right
141 Gridbox( cbreaker(,,D) ) Right
142 Gridbox([variable(`[]',A)]) Right
143 Gridbox([variable(`[]',P)]) Right
144 Gridbox([variable(`[]',L)]) Right
145 Gridbox([variable(`[]',N)]) Right
146 Gridbox([variable(`[]',uN)]) Right
147 Gridbox([line to Here+(Rect_(dimen_/6,45))]) Right
148 Gridbox([line up dimen_*0.06 then right dimen_*0.12 \
149 then up dimen_*0.06]) Right
150 Gridbox([em_arrows]) Right
151 Gridbox([em_arrows(N)]) Right
152 Gridbox([em_arrows(ND)]) Right
153 Gridbox([em_arrows(I)]) Right
154 Gridbox([em_arrows(ID)]) Right
155 Gridbox([em_arrows(E)]) Right
156 Gridbox([em_arrows(ED)]) Right
157
158 A:Gridbox( [right_; ground] ) Below(A)
159 Gridbox( [right_; ground(,T)] ) Right
160 Gridbox( [right_; ground(,,F)] ) Right
161 Gridbox( [right_; ground(,,E)] ) Right
162 Gridbox( [right_; ground(,,S)] ) Right
163 Gridbox( [right_; ground(,,L)] ) Right
164 Gridbox( [right_; ground(,,P)] ) Right
165 Gridbox( transformer(right_ 6*gunit,L) ) Right
166 Gridbox( transformer(right_ 8*gunit,,2,8) ) Right
167 Gridbox( transformer(,,8,W,4) ) Right
168 Gridbox( transformer(,,9,AL) ) Right
169 Gridbox( transformer(,R,8,AW) ) Right
170
171 rpoint_(right_)
172 A:Gridbox( switch ) Below(A)
173 Gridbox( switch(,,O) ) Right
174 Gridbox( switch(,,D) ) Right
175 Gridbox( switch(,,OD) ) Right
176 Gridbox( switch(,,C) ) Right
177 Gridbox( switch(,,B) ) Right
178 Gridbox( switch(,C,B) ) Right
179 Gridbox( dswitch ) Right
180 Gridbox( dswitch(,,WBK) ) Right
181 Gridbox( dswitch(,,WBuD) ) Right
182 Gridbox( dswitch(,,WBF) ) Right
183 Gridbox( dswitch(,,WBKF) ) Right
184 Gridbox( dswitch(,,WBL) ) Right
185 Gridbox( dswitch(,,WBKL) ) Right
186
187 A:Gridbox( dswitch(,,WBT) ) Below(A,3)
188 Gridbox( dswitch(,,WdBKC) ) Right
189 Gridbox( dswitch(,,WBM) ) Right
190 Gridbox( dswitch(,,WBCO) ) Right
191 Gridbox( dswitch(,,WBCMP) ) Right
192 Gridbox( dswitch(,,WBCY) ) Right
193 Gridbox( dswitch(,,WBCZ) ) Right
194 Gridbox( dswitch(,,WBCE) ) Right
195 Gridbox( dswitch(,,WBRH) ) Right
196 Gridbox( dswitch(,,WBRdH) ) Right
197 Gridbox( dswitch(,,WBRHH) ) Right
198
199 A:Gridbox( dswitch(,,WBMMR) ) Below(A,6)
200 Gridbox( dswitch(,,WBMM) ) Right
201 Gridbox( dswitch(,,WBMR) ) Right
202 Gridbox( dswitch(,,WBEL) ) Right
203 Gridbox( dswitch(,,WBLE) ) Right
204 Gridbox( dswitch(,,WBKEL) ) Right
205 Gridbox( antenna ) Right # Below(A)
206 Gridbox( antenna(,,L) ) Right
207 Gridbox( antenna(,,T) ) Right
208 Gridbox( antenna(,,S) ) Right
209 Gridbox( antenna(,,D) ) Right
210 Gridbox( antenna(,,P) ) Right
211 Gridbox( antenna(,,F) ) Right
212
213 A:Gridbox( amp(right_ elen_*10/8) ) Below(A)
214 Gridbox( integrator ) Right
215 Gridbox( delay ) Right
216 Gridbox( opamp ) Right
217 Gridbox( opamp(,,,,T) ) Right
218 Gridbox( amp(,dimen_/2) ) Right
219 Gridbox( integrator(,dimen_/2) ) Right
220 Gridbox( delay(,delay_rad_) ) Right
221 Gridbox( opamp(,,,dimen_*2/3) ) Right
222 Gridbox( opamp(,,,dimen_*2/3,T) ) Right
223
224 right_
225 A:Gridbox( relay(2) ) Below(A)
226 Gridbox( relay(2,O) ) Right
227 Gridbox( relay(2,C) ) Right
228 Gridbox( relay ) Right
229 Gridbox( contact ) Right
230 Gridbox( contact(O) ) Right
231 Gridbox( contact(C) ) Right
232
233 up_
234 A:Gridbox( [circle rad 29/10*gunit] ) Below(A)
235 Gridbox( bi_tr ) Right
236 Gridbox( bi_tr(,R) ) Right
237 Gridbox( bi_tr(,,P) ) Right
238 Gridbox( bi_tr(,R,P) ) Right
239
240 Gridbox( j_fet ) Right
241 Gridbox( j_fet(,R) ) Right
242 Gridbox( j_fet(,,P,) ) Right
243 Gridbox( j_fet(,R,P,) ) Right
244 Gridbox( e_fet(,,,) ) Right
245 Gridbox( e_fet(,R,,) ) Right
246
247 Gridbox( e_fet(,,P,) ) Right
248 Gridbox( e_fet(,R,P,) ) Right
249 Gridbox( d_fet(,,,) ) Right
250 Gridbox( d_fet(,R,,) ) Right
251 Gridbox( d_fet(,,P,) ) Right
252 Gridbox( d_fet(,R,P,) ) Right
253
254 A:Gridbox( igbt ) Below(A)
255 Gridbox( ujt ) Right
256 Gridbox( ujt(,,P) ) Right
257 rpoint_(down_)
258 Gridbox( thyristor ) Right
259 Gridbox( thyristor(,B) ) Right
260 Gridbox( thyristor(,BG) ) Right
261 Gridbox( thyristor(,A) ) Right
262 Gridbox( thyristor(,C) ) Right
263 rpoint_(up_)
264 Gridbox( j_fet ) Right
265 Gridbox( e_fet ) Right
266 Gridbox( e_fet(,,,S) ) Right
267 Gridbox( e_fet(,,P) ) Right
268 Gridbox( e_fet(,,P,S) ) Right
269 Gridbox( d_fet ) Right
270 Gridbox( d_fet(,,,S) ) Right
271 Gridbox( d_fet(,,P,) ) Right
272 Gridbox( d_fet(,,P,S) ) Right
273 Gridbox( j_fet ) Right
274 Gridbox( j_fet(,,P) ) Right
275 Gridbox( mosfet(,,uHSDF) ) Right
276
277 rpoint_(right_)
278 A:Gridbox( tgate ) Below(A,3)
279 Gridbox( tgate(,B) ) Right
280 Gridbox( ptrans ) Right
281
282 A:Gridbox( AND_gate ) Below(A,3)
283 Gridbox( OR_gate ) Right
284 Gridbox( NAND_gate ) Right
285 Gridbox( NOR_gate ) Right
286 Gridbox( XOR_gate ) Right
287 Gridbox( NXOR_gate ) Right
288 Gridbox( BUFFER_gate ) Right
289 Gridbox( NOT_gate ) Right
290
291 # input lines for OR-like gates.
292 define(`OR_inlgth',`(-sqrt(OR_rad^2-G_hht^2)+sqrt(OR_rad^2-`$1'^2))*L_unit')
293
294 Gridbox( [ {move right_ gunit}
295 {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
296 {line right_ OR_inlgth(0)}
297 {line right_ OR_inlgth(2) from Here+svec_(0,2)}
298 {line same from Here-svec_(0,2)}
299 {line right_ OR_inlgth(1) from Here+svec_(0,1)}
300 {line same from Here-svec_(0,1)}] ) Right
301 Gridbox( [ {move right_ gunit}
302 {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
303 {line right_ OR_inlgth(0)}
304 {line right_ OR_inlgth(2) from Here+svec_(0,2)}
305 {line same from Here-svec_(0,2)}] ) Right
306 Gridbox( [ {move right_ gunit}
307 {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
308 {line right_ OR_inlgth(2) from Here+svec_(0,2)}
309 {line same from Here-svec_(0,2)}] ) Right
310 Gridbox( [ {move right_ gunit}
311 {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
312 {line right_ OR_inlgth(0)}] ) Right
313
314 right_
315 A:Gridbox( speaker ) Below(A)
316 Gridbox( speaker(,,H) ) Right
317 Gridbox( bell ) Right
318 Gridbox( microphone ) Right
319 Gridbox( buzzer ) Right
320 Gridbox( buzzer(,,C) ) Right
321 Gridbox( earphone ) Right
322 Gridbox( earphone(,,C) ) Right
323 Gridbox( nport ) Right
324 Gridbox( nterm ) Right
325
326 A:Gridbox( FlipFlop(D) ) Below(A)
327 Gridbox( FlipFlop(T) ) Right
328 Gridbox( FlipFlop(RS)) Right
329 Gridbox( FlipFlop(JK)) Right
330
331 ] with .nw at (0,0)
332
333 #"A draft palette of a few elements for Inkscape using a 1 mm grid" \
334 # ljust below at last [].sw
335
336 command "</g>" # end font
337 .PE