Rev 16160 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !if $wims_read_parm!=slib_header |
13585 | bpr | 2 | !goto proc |
20 | reyssat | 3 | !endif |
4158 | bpr | 4 | |
4349 | bpr | 5 | slib_author=Gang, XIAO |
4158 | bpr | 6 | |
4909 | bpr | 7 | slib_example=5/br2out,,,acsrc,diode,cap,res,chas\ |
15604 | bpr | 8 | 5/br2out,,,acsrc,diode,cap,res,chas,html\ |
15621 | bpr | 9 | 5/br2out,,,acsrc,diode,cap,res,chas,canvas\ |
10 | 8/br3closeserl,20,black,and,andR,delR,fuseR,_DiodeR,batR,capR,ammeterN\ |
||
11 | 8/br3closeserl,20,black,and,andR,delR,fuseR,_DiodeR,batR,capR,ammeterN,canvas |
||
12 | |||
20 | reyssat | 13 | !exit |
15765 | bpr | 14 | !! U1/electro/oefrc H6/electro/oefohm |
15604 | bpr | 15 | !! not completely compatible with canvas ... |
20 | reyssat | 16 | :proc |
7110 | bpr | 17 | !reset slib_option |
20 | reyssat | 18 | !distribute items $wims_read_parm into slib_type,slib_sf,slib_Color |
19 | slib_c=!char 1 of $slib_type |
||
20 | !if $slib_c isin 123456789 |
||
13585 | bpr | 21 | slib_prefix=data/circuits |
20 | reyssat | 22 | !else |
13585 | bpr | 23 | slib_prefix= |
20 | reyssat | 24 | !endif |
25 | slib_out= |
||
26 | !default slib_Color=black |
||
27 | slib_comp=!item 4 to -1 of $wims_read_parm |
||
15582 | bpr | 28 | !if html iswordof $(slib_comp[-1]) |
4909 | bpr | 29 | slib_option=html |
15582 | bpr | 30 | slib_comp=$(slib_comp[1..-2]) |
4909 | bpr | 31 | !endif |
15604 | bpr | 32 | !if canvas isitemof $(slib_comp[-1]) |
33 | slib_option=canvas |
||
34 | slib_comp=$(slib_comp[1..-2]) |
||
35 | !endif |
||
20 | reyssat | 36 | |
37 | !bound slib_sf between integer 5 and 100 default 20 |
||
38 | slib_rec=$slib_prefix/$slib_type.data |
||
39 | slib_wiring=!record 4 of $slib_rec |
||
40 | slib_dots=!record 5 of $slib_rec |
||
41 | slib_test=!record 3 of $slib_rec |
||
42 | !if $slib_test= |
||
13585 | bpr | 43 | !exit |
20 | reyssat | 44 | !endif |
45 | slib_range=!record 2 of $slib_rec |
||
46 | |||
47 | slib_lwid=1 |
||
48 | !if $slib_sf>20 |
||
49 | !advance slib_lwid |
||
13585 | bpr | 50 | !if $slib_sf>30 |
51 | !advance slib_lwid |
||
52 | !endif |
||
20 | reyssat | 53 | !endif |
54 | slib_dwid=$[floor(4+$slib_sf/4)] |
||
55 | slib_textsize=medium |
||
56 | !if $slib_sf>15 |
||
13585 | bpr | 57 | !if $slib_sf>20 |
58 | slib_textsize=huge |
||
20 | reyssat | 59 | !else |
13585 | bpr | 60 | slib_textsize=large |
20 | reyssat | 61 | !endif |
13585 | bpr | 62 | !else |
63 | !if $slib_sf<12 |
||
64 | !if $slib_sf<5 |
||
65 | slib_textsize=tiny |
||
66 | !else |
||
67 | slib_textsize=small |
||
68 | !endif |
||
69 | !endif |
||
20 | reyssat | 70 | !endif |
71 | |||
72 | slib_wiring=!replace internal _dot_ by $slib_dwid in $slib_wiring |
||
73 | |||
74 | !if $slib_comp!= |
||
13585 | bpr | 75 | !read slib/circuits/drawcomp $slib_type,$slib_dwid,$slib_Color,$slib_textsize,$slib_comp |
20 | reyssat | 76 | !endif |
15582 | bpr | 77 | insdraw_size=$[$slib_sf*$(slib_range[1])],$[$slib_sf*$(slib_range[2])] |
20 | reyssat | 78 | |
79 | slib_out=!replace internal _color_ by $slib_Color in \ |
||
15582 | bpr | 80 | size $insdraw_size\ |
20 | reyssat | 81 | xrange 0,$(slib_range[1])\ |
82 | yrange 0,$(slib_range[2])\ |
||
15582 | bpr | 83 | transparent 255,255,255\ |
20 | reyssat | 84 | linewidth $[rint(0.8*$slib_dwid)]\ |
85 | points _color_,$slib_dots\ |
||
86 | linewidth $slib_lwid\ |
||
87 | $slib_wiring\ |
||
88 | $slib_out |
||
89 | |||
4909 | bpr | 90 | !if url isitemof $slib_option or html isitemof $slib_option |
91 | !insdraw $slib_out |
||
92 | slib_out=$ins_url |
||
93 | !if html iswordof $slib_option |
||
17173 | bpr | 94 | slib_out=<img src="$ins_url" alt=""> |
13585 | bpr | 95 | !else |
4909 | bpr | 96 | slib_out=$slib_out,$insdraw_size |
13585 | bpr | 97 | !endif |
7110 | bpr | 98 | !endif |
15604 | bpr | 99 | !if canvas isitemof $slib_option |
100 | slib_out=!exec canvasdraw $slib_out |
||
101 | !endif |