summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/ex02.m4
blob: 2265c1e3170d22b87788c9a26cdae94bf5f32986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.PS
# ex02.m4
cct_init
linewid = linewid*4/5

[
  [ 
  for angl=0 to 315 by 45 do {
     Point_(angl)
     opamp(to rvec_(linewid*3/2,0)) with .Out at (0,0) }
     ]
 resistor(down_ dimen_ from last [].s)
 diode(down_ dimen_*2/3,LE) 
 diode(down_ dimen_*2/3,LER) 
 ground(,T)
]

[
 define(`elen_',`dimen_*3/2')          # restore defaults
 define(`sourcerad_',`dimen_*0.25')
 leng = elen_
 define(`fromcentre',`move to C+(-elen_/2,-elen_*cosd(15)/(2*sind(15)))')
 C: dot
  { fromcentre()
     for i = 0 to 359 by 30 do {
        Point_(i); inductor 
        }
     }
  define(`elen_',leng*0.8)
  { fromcentre()
     for i=0 to 359 by 30 do {
        Point_(i); inductor(,W) 
        }
     }
  define(`elen_',leng*0.6)
  { fromcentre()
     for i=0 to 359 by 30 do {
        Point_(i); resistor 
        }
     }
  define(`elen_',leng*0.4)
  { fromcentre()
     for i=0 to 359 by 30 do {
        Point_(i); capacitor(,C)
        }
     }
  define(`elen_',leng*0.2)
  { fromcentre()
     for i=0 to 359 by 30 do {
        Point_(i); diode 
        }
     }
  ] with .sw at last [].se+(linewid,0)

.PE