diff options
Diffstat (limited to 'graphics/circuit_macros/examples/dpv')
17 files changed, 456 insertions, 283 deletions
diff --git a/graphics/circuit_macros/examples/dpv/AmpTableDPV.m4 b/graphics/circuit_macros/examples/dpv/AmpTableDPV.m4 index 2850ff5ad7..ab6d34b9e2 100644 --- a/graphics/circuit_macros/examples/dpv/AmpTableDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/AmpTableDPV.m4 @@ -1,25 +1,24 @@ .PS -# `Amptable.m4' +# `AmptableDPV.m4' cct_init(svg_font(sans-serif,11bp__)) textwid = 0.7 movewid = 2pt__ -{ +{ {amp ; move ; "`amp'" ljust} - move down 0.4; right_ - {amp(,0.3) ; move ; "`amp'(,0.3)" ljust} - } move right_ 2.0 -{ {delay ; move ; "`delay'" ljust} - move down 0.4; right_ - {delay(,0.2) ; move ; "`delay'(,0.2)" ljust} - } - + {amp(,5mm__) ; move ; "`amp(,5mm__)'" ljust} move right_ 2.0 -{ {integrator ; move ; "`integrator'" ljust} + {integrator ; move ; "`integrator'" ljust} + } move down 0.5; right_ - {integrator(,0.3) ; move ; "`integrator'(,0.3)" wid 1.2 at Here ljust} - } +{ + {delay(,,fill_(0.9)) ; move ; + "`delay(,,'" ljust "`fill_(0.9))'" ljust} + move right_ 2.0 + {delay(,,type=S;body=shaded rgbstring(0.75,0.75,1)); move + "`delay(,,type=S;" ljust "body=shaded rgbstring(0.75,0.75,1)')" ljust} + } command "</g>" # end font .PE diff --git a/graphics/circuit_macros/examples/dpv/DiniDPV.m4 b/graphics/circuit_macros/examples/dpv/DiniDPV.m4 index 1846917a4a..7d48ca590d 100644 --- a/graphics/circuit_macros/examples/dpv/DiniDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/DiniDPV.m4 @@ -3,9 +3,10 @@ # This diagram can be produced using, e.g. # m4 pdf.m4 Dini.m4 | dpic -d > Dini.pdf +# https://tex.stackexchange.com/questions/516734/plot-dinis-surface threeD_init NeedDpicTools -scale = 1.5 +scale = 2.0 [ viewazimuth = 0 # View angles in degrees viewelevation = 20 @@ -189,5 +190,58 @@ array2(h,m4inx,53,54,55,58,59,57) for_(2,5,1,`to Project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ to Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) } -] scaled 2.5 with .sw at last [].se+(1,0) +] scaled 2.5 with .sw at last [].se+(0.5,0) +[ +#.PE +#.PS +## BlueBall.m4 +## https://latex.org/forum/viewtopic.php?f=5&t=30639 +#threeD_init +#NeedDpicTools + + ballrad = 2.5 + cylrad = ballrad*0.87 + hht =sqrt(ballrad^2-cylrad^2) + azimuth = 0 + elevation = atan2(hht,cylrad) + setview(azimuth,elevation*rtod_) + sinelev = sin(elevation) + + linethick_(1) + C: shadedball(ballrad,,,,(0,1,1)) at (0,0) + Op: C+Project(0,0,hht) + O: C+Project(0,0,-hht) + line dashed from Op+( cylrad,0) down Op.y-O.y + line dashed from Op+(-cylrad,0) down Op.y-O.y + + define(`Normal',`cosd(`$1')*cylrad,sind(`$1')*cylrad,-hht') + define Cylvis { $`'2 = dot3D(Normal($`'1),View3D) } + findroot(Cylvis,5,170,1e-8,rA) + A: Project(Normal(rA)) + B: O+(-(A.x-O.x),A.y-O.y) + aA = atan2(A.y-O.y,(A.x-O.x)*sinelev) + ellipsearc(cylrad*2,cylrad*2*sinelev,aA,-pi_-aA,0,cw) with .C at O + ellipsearc(cylrad*2,cylrad*2*sinelev,-pi_-aA-4*dtor_,aA+4*dtor_,,cw,dashed) \ + with .C at O + ellipsearc(cylrad*2,cylrad*2*sinelev,-aA,pi_+aA,0,cw) with .C at Op + ellipsearc(cylrad*2,cylrad*2*sinelev,pi_+aA+4*dtor_,-aA-4*dtor_,,cw,dashed) \ + with .C at Op + + dot(at C); # "$T$" at last [].w rjust below + dot(at O); # "$O$" at last [].s below + dot(at A); # "$A$" at last [].s ljust below + dot(at B); # "$B$" at last [].s rjust below + dot(at Op); # "$O'$" at last [].n above + Ap: dot(at Op+(A-O)); # "$A'$" at Ap.n ljust above + Bp: dot(at Op+(B-O)); # "$B'$" at Bp.n rjust above + + linethick_(0.4) + line dashed from Ap to A then to O then to Op + line dashed from A to C + line dashed from Bp to B + V: Between_(O,A,0.15) + U: C+Project(0,0,-hht+0.15) + line from U to U+(V-O) then to V + ] with .w at last [].e+(0.5,0) + .PE diff --git a/graphics/circuit_macros/examples/dpv/EVplugsDPV.m4 b/graphics/circuit_macros/examples/dpv/EVplugsDPV.m4 index d3e40c8dd2..50afde5355 100644 --- a/graphics/circuit_macros/examples/dpv/EVplugsDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/EVplugsDPV.m4 @@ -14,7 +14,7 @@ divert(-1) twdth=expr; # tab width thgt=expr; # tab hght thick=expr; # outer line thickness (pt) - inthick=expr; # inner line thickness (pt) + thickin=expr; # inner line thickness (pt) BG=attributes; # shaded gray etc L1=attributes; # L1 attributes ... N=attributes; @@ -23,21 +23,21 @@ divert(-1) CP=attributes; ' define(`pEVskale',25.4) dnl default plug size (20 mm) define(`EV_J1772',`[ pushkeys_(`$1', `wdth:20/pEVskale; - twdth:3.5/20*m4wdth; thgt:1.5/20*m4wdth; diamLNP:6/20*m4wdth; - thick:2; inthick:1.5; BG::N; L1::N; N::N; PE::N; PP::N; CP::N; ') + twdth:3.5/20*m4`'wdth; thgt:1.5/20*m4`'wdth; diamLNP:6/20*m4`'wdth; + thick:2; thickin:1.5; BG::N; L1::N; N::N; PE::N; PP::N; CP::N; ') tang = atan2(m4twdth/2,m4wdth/2)*rtod_ TS: (Rect_(m4wdth/2,-90-tang)); TE: (Rect_(m4wdth/2,-90+tang)) Tab: line thick m4thick from TS down_ m4thgt \ then to TE-(0,m4thgt) then to TE m4BG Arc: arc thick m4thick to TS with .c at (0,0) m4BG round(at TS,last arc.thick); round(at TE,last arc.thick) - L1: circle diam m4diamLNP thick m4inthick at (Rect_(m4wdth/4,150)) m4L1 - N: circle diam m4diamLNP thick m4inthick at (Rect_(m4wdth/4, 30)) m4N - PE: circle diam m4diamLNP thick m4inthick at (0,-m4wdth/4) m4PE - PP: circle diam m4diamLNP*0.55 thick m4inthick at (Rect_(m4wdth/3,210)) m4PP - CP: circle diam m4diamLNP*0.55 thick m4inthick at (Rect_(m4wdth/3,-30)) m4CP + L1: circle diam m4diamLNP thick m4thickin at (Rect_(m4wdth/4,150)) m4L1 + N: circle diam m4diamLNP thick m4thickin at (Rect_(m4wdth/4, 30)) m4N + PE: circle diam m4diamLNP thick m4thickin at (0,-m4wdth/4) m4PE + PP: circle diam m4diamLNP*0.55 thick m4thickin at (Rect_(m4wdth/3,210)) m4PP + CP: circle diam m4diamLNP*0.55 thick m4thickin at (Rect_(m4wdth/3,-30)) m4CP `$2' popdef(`m4CP',`m4PP',`m4PE',`m4N',`m4L1',`m4BG', - `m4wdth',`m4diamLNP',`m4twdth',`m4thgt',`m4thick',`m4inthick') ]') + `m4wdth',`m4diamLNP',`m4twdth',`m4thgt',`m4thick',`m4thickin') ]') `EV_J3068(keys,shade) EV charging plug in a [] block @@ -46,7 +46,7 @@ define(`EV_J1772',`[ pushkeys_(`$1', `wdth:20/pEVskale; twdth=expr; # tab width thgt=expr; # tab hght thick=expr; # outer line thickness (pt) - inthick=expr; # inner line thickness (pt) + thickin=expr; # inner line thickness (pt) BG=attributes; # shaded gray etc L1|L2|L3=attributes; # pin attributes ... N=attributes; @@ -55,7 +55,7 @@ define(`EV_J1772',`[ pushkeys_(`$1', `wdth:20/pEVskale; CP=attributes; arg2= R:G:B background fill color ' define(`EV_J3068',`[ pushkeys_(`$1', - `wdth:25/pEVskale; diamLNP:m4wdth*0.25; thick:2; inthick:1.5; + `wdth:25/pEVskale; diamLNP:m4`'wdth*0.25; thick:2; thickin:1.5; BG::N; L1::N; L2::N; L3::N; N::N; PE::N; PP::N; CP::N; ') C: Here NE: C+(Rect_(m4wdth/2,45)); NW: C+(Rect_(m4wdth/2,135)) @@ -68,14 +68,14 @@ define(`EV_J3068',`[ pushkeys_(`$1', arc thick m4thick to Ac+(0,m4diamLNP/2) with .c at Ac m4BG Top: line thick m4thick to (NW+NE-Ac, Here) m4BG arc thick m4thick to NW with .c at Here+(0,-m4diamLNP/2) m4BG - PE: circle diam m4diamLNP thick m4inthick at C m4PE - PP: circle diam m4diamLNP*0.55 thick m4inthick at C+(Rect_(m4wdth/3,45)) m4PP - CP: circle diam m4diamLNP*0.55 thick m4inthick at C+(Rect_(m4wdth/3,135)) m4CP - L1: circle diam m4diamLNP thick m4inthick at C+(m4wdth*.3,0) m4L1 - L2: circle diam m4diamLNP thick m4inthick at C+(Rect_(m4wdth*.3,-60)) m4L2 - L3: circle diam m4diamLNP thick m4inthick at C+(Rect_(m4wdth*.3,-120)) m4L3 - N: circle diam m4diamLNP thick m4inthick at C-(m4wdth*.3,0) m4N - `$3' popdef(`m4wdth',`m4diamLNP',`m4thick',`m4inthick', + PE: circle diam m4diamLNP thick m4thickin at C m4PE + PP: circle diam m4diamLNP*0.55 thick m4thickin at C+(Rect_(m4wdth/3,45)) m4PP + CP: circle diam m4diamLNP*0.55 thick m4thickin at C+(Rect_(m4wdth/3,135)) m4CP + L1: circle diam m4diamLNP thick m4thickin at C+(m4wdth*.3,0) m4L1 + L2: circle diam m4diamLNP thick m4thickin at C+(Rect_(m4wdth*.3,-60)) m4L2 + L3: circle diam m4diamLNP thick m4thickin at C+(Rect_(m4wdth*.3,-120)) m4L3 + N: circle diam m4diamLNP thick m4thickin at C-(m4wdth*.3,0) m4N + `$3' popdef(`m4wdth',`m4diamLNP',`m4thick',`m4thickin', `m4BG',`m4L1',`m4L2',`m4L3',`m4N',`m4PE',`m4PP',`m4CP') ]') `EV_CCS1(J1772 keys,DC keys) @@ -84,20 +84,20 @@ define(`EV_J3068',`[ pushkeys_(`$1', diamPM=expr; # diam of DC+, DC- circles sep=expr; # separation of Jack and DC thick=expr; # outer line thickness (pt) - inthick=expr; # inner line thickness (pt) + thickin=expr; # inner line thickness (pt) BG=attributes; # shaded gray etc DCplus=attributes; DCminus=attributes; ' define(`EV_CCS1',`[ J: EV_J1772(`$1') - pushkeys_(`$2',`wdth:J.wid:23.5/20; hght:J.wid*11/20; diamPM:m4hght*7/11; - sep:J.wid*3/30; thick:J.Arc.thick; inthick:J.PE.thick; + pushkeys_(`$2',`wdth:J.wid:23.5/20; hght:J.wid*11/20; diamPM:m4`'hght*7/11; + sep:J.wid*3/30; thick:J.Arc.thick; thickin:J.PE.thick; BG::N; DCplus::N; DCminus::N;') DC: [ Box: box thick m4thick wid m4wdth ht m4hght rad m4hght/2 m4BG - DCplus: circle thick m4inthick diam m4diamPM at Box.w+(m4hght/2,0) m4DCplus - DCminus:circle thick m4inthick diam m4diamPM at Box.e-(m4hght/2,0) m4DCminus + DCplus: circle thick m4thickin diam m4diamPM at Box.w+(m4hght/2,0) m4DCplus + DCminus:circle thick m4thickin diam m4diamPM at Box.e-(m4hght/2,0) m4DCminus ] with .n at J.s+(0,-m4sep) - popdef(`m4wdth',`m4hght',`m4diamPM',`m4sep',`m4thick',`m4inthick',`m4BG', + popdef(`m4wdth',`m4hght',`m4diamPM',`m4sep',`m4thick',`m4thickin',`m4BG', `m4DCplus',`m4DCminus') ]') @@ -107,22 +107,22 @@ define(`EV_CCS1',`[ diamPM=expr; # diam of DC+, DC- circles sep=expr; # separation of Jack and DC thick=expr; # outer line thickness (pt) - inthick=expr; # inner line thickness (pt) + thickin=expr; # inner line thickness (pt) BG=attributes; # shaded gray etc DCplus=attributes; DCminus=attributes; arg2= R:G:B background fill color ' define(`EV_CCS2',`[ J: EV_J3068(`$1',`$2') - pushkeys_(`$3',`wdth:J.wid:23.5/20; hght:J.wid*11/20; diamPM:m4hght*7/11; - sep:J.wid*3/30; thick:J.Arc.thick; inthick:J.PE.thick; + pushkeys_(`$3',`wdth:J.wid:23.5/20; hght:J.wid*11/20; diamPM:m4`'hght*7/11; + sep:J.wid*3/30; thick:J.Arc.thick; thickin:J.PE.thick; BG::N; DCplus::N; DCminus::N;') DC: [ Box: box thick m4thick wid m4wdth ht m4hght rad m4hght/2 dnl m4BG ifelse(`$2',,,`shaded rgbstring(patsubst(`$2',:,`,'))') - DCplus: circle thick m4inthick diam m4diamPM at Box.w+(m4hght/2,0) m4DCplus - DCminus:circle thick m4inthick diam m4diamPM at Box.e-(m4hght/2,0) m4DCminus + DCplus: circle thick m4thickin diam m4diamPM at Box.w+(m4hght/2,0) m4DCplus + DCminus:circle thick m4thickin diam m4diamPM at Box.e-(m4hght/2,0) m4DCminus ] with .n at J.s+(0,-m4sep) - popdef(`m4wdth',`m4hght',`m4diamPM',`m4sep',`m4thick',`m4inthick',`m4BG', + popdef(`m4wdth',`m4hght',`m4diamPM',`m4sep',`m4thick',`m4thickin',`m4BG', `m4DCplus',`m4DCminus') ]') @@ -130,12 +130,12 @@ define(`EV_CCS2',`[ EV charging plug in a [] block keys: wdth=expr; # plug width thick=expr; # outer line thickness (pt) - inthick=expr; # inner line thickness (pt) + thickin=expr; # inner line thickness (pt) BG=attributes; # background shaded gray etc DCplus=|DCminusNS=|FG=|NC=|SS1=|DCP=|PP=| CL=|CH=|SS2=attributes # pin attributes ...' define(`EV_CHAdeMO',`[ pushdef(`m4sk',33/140/pEVskale) pushkeys_(`$1', - `wdth:140*m4sk; thick:m4wdth*9/140/(1bp__); inthick:m4thick*1.5/9; + `wdth:140*m4sk; thick:m4`'wdth*9/140/(1bp__); thickin:m4`'thick*1.5/9; BG::N; DCplus::N; DCminus::N;N::N;S::N; FG::N; NC::N; SS1::N; DCP::N; PP::N; CL::N; CH::N; SS2::N') C: circle thick m4thick diam m4wdth-m4thick bp__ m4BG @@ -144,18 +144,18 @@ define(`EV_CHAdeMO',`[ pushdef(`m4sk',33/140/pEVskale) pushkeys_(`$1', line thick m4thick*0.6 from C+(Rect_(C.rad+m4thick bp__*3/4,138)) \ to C+(Rect_(C.rad+m4thick bp__*3/4,130)) then right m4thick bp__ m4BG idiam = (m4wdth-m4thick bp__*2)*47/(27+47*2) - N: circle diam idiam thick m4inthick with .n at C.n-(0,m4thick bp__/2) m4N - S: circle diam idiam thick m4inthick with .s at C.s+(0,m4thick bp__/2) m4S - E: circle diam idiam thick m4inthick at Cintersect(N,N.diam,S,S.diam) m4DCminus - W: circle diam idiam thick m4inthick at Cintersect(S,S.diam,N,N.diam) m4DCplus + N: circle diam idiam thick m4thickin with .n at C.n-(0,m4thick bp__/2) m4N + S: circle diam idiam thick m4thickin with .s at C.s+(0,m4thick bp__/2) m4S + E: circle diam idiam thick m4thickin at Cintersect(N,N.diam,S,S.diam) m4DCminus + W: circle diam idiam thick m4thickin at Cintersect(S,S.diam,N,N.diam) m4DCplus foreach_(`Z', - `line thick m4inthick up Z.diam*0.6 right Z.diam*0.6 with .c at Z - line thick m4inthick up Z.diam*0.6 left Z.diam*0.6 with .c at Z',N,S) + `line thick m4thickin up Z.diam*0.6 right Z.diam*0.6 with .c at Z + line thick m4thickin up Z.diam*0.6 left Z.diam*0.6 with .c at Z',N,S) foreach_(`L',`L: circle diam idiam/4 thick linethick/2 \ at N+(Rect_(idiam/4,90*m4Lx)) m4xpand(m4`'L)',FG,NC,DCP,SS1) foreach_(`L',`L: circle diam idiam/4 thick linethick/2 \ at S+(Rect_(idiam/4,90*m4Lx)) m4xpand(m4`'L)',PP,CL,SS2,CH) - `$3' popdef(`m4sk',`m4wdth',`m4thick',`m4inthick',`m4BG', + `$3' popdef(`m4sk',`m4wdth',`m4thick',`m4thickin',`m4BG', `m4DCplus',`m4DCminus',`m4N',`m4S', `m4FG',`m4NC',`m4SS1',`m4DCP',`m4PP',`m4CL',`m4CH',`m4SS2') ]') @@ -173,7 +173,7 @@ define(`EV_CHAdeMO',`[ pushdef(`m4sk',33/140/pEVskale) pushkeys_(`$1', Gndinner=attributes; PP=attributes; CP=attributes; ' -define(`EV_NAC',`[ pushkeys_(`$1', `wdth:1.6; diamL:m4wdth*0.28; BG::N; +define(`EV_NAC',`[ pushkeys_(`$1', `wdth:1.6; diamL:m4`'wdth*0.28; BG::N; L1::N; L1inner::N; L2::N; L2inner::N; Gndinner::N; inner::N; Gnd::N; PP::N; CP::N; ') sN = 1/pEVskale*m4wdth/1.6 # drawing coord scale factor diff --git a/graphics/circuit_macros/examples/dpv/GeometryDPV.m4 b/graphics/circuit_macros/examples/dpv/GeometryDPV.m4 index 18e0cb2fcd..eb87bd8f45 100644 --- a/graphics/circuit_macros/examples/dpv/GeometryDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/GeometryDPV.m4 @@ -145,7 +145,7 @@ Fig4: [ ls = 2/3 # local scale Y: LCintersect(HZ,CC4,C4.rad,R); "Y" at Y above X: LCintersect(HZ,CC2,C2.rad); "X" at X above rjust - Loopover_(`P',`dot(at P)',X,Y,Z) + foreach_(`P',`dot(at P)',X,Y,Z) line dashed from X to Y chop -linewid/2 RightAngle(A,Z,Y) diff --git a/graphics/circuit_macros/examples/dpv/Makefile b/graphics/circuit_macros/examples/dpv/Makefile index 30cd004402..f9e04756c7 100644 --- a/graphics/circuit_macros/examples/dpv/Makefile +++ b/graphics/circuit_macros/examples/dpv/Makefile @@ -4,9 +4,9 @@ LIBDIR = $$HOME/lib M4LIBS = svg.m4 DPVconfig.m4 M4LIBS = svg.m4 M4 = m4 -# PDFCONVERT = pdf2svg +PDFCONVERT = pdf2svg # The current dvisvgm outputs CRLF line endings -PDFCONVERT = dvisvgm +# PDFCONVERT = dvisvgm # To process a single file, copy it to test.m4 and type "make tst" # to produce tstDPV.html @@ -17,6 +17,10 @@ DPIC = dpic #DPIC = ../dpic/bison/dpic #DPIC = ../dpic/bi*dev/dpic +# Quiet mode for MiKTeX or texlive +# QLATEX = latex --quiet +QLATEX = latex -interaction=batchmode + # To test the Windows executable. Change these as needed for the operating # system. NOTE: cscDPV.m4 and Connectors.m4 use awk and sed which # do not work at present with the Windows version. @@ -41,13 +45,15 @@ DPIC = dpic echo "\begin{document}" >> F_$*.tex echo "\input $*.tex" >> F_$*.tex echo "\end{document}" >> F_$*.tex - pdflatex --quiet F_$* + pdf$(QLATEX) F_$* $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic $(DPIC) -g $*.pic >> $*.tex - pdflatex --quiet F_$* + pdf$(QLATEX) F_$* if test "$(PDFCONVERT)" = "pdf2svg" ; then \ + echo "Using pdf2svg" ; \ pdf2svg F_$*.pdf $*.xsvg && cat $*.xsvg | tr -d '\r' > $*.svg ; \ else \ + echo "Using dvisvgm" ; \ dvisvgm --pdf F_$*.pdf && cat F_$**.svg | tr -d '\r' > $*.svg ; \ cp $*.svg $*.xsvg ; \ fi @@ -72,14 +78,14 @@ CCTDPV = \ NLGDPV.svg NPDTDPV.svg NportDPV.svg OpampDPV.svg OptoisoDPV.svg \ PconnDPV.svg PlateDPV.svg PushPullDPV.svg QuantumDPV.svg \ RectifiersDPV.svg RelayDPV.svg ResistorsDPV.svg RotboxDPV.svg\ - SchottkyDPV.svg ShiftRDPV.svg SierpinskiDPV.svg \ - SixpoleDPV.svg SourcesDPV.svg SQUIDDPV.svg SwitchesDPV.svg \ + SchottkyDPV.svg SevensegmentDPV.svg ShiftRDPV.svg SierpinskiDPV.svg \ + SixpoleDPV.svg SourcesDPV.svg Spec555DPV.svg SwitchesDPV.svg \ TTLnandDPV.svg TgateDPV.svg ThreeDPV.svg \ TubediagsDPV.svg VariableDPV.svg WindingsDPV.svg XformDPV.svg \ - controlDPV.svg cscDPV.svg diamondDPV.svg ex00DPV.svg \ + cbresistorDPV.svg controlDPV.svg cscDPV.svg diamondDPV.svg \ ex01DPV.svg ex02DPV.svg ex03DPV.svg ex04DPV.svg ex05DPV.svg ex06DPV.svg \ ex08DPV.svg ex09DPV.svg ex10DPV.svg ex11DPV.svg ex12DPV.svg \ - ex15DPV.svg ex16DPV.svg ex17DPV.svg ex18DPV.svg ex21DPV.svg \ + ex15DPV.svg ex16DPV.svg ex18DPV.svg ex21DPV.svg \ expDPV.svg fetDPV.svg graysurfDPV.svg keyboardDPV.svg lcctDPV.svg \ pwrsupplyDPV.svg quickDPV.svg randomDPV.svg recycleDPV.svg relaycoilDPV.svg \ roseDPV.svg sfgDPV.svg shapesDPV.svg SmithchartDPV.svg paletteDPV.svg \ diff --git a/graphics/circuit_macros/examples/dpv/QuantumDPV.m4 b/graphics/circuit_macros/examples/dpv/QuantumDPV.m4 index 7d2de93cbd..49ed173ffd 100644 --- a/graphics/circuit_macros/examples/dpv/QuantumDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/QuantumDPV.m4 @@ -17,6 +17,7 @@ define(`Meter',`[ Box: box wid boxwid*3/2 fill_(1) arc cw from C+(-r,0) to C+(r,0) with .c at C arrow from C+(-r/4,0) to C+(0.9*r,0.9*r) ]') +[ X: Bus(,shaded rgbstring(0.5,0.5,1) "X") A1: Bus(from X.start+(0,-boxht*3/2), shaded "red" "A") A2: Bus(from 2 between X.start and A1.start, shaded "red" "A") @@ -27,5 +28,27 @@ A2: Bus(from 2 between X.start and A1.start, shaded "red" "A") Meter with .e at X.end box wid boxwid*1.2 ht boxht*1.2 fill_(1) at A2.end-(4.5*boxwid,0) \ "svg_it(R)svg_sub(svg_psi)svg_sup(svg_pi/2,,,-1.2ex)" + ] +#.PE +#.PS +# SQUIDDPV.m4 +[ +cct_init(svg_font(sans-serif,11bp__)) + +down_ +S1: SQUID + "J1" at S1.J1 above rjust wid 15bp__ + "J2" at S1.J2 above ljust + +S2: SQUID(3,dimen_*1.5,-120) at S1.e+(elen_,0) + "J1" at S2.J1 above rjust + "J2" at S2.J2 below ljust + "J3" at S2.J3 above ljust + arcrad = S2.C.rad*0.7 + arc from S2.c+(Rect_(arcrad,-135)) to S2.c+(Rect_(arcrad,-45)) \ + with .c at S2.C -> + ] with .w at last [].e+(boxht,0) + + command "</g>" # end font .PE diff --git a/graphics/circuit_macros/examples/dpv/ResistorsDPV.m4 b/graphics/circuit_macros/examples/dpv/ResistorsDPV.m4 index e9f54c3399..793128e2ea 100644 --- a/graphics/circuit_macros/examples/dpv/ResistorsDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/ResistorsDPV.m4 @@ -2,46 +2,37 @@ # `ResistorsDPV.m4' cct_init(svg_font(sans-serif,11pt__)) textwid = 1.5 + movewid = 2 pt__ hm = 2.1 vm = 0.28 - -hm = 2.05 -vm = 0.28 { {resistor ; move ; svgLink(NportDPV.svg,"`resistor'" ljust)} move right_ hm - {resistor(,,Q) ; move ; "`resistor(,,Q) '" ljust} + {resistor(,5,Q) ; move ;"`...(,5,Q) '" ljust} move right_ hm - {resistor(,,V) ; move ; "`resistor(,,V) '" ljust} + {resistor(,,V) ; move ;"`...(,,V)'" ljust} } move down vm; right_ -{ - {resistor(,,ES) ; move ; "`resistor(,,ES) '" ljust} +{ {resistor(,,ES) ; move ;"`...(,,ES) '" ljust} move right_ hm - {resistor(,,H) ; move ; "`resistor(,,H) '" ljust} + {resistor(,4,H) ; move ;"`...(,4,H) '" ljust} move right_ hm - {resistor(,,AC) ; move ; "`resistor(,,AC) '" ljust} + {resistor(,,AC) ; move ;"`...(,,AC)'" ljust} } move down vm; right_ -{ - {resistor(,5,B) ; move ; "`resistor(,5,B) '" ljust} +{ {resistor(,,B) ; move ;"`...(,,B)'" ljust} move right_ hm - {resistor(,,E) ; move - "`resistor(,,E)'" ljust " svg_equiv `ebox'" ljust} + {resistor(,,F) ; move ;"`...(,,F) '" ljust} move right_ hm - {ebox(,0.5,0.3) ; move ;"`ebox(,0.5,0.3) '" ljust} + {resistor(,,E) ; move ;"`...(,,E) svg_equiv ebox'" ljust} } - move down vm; right_ -{ - {ebox(,,,0.6) ; move ; "`ebox(,,,0.6) '" ljust} + move down vm*1.1; right_ +{ {ebox(,,,0.9) ; move ;"`ebox(,,,0.9)'" ljust} move right_ hm - {ebox(,,,,shaded "yellow") ; move ;"`ebox(,,,,shaded \"yellow\") '" ljust} -} - move down vm; right_ -{ {ebox(,wdth=0.2;box=dashed shaded "green";text="X") ; move - "`ebox(,wdth=0.2;box=dashed shaded \"green\";text=\"X\")'" ljust} + "`ebox(,wdth=0.2;box=dashed shaded \"green\";'" ljust \ + "`text=\"X\")'" ljust} } command "</g>" # end font diff --git a/graphics/circuit_macros/examples/dpv/SQUIDDPV.m4 b/graphics/circuit_macros/examples/dpv/SQUIDDPV.m4 deleted file mode 100644 index a6beabbfe0..0000000000 --- a/graphics/circuit_macros/examples/dpv/SQUIDDPV.m4 +++ /dev/null @@ -1,19 +0,0 @@ -.PS -# SQUIDDPV.m4 -cct_init(svg_font(sans-serif,11bp__)) - -down_ -S1: SQUID - "J1" at S1.J1 above rjust wid 15bp__ - "J2" at S1.J2 above ljust - -S2: SQUID(3,dimen_*1.5,-120) at S1.e+(elen_,0) - "J1" at S2.J1 above rjust - "J2" at S2.J2 below ljust - "J3" at S2.J3 above ljust - arcrad = S2.C.rad*0.7 - arc from S2.c+(Rect_(arcrad,-135)) to S2.c+(Rect_(arcrad,-45)) \ - with .c at S2.C -> - - command "</g>" # end font -.PE diff --git a/graphics/circuit_macros/examples/dpv/SevensegmentDPV.m4 b/graphics/circuit_macros/examples/dpv/SevensegmentDPV.m4 new file mode 100644 index 0000000000..af45f48edb --- /dev/null +++ b/graphics/circuit_macros/examples/dpv/SevensegmentDPV.m4 @@ -0,0 +1,82 @@ +.PS +# Sevensegment.m4 +# https://tex.stackexchange.com/questions/644009/seven-segments-anchors-how-to-use-them +gen_init +divert(-1) + `sevensegment(keys) + Seven-segment display in a [] block. keys: + hght=expr; (default boxht) + wdth=expr; (default hght*3.3/5.85) + slant=fraction; top is skewed slant fraction of ht + segwid=expr; segment width + gap=expr; gap between segments + bevel=fraction; corner truncation + on=attributes; "on" segment attributes + off=attributes; "off" segment attributes + code=[0-8][.]; displayed number .=decimal point + or + code=Xddddddd[.] where each d=0 or 1 to define + Segment1 to Segment7 off or on + Segments are labeled Seg1 Seg2 ... Seg7 + and the decimal point is Seg8' +define(`sevensegment', # hght, wdth, slant, segwid, gap, bevel, on, off, code + `[ pushkeys_(`$1',`hght:boxht; wdth:m4`'hght*3.3/5.85; slant:0; + segwid:0.75/3.2*m4`'wdth; gap:0.12/3.2*m4`'wdth; bevel:0.4; + on:outlined "red" shaded "red":N; off:outlined "lightgray":N; + code:00000010:N;') + gapch = m4gap/2*sqrt(2) + ifinstr(m4code,.,`define(`m4tmp',substr(m4code,0,decr(len(m4code))))dnl + pushdef(`dodp',1)poppushdef(`m4code',m4tmp)')dnl + ifinstr(m4code,X,`pushdef(`opcode',substr(m4code,1))', + `foreach_(`m4cd',`pushdef(`Cd'decr(m4Lx),m4cd)',1111110,0110000,1101101, + 1111001,0110011,1011011,1011111,1110000,1111111,1111011)dnl + pushdef(`opcode',Cd`'m4code)')dnl + for_(1,7,1,`pushdef(`attrib'm4x, + ifelse(substr(opcode,decr(m4x),1),1,`m4on',`m4off'))')dnl + Seg1: m4segment(R,m4bevel,m4bevel,attrib1) \ + with .S at m4slu(0,m4hght-m4segwid) + inner = distance(Seg1.SW,Seg1.SE) + gapch*2 + Seg2: m4segment(D,0.5,m4bevel,attrib2) with .S at \ + m4slu(m4wdth/2-m4segwid,m4hght-m4segwid-inner/2) + Seg3: m4segment(D,m4bevel,0.5,attrib3) with .S at \ + m4slu(m4wdth/2-m4segwid,m4segwid+inner/2) + Seg4: m4segment(L,m4bevel,m4bevel,attrib4) with .S at m4slu(0,m4segwid) + Seg5: m4segment(U,0.5,m4bevel,attrib5) with .S at \ + m4slu(-m4wdth/2+m4segwid,m4segwid+inner/2) + Seg6: m4segment(U,m4bevel,0.5,attrib6) with .S at \ + m4slu(-m4wdth/2+m4segwid,m4hght-m4segwid-inner/2) + Seg7: m4segment(R,0.5,0.5,attrib7) with .c at m4slu(0,m4hght/2) + ifelse(dodp,1,`Seg8: circle diam m4segwid m4on \ + at m4slu(Seg3.e.x+m4segwid/2+m4gap,Seg4.s.y+m4segwid/2)') popdef(`dodp') + popdef(`m4hght',`m4wdth',`m4slant',`m4segwid',`m4gap',`m4bevel', + `m4on',`m4off',`m4code',`opcode')dnl + for_(1,7,1,`popdef(`attrib'm4x)') for_(0,9,1,`popdef(`Cd'm4x)')dnl + ]') +define(`m4segment',`[ setdir_(`$1') + m4seven_pos(SE,E,NE,,`$2'); m4seven_pos(SW,W,NW,-,`$3') + resetdir_ + S: 1/2 between SW and SE + Line: line from m4slu(S.x,S.y) to m4slu(SE.x,SE.y) then to m4slu(E.x,E.y) \ + then to m4slu(NE.x,NE.y) then to m4slu(NW.x,NW.y) then to m4slu(W.x,W.y) \ + then to m4slu(SW.x,SW.y) then to m4slu(S.x,S.y) `$4' ] ') +define(`m4seven_pos', + `AA: (`$4'(m4wdth/2-m4segwid-gapch),0); `$1': rot_(AA.x,AA.y,rp_ang) + BA: AA + (`$4'1,1)*m4segwid*(1-`$5'); `$2': rot_(BA.x,BA.y,rp_ang) + CA: BA - (`$4'1,-1)*m4segwid*`$5'; `$3': rot_(CA.x,CA.y,rp_ang) ') +define(`m4slu',`(`$1'+(`$2')*m4slant,`$2')') + +divert(0)dnl + + +[ + S: sevensegment(code=4.;hght=1) + { for_(1,8,1,`"m4x" at S.Seg`'m4x') } + move right 0.25 + P: sevensegment(code=X1100011;off=invis;hght=1) + ] +[ + for_(0,9,1,`sevensegment(code=m4x`'ifelse(m4x,1,.);slant=1/4;off=invis) + move movewid/4') + ] with .nw at last [].sw+(0,-boxht/3) + +.PE diff --git a/graphics/circuit_macros/examples/dpv/SourcesDPV.m4 b/graphics/circuit_macros/examples/dpv/SourcesDPV.m4 index ac6769e6ef..94326ce8d6 100644 --- a/graphics/circuit_macros/examples/dpv/SourcesDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/SourcesDPV.m4 @@ -8,51 +8,57 @@ define(`NL',`; move down $1; right_') { {source ; move ; "`source'" ljust} NL {source(,I) ; move ; "`source(,I)'" ljust} NL - {source(,i) ; move ; "`source(,i)'" ljust} NL - {source(,ti) ; move ; "`source(,ti)'" ljust} NL - {source(,i) ; move ; "`source(,ii)'" ljust} NL + {C:source(,i) ; move ; "`source(,i)'" ljust} NL + {D:source(,ti) ; move ; "`source(,ti)'" ljust} NL + {source(,ii) ; move ; "`source(,ii)'" ljust} NL {source(,V) ; move ; "`source(,V)'" ljust} NL {source(,v) ; move ; "`source(,v)'" ljust} NL {source(,tv) ; move ; "`source(,tv)'" ljust} NL + {source(,SC) ; move ; "`source(,SC)'" ljust} NL {source(,AC); move ; "`source(,AC)'" ljust} NL {source(,X) ; move ; "`source(,X)'" ljust} NL - {source(,F) ; move ; "`source(,F)'" ljust} NL {source(,G) ; move ; "`source(,G)'" ljust} NL - {source(,Q) ; move ; "`source(,Q)'" ljust} + {source(,Q) ; move ; "`source(,Q)'" ljust} NL #(0.3) + {source(,F) ; move ; "`source(,F)'" ljust} NL + {geiger(,,,,fill_(0.9)); move; + "`geiger(,,,,'" ljust "`fill_(0.9))'" ljust} NL } move right_ 2.0 + { -# {source(,,0.4) ; move ; "`source(,,0.4)'" ljust} NL(0.35) {source(,,0.4,,shaded "yellow") ; move ; - "`source(,,0.4,," ljust "shaded \"yellow\")'" ljust} NL(0.35) -# {source(,P) ; move ; "`source(,P)'" ljust} NL - {source(,P,,,fill_(0.9)) ; move ; - "`source(,P,,," ljust "fill_(0.9))'" ljust} NL + "`source(,,0.4,,'" ljust "`shaded \"yellow\")'" ljust} NL(0.35) + {source(,P) ; move ; "`source(,P)'" ljust} NL {source(,U) ; move ; "`source(,U)'" ljust} NL {source(,H) ; move ; "`source(,H)'" ljust} NL {source(,R) ; move ; "`source(,R)'" ljust} NL {source(,S) ; move ; "`source(,S)'" ljust} NL + {source(,SCr) ; move ; "`source(,SCr)'" ljust} NL {source(,T) ; move ; "`source(,T)'" ljust} NL {source(,L) ; move ; "`source(,L)'" ljust} NL - {source(,B) ; move ; "`source(,B)'" ljust} NL + {source(,B) ; move ; "`source(,B)'" ljust} NL(moveht*0.8) {nullator ; move ; "`nullator'" ljust} NL(moveht*0.8) {norator ; move ; "`norator'" ljust} NL(moveht*0.9) {ttmotor(,G) ; move ; "`ttmotor(,G)'" ljust} NL(moveht*1.1) - {proximity ; move ; "`proximity" ljust "= consource(,P)'" ljust} + {battery ; move ; "`battery'" ljust} NL(0.3) + {battery(,3,R) ; move ; "`battery(,3,R)'" ljust} + } move right_ 2.0 {source(,N) ; move ; "`source(,N)'" ljust} NL - {source(,"svg_micro(A)"); move; "`source(,\"svg_micro(A)\")'" \ - wid 1.7 at Here ljust}NL(0.31) - {consource ; move ; "`consource'" ljust } NL(0.32) + {source(,NA) ; move ; "`source(,NA)'" ljust} NL + {source(,NB) ; move ; "`source(,NB)'" ljust} NL + {source(,"mA");move; "`source(,\"mA\")'" ljust} NL(0.31) + {consource ; move ; "`consource'" ljust} NL(0.32) {consource(,I) ; move ; "`consource(,I)'" ljust} NL(0.32) {consource(,i) ; move ; "`consource(,i)'" ljust} NL(0.32) {consource(,ti) ; move ; "`consource(,ti)'" ljust} NL(0.32) + {source(,SE) ; move ; "`source(,SE)'" ljust} NL {consource(,V) ; move ; "`consource(,V)'" ljust} NL(0.32) {consource(,v) ; move ; "`consource(,v)'" ljust} NL(0.3) {consource(,tv) ; move ; "`consource(,tv)'" ljust} NL(0.3) - {battery ; move ; "`battery'" ljust} NL(0.3) - {battery(,3,R) ; move ; "`battery(,3,R)'" ljust} NL(0.35) + {proximity ; move ; + "`proximity'" ljust "` = consource(,P)'" wid 80bp__ ljust} NL(0.35) command "</g>" # end font .PE diff --git a/graphics/circuit_macros/examples/dpv/Spec555DPV.m4 b/graphics/circuit_macros/examples/dpv/Spec555DPV.m4 new file mode 100644 index 0000000000..7a49b002b3 --- /dev/null +++ b/graphics/circuit_macros/examples/dpv/Spec555DPV.m4 @@ -0,0 +1,57 @@ +.PS +# Spec555.m4 +# https://tex.stackexchange.com/questions/64801/display-ics-with-circuitikz?rq=1 +log_init + +define(`spec555',`[ Chip: box wid 8*lg_pinsep ht 10*lg_pinsep fill_(0.9) + svg_font(sans-serif,8bp__) + P1: 3/4<Chip.sw,Chip.se>; {"1" below rjust at P1}; "GND" above at P1 + P5: Chip.s; {"5" below rjust at P5}; "CTRL" above at P5 + P2: 1/8<Chip.sw,Chip.nw>; {"2" above rjust at P2}; "TRG" ljust at P2 + P6: 3/8<Chip.sw,Chip.nw>; {"6" above rjust at P6}; "THR" ljust at P6 + P7: 7/8<Chip.sw,Chip.nw>; {"7" above rjust at P7}; "DIS" ljust at P7 + P3: Chip.e; {"3" above ljust at P3}; "OUT" rjust at P3 + P4: 3/4<Chip.nw,Chip.ne>; {"4" above rjust at P4}; "svg_emsp`'RESET" below \ + at P4 + P8: Chip.n; {"8" above rjust at P8}; "Vcc" below at P8 + "NE-555" at Chip.c "TIMER" + command "</g>" + line left dimen_ from P7; X:dot + { R1:resistor(up_ P7.y-P6.y); rlabel(,68 k`'svg_ohm); dot } + R2:resistor(down_ P7.y-P6.y); llabel(,68 k`'svg_ohm); dot; {line to P6} + line to (Here,P2); SW: dot; {line to P2} + line from P8 to (P8,R1.end); dot ]') + + svg_font(sans-serif,10bp__) + T1: spec555; "U1" at T1.Chip.nw above ljust + T2: spec555 with .Chip.w at T1.Chip.e+(2.5*dimen_,0) + "U2" at T2.Chip.nw above ljust + {line left_ dimen_/2 from (T1.X,T1.P7); diode(down_ T1.P7.y-T1.P6.y) + {"D1" wid 15bp__ rjust at last [].w "1N4148" rjust wid 36bp__} + line to (T1.X,Here); dot} + capacitor(down_ elen_*1.2 from T1.SW,E+); llabel(,10 uF); dot + dot(at Here-(dimen_/2,0),,1); G: dot(,,1); "GND" rjust at G.w + capacitor(from T1.P5 to (T1.P5,G),E+); rlabel(,0.01 nF); dot + line from T1.P1 to (T1.P1,G); dot + Vcc: dot(at (G,T1.R1.end),,1); "Vcc" wid 0.3 rjust at Vcc.w + dot(at (T1.P4,Vcc)); line to T1.P4 + line right_ dimen_/2 from T1.P3; + R3: resistor(down_ to (Here,T2.s-(0,dimen_/4))); llabel(,10 k`'svg_ohm) + line to (T2.P5,Here) then to T2.P5 + dot(at (T2.X,G)); ground + reversed(`capacitor',up_ to (Here,T2.P5),E+); rlabel(,100 nF) + line to (Here,T2.P2) + line from T2.P1 to (T2.P1,G); dot + line from T2.P4 to (T2.P4,Vcc) then to Vcc chop 0 chop dotrad_ + dot(at (T2.X,T2.R1.end)+(0,dimen_/2),,1); {line to T2.R1.end chop dotrad_} + "+5 V to +15V" at last [].n above + capacitor(right_ dimen_ from T2.P3,C); llabel(," 100 uF") + Pot1: potentiometer(down_ (Here.y-G.y)/2) with .Start at Here + "Rx" wid 0.2 at Pot1.T1 ljust + Sp: speaker(R,,,fill_(0.9)) with .In5 at Pot1.End + "1" above rjust at Sp.In5; "2" below rjust at Sp.In7 + "E1" at Sp.In2 rjust "Speaker" rjust + line from Sp.In7 to (Sp.In7,G) then to G chop 0 chop dotrad_ + command "</g>" + +.PE diff --git a/graphics/circuit_macros/examples/dpv/cbresistorDPV.m4 b/graphics/circuit_macros/examples/dpv/cbresistorDPV.m4 new file mode 100644 index 0000000000..c03122377c --- /dev/null +++ b/graphics/circuit_macros/examples/dpv/cbresistorDPV.m4 @@ -0,0 +1,82 @@ +.PS +# cbresistor.m4 +# https://tex.stackexchange.com/questions/709339/create-command-with-decoration-in-tikz +# https://www.google.com/search?client=firefox-b-d&q=resistor+color+code +cct_init +divert(-1) + + `cbresistor(linespec, keys) + keys: + lgth=expr; wdth=expr; + body=body attributes, e.g. shaded "green" + type=A|B; pinched body shape + colors=color:color:...; + Up to 6 colors, a color may be nul ' +define(`cbresistor',`eleminit_(`$1') + pushkeys_(`$2',`lgth:dimen_/2; wdth:dimen_/5; body::N; colors::N; type::N')dnl +{line to rvec_(max(0,rp_len/2-m4lgth/2),0) thick linethick*3/2; M4cbW: Here + ifelse(m4type,B, + `[L:rotbox(m4lgth*3/23, m4wdth, shaded "darkgray" m4body,r=m4wdth/20) + C:rotbox(m4lgth*17/23, m4wdth*9/10, shaded "darkgray" m4body) \ + with .W at L.E + R:rotbox(m4lgth*3/23, m4wdth, shaded "darkgray" m4body,r=m4wdth/20) \ + with .W at C.E] with .L.W at Here; move to last [].R.E', + `rotbox(m4lgth, m4wdth, shaded "darkgray" m4body) with .W at Here') + ifelse(m4colors,,,`define(`m4bw',(m4lgth/23))dnl + definergbcolor(silver,0.75,0.75,0.75) + definergbcolor(gold,1,215/255,0) + stacksplit_(`cbrstack',m4colors,:)stackreverse_(`cbrstack')dnl + stackargs_(`m4pos',22,17,12,7,5,2)dnl + stackdo_(`cbrstack',`ifelse(cbrstack,nul,, + `{ move to M4cbW+vec_(m4pos*m4bw-m4bw/2,0) + define(`m4ctr',ifelse(m4type,B,eval((m4pos>3)*(m4pos<20)),0))dnl + line m4colorfix(outlined,cbrstack) thick m4bw*1.8/(1bp__) \ + from rvec_(0,-ifelse(m4ctr,1,0.9*)m4wdth/2) \ + to rvec_(0, ifelse(m4ctr,1,0.9*)m4wdth/2) + ifelse(ifelse(cbrstack,silver,1,cbrstack,gold,1),1, + `line outlined rgbstring(0.8,0.8,0.8) thick last line.thick \ + from 0.2 along_(last line) to 0.4 along_(last line) + line outlined "white" thick last line.thick \ + from 0.25 along_(2nd last line) to 0.3 along_(2nd last line)') + }') + popdef(`m4pos')') stackdo_(`m4pos')') + line to rvec_(max(0,rp_len/2-m4lgth/2),0) thick linethick*3/2} + popdef(`m4lgth',`m4wdth',`m4body',`m4colors',`m4type')dnl + line to rvec_(rp_len,0) invis ') + +divert(0)dnl + +linewid = 3/2*linewid +ifsvg(definergbcolor(Dandelion,0.95,0.65,0.2)) +ifsvg(definergbcolor(Peach,0.76,0.5,0.1)) + +define(`dpr', + `{ cbresistor(,type=B; + body=m4colorfix(shaded,Dandelion) m4colorfix(outlined,Peach); + colors=`$2') } + {iflatex(`sprintf("\SI{%g}{\ohm}",`$1')')ifsvg("``$1'svg_Omega'") \ + at last line.end+(10bp__,-5bp__) rjust} + move right_ moveht*5/6; down_ ') + + define(`elen_',(3/2*linewid)) + define(`dimen_',(5/4*linewid)) +[] +[ down_ + foreach_(`pair',`dpr(patsubst(pair,-,`,'):nul:black:silver)', + 10-brown:black, + 12-brown:red, + 15-brown:green, + 18-brown:gray, + 22-red:red, + 27-red:Violet, + 33-orange:orange, + 39-orange:white, + 47-yellow:Violet, + 56-green:blue, + 68-blue:gray, + 82-gray:red) + dpr(100,brown:black:nul:brown:gold) + {"iflatex(\SI{5}{\percent},5 %)" at last line.end+(10bp__,-15bp__) rjust} + ] with .nw at last [].ne+(30bp__,0) + +.PE diff --git a/graphics/circuit_macros/examples/dpv/ex00DPV.m4 b/graphics/circuit_macros/examples/dpv/ex00DPV.m4 deleted file mode 100644 index 97c5268725..0000000000 --- a/graphics/circuit_macros/examples/dpv/ex00DPV.m4 +++ /dev/null @@ -1,94 +0,0 @@ -.PS -# ex00.m4 -gen_init(svg_font(sans-serif,11bp__)) - -[ -thicklines_ -ewid = 2 -eht = 0.5 -E: ellipse wid ewid ht eht - - [ narrows = 5 - de = ewid/narrows - for i=0 to narrows do { - arrow down from i*de,0 } - ] with .s at E.n+(0,0.25) - - "svg_bf(B)svg_it((t))" at last [].c - -thinlines_ - arrow from E.c to E.ne - box invis fill_(1) ht 0.12 wid 0.12 with .c at last arrow.c "svg_it(r)" - - command "</g>" # end font -] -[ -# ex07.m4 -#gen_init - -Barrel: box invis ht 0.4 wid 1.5 - up -Face: arc rad 2.6 from Barrel.e+(2.4,-1.7/2) to Barrel.e+(2.4,1.7/2) - - eps = 0.03 - arc ccw rad 2.6 from Face.start-(eps,0) to Face.end-(eps,0) \ - with .c at Face.c-(eps,0) - line from Barrel.nw to Barrel.ne then to Face.end - line from Barrel.sw to Barrel.se then to Face.start - arc cw from Barrel.sw to Barrel.nw rad Barrel.ht*1.2 - -Cathode: Barrel.w+(0.3,0) -Term: Barrel.w+(-0.25,0) - dcath = 0.13 - dan = 0.12 - - line from Cathode up dcath/2 left dcath/2 then to Term.x,Cathode.y+dcath/2 - dot - line from Cathode down dcath/2 left dcath/2 then to Term.x,Cathode.y-dcath/2 - dot - - hole = 0.06 -Hole: line invis up hole from Cathode+(0.5,-hole/2) - line from Hole.end up dan-hole/2 then to Term.x,Cathode.y+dan; dot - line from Hole.start down dan-hole/2 then to Term.x,Cathode.y-dan; dot - - platewid = 0.25 - platesep = 0.15 -Plates: box invis wid platewid ht platesep at Barrel.e+(-platewid/2,0) - line right platewid from Plates.nw - line right platewid from Plates.sw - line up 0.3 from Plates.n - line down 0.3 from Plates.s - -linethick_(1.4) - - move to Cathode+(0.03,0) -Spot: 0.9<Face.start,Face.end> - arcto(Plates.c,Spot,(Plates.c.x-Cathode.x)*0.90,outlined "lightgrey" thick 2) - line to Spot chop 0 chop -0.02 outlined "lightgrey" thick 2 - -thinlines_ - - arrow <- from Cathode+(0.2,0.06) up 0.5 left 0.3 - "electron" above "gun" above - - arrow <- from Plates.nw+(0,0.06) up 0.5 left 0.3 - "deflection" above "plates" above - - arrow <- from 0.5<Plates.e,Spot>+(0,0.06) up 0.5 left 0.3 - "electron beam" at Here+(-0.3,0) above - - spline <- from 1.015<Plates.e,Spot> right 0.1 up 0.1 then up 0.1 \ - then up 0.1 left 0.1 - "spot of light" rjust - - "vacuum" at 0.5<Face.start,Face.end>+(-0.4,0) rjust - - arrow <- from Face.start+(0.1,0.5) left 0.6*1.4 down 0.3*1.4 - "phosphor coating" rjust - - arrow <- from 0.2<Barrel.se,Face.start> left 0.6 down 0.3 - "glass enclosure (tube)" rjust - -] with .sw at last [].se+(0.5,0) -.PE diff --git a/graphics/circuit_macros/examples/dpv/examplesDPV.htmx b/graphics/circuit_macros/examples/dpv/examplesDPV.htmx index 52f7b939b8..3406d8ec8a 100644 --- a/graphics/circuit_macros/examples/dpv/examplesDPV.htmx +++ b/graphics/circuit_macros/examples/dpv/examplesDPV.htmx @@ -71,18 +71,13 @@ ifinstr(`$3',y,,`<hr>')') <hr> <p> - This file shows diagrams in .svg format produced without the use of - LaTeX or equivalent. -<!-- - <A HREF="examples.html">png</A> - versions are also available. - The PDF equivalent can be found in examples.pdf of the distribution. + This file shows diagrams in .svg format produced + without the use of LaTeX or equivalent. + The diagrams have been selected and adapted from the Circuit_macros + examples in order to test the svg output of dpic. </p> - <p> ---> -The diagrams have been adapted from the Circuit_macros -examples in order to test the svg output of dpic. Generating svg line +Generating svg line art is straightforward but formatting text is not because TeX, LaTeX, and related word processors do not produce svg directly. Either less-sophisticated text formatting must be employed for svg or an @@ -136,7 +131,8 @@ There are other issues: Change font face and dpic m4tt`'textht</g>, m4tt`'dptextratio</g>, and m4tt`'textoffset</g> parameters. If arg4 is blank, the font is changed and - requires m4tt`'command "</g>"</g> to cancel the font change. + requires m4tt`'command "</g>"</g> at the end + to cancel the font change. <br> Note: Nominal height = text height in drawing units; actual height = @@ -305,7 +301,8 @@ SVG produced by dpic changecom(,)&`#'8194;changecom(`#') <br><br> (<a href="quick.txt" TYPE="text/plain" TARGET="_blank" alt="quick">quick.m4</a>): -SVG produced from quick.pdf by dvisvgm changecom(,)&`#'8194;changecom(`#') +SVG produced from quick.pdf by dvisvgm or pdf2svg + changecom(,)&`#'8194;changecom(`#') </p> </td> </table> @@ -390,6 +387,9 @@ cfig(ConnDPV, cfig(PconnDPV, The m4tt`'pconnex</g> macro) +cfig(cbresistorDPV, + Color-coded through-hole resistors) + cfig(EVplugsDPV, Electric vehicle charging plug patterns make extensive use of key=value pairs to set options) @@ -430,6 +430,9 @@ cfig(WindingsDPV, The macro m4tt`'winding(L|R`,'diam`,'pitch`,'turns`,'core wid`,'core color)</g>) +cfig(Spec555DPV, + A 555 timer example) + cfig(ex01DPV, Two simple labeled circuits) @@ -448,9 +451,6 @@ cfig(PushPullDPV, cfig(QuantumDPV, A quantum circuit) -cfig(SQUIDDPV, - Superconducting quantum interface device (drawing direction down)) - cfig(SixpoleDPV, A six-pole filter) @@ -469,10 +469,6 @@ cfig(ThreeDPV, cfig(MCDPV, A three-phase switched AC-AC converter and a DC-DC converter) -cfig(ex17DPV, - A repetitive network created by Pic looping and - a skewed circuit used to test the macro m4tt`'parallel_</g>) - cfig(ex12DPV, A CMOS NAND gate`,' a test circuit`,' and an XMOSFET example) @@ -586,9 +582,6 @@ cfig(ABlogixDPV, cfig(XORDPV, Realizations of the XOR function using m4tt`'Autologix</g>) -cfig(ex00DPV, - Line diagrams) - cfig(EEPDPV, Part of a single-line diagram of a power distribution system using draft elements) @@ -603,6 +596,10 @@ cfig(GrayCodeDPV, cfig(controlDPV, Control-system block diagrams) +cfig(SevensegmentDPV, + A customizable seven-segment display showing the numbered segments with + a custom shape and the numerals from 0 to 9) + cfig(ByteDPV, Elementary splines) @@ -690,7 +687,7 @@ cfig(keyboardDPV, More objects drawn in relief) cfig(DiniDPV, - Dini surface and an icosahedron) + Dini surface`,' an icosahedron`,' and a sphere with inscribed cylinder) cfig(SierpinskiDPV, The Sierpinski triangle and a Cayley graph: diff --git a/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx b/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx index a52445d744..96a572b462 100644 --- a/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx +++ b/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx @@ -1,14 +1,3 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<HTML> -<HEAD> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -<meta http-equiv="Content-Style-Type" content="text/css"> -<!--meta http-equiv="Content-Script-Type" content="text/javascript"--> -<TITLE>SVG Examples: Circuit_macros Version XXX</TITLE> -<meta name="keywords" content="HTML" -content='Circuit elements, basic circuits, logic circuits and other diagrams, -electric circuits, resistor, capacitor, inductor, diode, sources, amplifier, -integrator, fuse, switch, antenna, opamp, transformer, relay, contact, jack, plug, FET, UJT, thyristor, bipolar transistor, nport, windings, timer, optical isolator, rectifier, bistable, oscillator, CMOS, MOSFET, power supply, NAND gate, controlled source, synchronous machine, digital circuit, signal-flow @@ -132,7 +121,8 @@ There are other issues: Change font face and dpic m4tt`'textht</g>, m4tt`'dptextratio</g>, and m4tt`'textoffset</g> parameters. If arg4 is blank, the font is changed and - requires m4tt`'command "</g>"</g> to cancel the font change. + requires m4tt`'command "</g>"</g> at the end + to cancel the font change. <br> Note: Nominal height = text height in drawing units; actual height = @@ -384,6 +374,9 @@ cfig(ConnDPV, cfig(PconnDPV, The m4tt`'pconnex</g> macro) +cfig(cbresistorDPV, + Color-coded through-hole resistors) + cfig(EVplugsDPV, Electric vehicle charging plug patterns make extensive use of key=value pairs to set options) @@ -448,9 +441,6 @@ cfig(PushPullDPV, cfig(QuantumDPV, A quantum circuit) -cfig(SQUIDDPV, - Superconducting quantum interface device (drawing direction down)) - cfig(SixpoleDPV, A six-pole filter) @@ -469,10 +459,6 @@ cfig(ThreeDPV, cfig(MCDPV, A three-phase switched AC-AC converter and a DC-DC converter) -cfig(ex17DPV, - A repetitive network created by Pic looping and - a skewed circuit used to test the macro m4tt`'parallel_</g>) - cfig(ex12DPV, A CMOS NAND gate`,' a test circuit`,' and an XMOSFET example) @@ -590,9 +576,6 @@ cfig(ABlogixDPV, cfig(XORDPV, Realizations of the XOR function using m4tt`'Autologix</g>) -cfig(ex00DPV, - Line diagrams) - ') cfig(EEPDPV, Part of a single-line diagram of a power distribution system @@ -613,6 +596,10 @@ cfig(controlDPV, cfig(ByteDPV, Elementary splines) +cfig(SevensegmentDPV, + A customizable seven-segment display showing the numbered segments with + a custom shape and the numerals from 0 to 9) + ifelse(0,1,` cfig(RotboxDPV, The macro @@ -698,7 +685,7 @@ cfig(keyboardDPV, More objects drawn in relief) cfig(DiniDPV, - Dini surface and an icosahedron) + Dini surface`,' an icosahedron`,' and a sphere with inscribed cylinder) cfig(SierpinskiDPV, The Sierpinski triangle and a Cayley graph: diff --git a/graphics/circuit_macros/examples/dpv/quickDPV.m4 b/graphics/circuit_macros/examples/dpv/quickDPV.m4 index 65a181f214..db9c15ce9d 100644 --- a/graphics/circuit_macros/examples/dpv/quickDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/quickDPV.m4 @@ -4,18 +4,16 @@ cct_init # Set defaults elen = 0.75 # Variables are allowed; default units are inches move right 0.4 -Origin: Here # Position names are capitalized - svgLink(SourcesDPV.svg,source(up_ elen)) + svgLink(SourcesDPV.svg,Vs: source(up_ elen)) llabel(-,svg_it(v`'svg_sub(s)),+) svgLink(ResistorsDPV.svg,resistor(right_ elen)); rlabel(,svg_it(R),) dot { # Save current position and direction - capacitor(down_ to (Here,Origin)) #(Here,Origin) = (Here.x,Origin.y) - rlabel(+,svg_it(v),-); llabel(,svg_it(C)) + capacitor(down_ Vs.len); rlabel(+,svg_it(v),-); llabel(,svg_it(C)) dot } # Restore position and direction line right_ elen*2/3 {move right 0.2} - inductor(down_ Here.y-Origin.y); rlabel(,svg_it(L),); b_current("svg_it(i)") - line to Origin + inductor(down_ Vs.len); rlabel(,svg_it(L),); b_current("svg_it(i)") + line to (Vs,Here) # (Vs,Here) = (Vs.x,Here.y) .PE # Pic input ends diff --git a/graphics/circuit_macros/examples/dpv/relaycoilDPV.m4 b/graphics/circuit_macros/examples/dpv/relaycoilDPV.m4 index fc2bc2738f..5ecd5aeec4 100644 --- a/graphics/circuit_macros/examples/dpv/relaycoilDPV.m4 +++ b/graphics/circuit_macros/examples/dpv/relaycoilDPV.m4 @@ -1,12 +1,13 @@ .PS -# relaycoil.m4 +# relaycoilDPV.m4 cct_init spc = dimen_/3 { relaycoil; S: "svg_tt(`relaycoil')" at last [].s+(0,-20bp__) { "svg_it(V1)" wid 15bp__ at last [].V1 rjust "svg_it(V2)" at last [].V2 ljust } - K: relaycoil(NX) with .nw at last [].ne+(spc*4,0); "svg_tt((NX))" \ + relaycoil(S) with .nw at last [].ne+(spc*2,0); "svg_tt((S))" at (last [],S) + K: relaycoil(NX) with .nw at last [].ne+(spc*3,0); "svg_tt((NX))" \ at (last [],S) { thinlines_ spline <- from K.A1 left 7bp__ then up 4bp__ left 4bp__ @@ -21,27 +22,30 @@ cct_init "svg_it(B3)" ljust thicklines_ } - relaycoil(AXSR) with .nw at last [].ne+(spc*5,0); "svg_tt((AXSR))" \ + relaycoil(AXSR) with .nw at last [].ne+(spc*4,0); "svg_tt((AXSR))" \ at (last [],S) { "svg_it(V1)" at last [].V1 rjust; "svg_it(V2)" at last [].V2 rjust } relaycoil(BXSR) with .nw at last [].ne+(spc*2,0); "svg_tt((BXSR))" \ at (last [],S) { "svg_it(V1)" at last [].V1 ljust; "svg_it(V2)" at last [].V2 ljust } - relaycoil(SR) with .nw at last [].ne+(spc*4,0); "svg_tt((SR))" at (last [],S) - relaycoil(SO) with .nw at last [].ne+(spc,0); "svg_tt((SO))" at (last [],S) - relaycoil(SOR) with .nw at last [].ne+(spc,0); "svg_tt((SOR))" at (last [],S) + relaycoil(SR) with .nw at last [].ne+(spc*2,0); "svg_tt((SR))" at (last [],S) + spx = spc*3/4 + relaycoil(SO) with .nw at last [].ne+(spx,0); "svg_tt((SO))" at (last [],S) + relaycoil(SOR) with .nw at last [].ne+(spx,0); "svg_tt((SOR))" at (last [],S) + relaycoil(PC) with .nw at last [].ne+(spx,0); "svg_tt((PC))" at (last [],S) } { move down_ 3/4; right_ relaycoil(HS); S: "svg_tt((HS))" at last [].s+(0,-12bp__) - relaycoil(NAC) with .nw at last [].ne+(spc,0); "svg_tt((NAC))" at (last [],S) - relaycoil(AC) with .nw at last [].ne+(spc,0); "svg_tt((AC))" at (last [],S) - relaycoil(ML) with .nw at last [].ne+(spc,0); "svg_tt((ML))" at (last [],S) - relaycoil(PO) with .nw at last [].ne+(spc,0); "svg_tt((PO))" at (last [],S) - relaycoil(RM) with .nw at last [].ne+(spc,0); "svg_tt((RM))" at (last [],S) - relaycoil(RH) with .nw at last [].ne+(spc,0); "svg_tt((RH))" at (last [],S) - relaycoil(TH) with .nw at last [].ne+(spc,0); "svg_tt((TH))" at (last [],S) - relaycoil(EL) with .nw at last [].ne+(spc,0); "svg_tt((EL))" at (last [],S) + relaycoil(NAC) with .nw at last [].ne+(spx,0); "svg_tt((NAC))" at (last [],S) + relaycoil(AC) with .nw at last [].ne+(spx,0); "svg_tt((AC))" at (last [],S) + relaycoil(ML) with .nw at last [].ne+(spx,0); "svg_tt((ML))" at (last [],S) + relaycoil(PO) with .nw at last [].ne+(spx,0); "svg_tt((PO))" at (last [],S) + relaycoil(RM) with .nw at last [].ne+(spx,0); "svg_tt((RM))" at (last [],S) + relaycoil(RH) with .nw at last [].ne+(spx,0); "svg_tt((RH))" at (last [],S) + relaycoil(TH) with .nw at last [].ne+(spx,0); "svg_tt((TH))" at (last [],S) + relaycoil(EL) with .nw at last [].ne+(spx,0); "svg_tt((EL))" at (last [],S) + relaycoil(MR) with .sw at last [].se+(spx,0); "svg_tt((MR))" at (last [],S) } .PE |