diff options
Diffstat (limited to 'graphics/circuit_macros/examples/svg/EEPSVG.m4')
-rw-r--r-- | graphics/circuit_macros/examples/svg/EEPSVG.m4 | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/graphics/circuit_macros/examples/svg/EEPSVG.m4 b/graphics/circuit_macros/examples/svg/EEPSVG.m4 index 4f928f927d..277b704cd8 100644 --- a/graphics/circuit_macros/examples/svg/EEPSVG.m4 +++ b/graphics/circuit_macros/examples/svg/EEPSVG.m4 @@ -10,36 +10,38 @@ divert(-1) # already in libcct.m4. The contributions and suggestions of Benjamin # Vilmann are acknowledged with thanks. -# 1-terminal SLD elements: +# Notes for 1-terminal SLD elements: # Argument 1 is normally the linespec of the stem to set the element direction -# and length. See also: PtoL defined below. +# and length. See also: PtoL defined in libgen.m4. # For a 0-length stem (which has undefined direction): # arg1 can also be U, D, L, R (for up, down, left, right), # or a number to set the direction in degrees, optionally followed by # `at position' to set the position (Here by default). # Zero-length stem examples: sl_box(U), sl_box(45 at Here+(1,0)) # Argument 2 contains semicolon (;)-separated key-value attributes -# of the element head as applicable: e.g., name=Name; text="text"; lgth=expr -# A non-blank argument 3 is C for a default closed breaker in the stem, O for -# an open breaker, or key-value pairs to specify breaker details. -# The element body (head) can be named. It is overlaid with or contained in -# a [] block. - -# 2-terminal SLD elements: +# of the element head as applicable: e.g., name=Carol; text="Stop"; lgth=expr +# If argument 3 is blank then no breaker is drawn. A non-blank argument 3 +# is C for a default closed breaker in the stem, O for an open breaker, +# or key-value pairs to specify breaker details. +# The element body (head) can be named with name=. It is overlaid with +# or contained in a [] block. + +# Notes for 2-terminal SLD elements: # These obey the normal Circuit_macro two-terminal conventions. # They can be labelled using rlabel() or llabel() as well as directly. # Argument 2 contains key-value pairs to customize the element body, # e.g., name=Name; text="text"; wdth=expr; ... # Nonblank arguments 3 and 4 put a breaker in the input and output respectively. -# Attached breakers: +# Notes for attached breakers: # Nonblank arguments 3 and 4 of the two-terminal elements and argument 3 of # the 1-terminal elements specify a breaker in the input, output, and stem # respectivlely. An O creates a default-size open breaker, and C a closed # breaker, otherwise the argument contains key-value pairs to specify the # details of the box; e.g., box=dotted 2bp__ shaded "green" -# The SLD current transformer macro sl_ct is composite, within a [] block. +# Notes for composite elements within a [ ] block: +# The SLD current transformer macro sl_ct is composite. # Internal labels L (for inductor) and terminals Ts, Tc, and Te are defined. define(`sldlib_') @@ -195,24 +197,31 @@ define(`sl_eleminit_', input breaker keys, output breaker keys) keys: type=I|S - (type=I) scale=expr; (default 1.5) + (type=I) loopwid=expr; (default dimen_*3/10) cycles=n; (default 4) + core= A[ir]|M[n]|P[n]|K[n] + n=integer (default 2 lines) (type=S) body=shaded "color"; name=Body name; (breaker default names BrI, BrO)' define(`sl_transformer', - `setkeys_(`$2',name::N; type:I:N; cycles:4:N; body::N; scale:1.5:; )dnl + `setkeys_(`$2',name::N; type:I:N; cycles:4:N; core::N; body::N; + loopwid:3/20*dimen_; )dnl ifelse(`$3'`$4',, `ifinstr(m4type,S, `source(`$1',G,,,m4body)', `eleminit_(`$1'); m4atmp = rp_ang; m4slen = rp_len - define(`m4swd',`dimen_*3/16*m4scale')dnl + ifelse(ifinstr(m4core,M,T,m4core,P,T,m4core,K,T),T, + `define(`m4nL',ifelse(len(m4core),1,2,substr(m4core,1)))dnl + define(`m4swd',(m4loopwid + dimen_/12+(m4nL-1)*dimen_/16))',dnl + `define(`m4swd',(m4loopwid*3/2))')dnl { line to rvec_((m4slen-m4swd)/2,0) - {ifelse(m4name,,SL_box,m4name): [ linewid = linewid*m4scale - {L1: inductor(to vec_(0,-m4cycles*dimen_/8),,m4cycles)} + {ifelse(m4name,,SL_box,m4name): [#linewid = linewid*m4scale + {L1: inductor(to vec_(0,-m4cycles*m4loopwid),,m4cycles,m4core, + m4loopwid)} {point_(m4atmp) - L2: inductor(from vec_(dimen_*3/16,-m4cycles*dimen_/8) \ - to vec_(dimen_*3/16,0),,m4cycles)} + L2: inductor(from vec_(m4swd,-m4cycles*m4loopwid) \ + to vec_(m4swd,0),,m4cycles,,m4loopwid)} C2: last line.c; point_(m4atmp) ] with .L1.c at Here} line from rvec_(m4swd,0) to rvec_((m4slen+m4swd)/2,0) } line invis to rvec_(rp_len,0)') ', @@ -389,6 +398,17 @@ define(`sl_ct', # ####################################################################### +# The following is defined in Circuit_macros 9.5.4 or later: + + `setkeys_(string,keysequence) + Invoke setkey_ on arg1 and each term in a + sequence of terms. + keysequence is a ;-separated sequence + of terms of the form + identifier:default value:N ' +define(`setkeys_',`Loopover_(`M4sk',`setkey_(`$1',patsubst(M4sk,:,`,')) dnl', + patsubst(`$2',;,`,'))') + divert(0)dnl |