From c61527a1e502753302af623887b829055e2f6f9c Mon Sep 17 00:00:00 2001 From: CKuhlmann Date: Fri, 5 May 2017 15:43:12 +0200 Subject: [PATCH] Schematic drawing objects (lines and rects), Opamp label placement --- examples/Draft2.asc | 21 ++++++++++++ examples/Draft3.asc | 4 +++ examples/Test.asc | 34 +++++++++++++++---- examples/translate.asy2tex | 2 +- sym32a/SchLine.asy2tex | 9 +++++ sym32a/SchRect.asy2tex | 9 +++++ sym32a/latex_preamble.tex | 2 ++ sym32a/opamps/UniversalOpamp2.asy2tex | 2 +- .../differential/fullydifferentialop.asy2tex | 2 +- sym32b/SchLine.asy2tex | 9 +++++ sym32b/SchRect.asy2tex | 9 +++++ sym32b/latex_preamble.tex | 2 ++ sym32b/opamps/UniversalOpamp2.asy2tex | 2 +- .../differential/fullydifferentialop.asy2tex | 2 +- sym48/SchLine.asy2tex | 9 +++++ sym48/SchRect.asy2tex | 9 +++++ sym48/latex_preamble.tex | 2 ++ 17 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 examples/Draft2.asc create mode 100644 examples/Draft3.asc create mode 100644 sym32a/SchLine.asy2tex create mode 100644 sym32a/SchRect.asy2tex create mode 100644 sym32b/SchLine.asy2tex create mode 100644 sym32b/SchRect.asy2tex create mode 100644 sym48/SchLine.asy2tex create mode 100644 sym48/SchRect.asy2tex diff --git a/examples/Draft2.asc b/examples/Draft2.asc new file mode 100644 index 0000000..55c301c --- /dev/null +++ b/examples/Draft2.asc @@ -0,0 +1,21 @@ +Version 4 +SHEET 1 880 680 +WIRE 272 144 272 112 +WIRE 240 160 208 160 +WIRE 320 176 304 176 +WIRE 240 192 208 192 +WIRE 272 224 272 208 +SYMBOL Opamps\\UniversalOpamp2 272 176 R0 +SYMATTR InstName U1 +LINE Normal 80 96 0 96 2 +LINE Normal 80 128 0 112 1 +LINE Normal 80 144 0 160 2 +LINE Normal 112 176 0 176 3 +LINE Normal 112 192 0 208 4 +LINE Normal 144 240 0 224 +LINE Normal 128 288 0 304 +LINE Normal 192 304 128 288 +LINE Normal 272 288 192 304 +LINE Normal 320 304 272 288 +RECTANGLE Normal 320 224 208 112 2 +RECTANGLE Normal 400 144 352 112 1 diff --git a/examples/Draft3.asc b/examples/Draft3.asc new file mode 100644 index 0000000..36cd5a5 --- /dev/null +++ b/examples/Draft3.asc @@ -0,0 +1,4 @@ +Version 4 +SHEET 1 880 680 +WIRE 160 144 144 144 +LINE Normal 160 144 144 144 1 diff --git a/examples/Test.asc b/examples/Test.asc index d8ea3a6..6e0d550 100644 --- a/examples/Test.asc +++ b/examples/Test.asc @@ -50,9 +50,11 @@ WIRE 1200 96 1152 96 WIRE 1312 96 1264 96 WIRE 32 112 32 64 WIRE 80 112 32 112 -WIRE 224 112 160 112 +WIRE 192 112 160 112 +WIRE 224 112 192 112 WIRE 288 112 224 112 -WIRE 400 112 368 112 +WIRE 432 112 368 112 +WIRE 496 112 432 112 WIRE 880 112 880 96 WIRE 1040 112 1040 96 WIRE 1152 112 1152 96 @@ -64,8 +66,8 @@ WIRE 96 160 -128 160 WIRE 224 160 224 112 WIRE 224 160 96 160 WIRE 288 160 224 160 -WIRE 400 160 400 112 -WIRE 400 160 288 160 +WIRE 496 160 496 112 +WIRE 496 160 288 160 WIRE 224 176 224 160 WIRE 288 176 288 160 WIRE 96 192 96 160 @@ -380,22 +382,24 @@ FLAG 800 816 +in FLAG 96 192 COM FLAG 112 272 o FLAG 192 640 o +FLAG 432 112 netLabel_gy +FLAG 192 112 Net5 SYMBOL res 64 128 R270 WINDOW 0 32 56 VTop 2 WINDOW 3 0 56 VBottom 2 SYMATTR InstName R1 -SYMATTR Value 1k +SYMATTR Value 1k5 SYMATTR Value2 someoption,another SYMBOL res 384 96 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R2 SYMATTR Value 2k -SYMBOL res 512 176 R180 +SYMBOL res 624 176 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R3 -SYMBOL res 640 112 R90 +SYMBOL res 752 112 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R4 @@ -407,6 +411,7 @@ SYMBOL circuiTikz\\res_eu -48 224 R90 WINDOW 0 -10 0 VBottom 2 WINDOW 3 10 0 VTop 2 SYMATTR InstName R5 +SYMATTR Value $\SI{10}{\kilo\ohm}$ SYMBOL circuiTikz\\res_eu2 -16 304 R90 WINDOW 0 -10 32 VBottom 2 WINDOW 3 21 32 VTop 2 @@ -780,3 +785,18 @@ TEXT -224 1008 Left 2 ;270rot,mir TEXT -352 672 Center 2 ;P TEXT -432 704 Left 2 ;orig TEXT 0 896 Center 2 ;P16b +TEXT 496 176 Left 2 ;Testtext +TEXT 560 176 Left 4 ;Testtext2 +LINE Normal 1392 1104 1312 1104 2 +LINE Normal 1392 1136 1312 1120 1 +LINE Normal 1392 1152 1312 1168 2 +LINE Normal 1424 1184 1312 1184 3 +LINE Normal 1424 1200 1312 1216 4 +LINE Normal 1456 1248 1312 1232 +LINE Normal 1440 1296 1312 1312 +LINE Normal 1504 1312 1440 1296 +LINE Normal 1584 1296 1504 1312 +LINE Normal 1632 1312 1584 1296 +RECTANGLE Normal 1632 1232 1520 1120 2 +RECTANGLE Normal 1712 1152 1664 1120 1 +RECTANGLE Normal 16 176 -160 16 2 diff --git a/examples/translate.asy2tex b/examples/translate.asy2tex index 88f71c2..43e9b6b 100644 --- a/examples/translate.asy2tex +++ b/examples/translate.asy2tex @@ -1,4 +1,4 @@ -Type {Node|Bipole|Tripole|pole} +Type {Node|Bipole|Tripole|pole|Graphical} Origin BeginPinList (optional: otherwise created from ASC pin locations PinNum x1 y1 rot length PinName diff --git a/sym32a/SchLine.asy2tex b/sym32a/SchLine.asy2tex new file mode 100644 index 0000000..117a39f --- /dev/null +++ b/sym32a/SchLine.asy2tex @@ -0,0 +1,9 @@ +Type Graphical +TexOrigin 0 0 0 False +SymOrigin 0 0 0 False +BeginPinList +EndPinList +TexElementName None +BeginTex + \draw [#self.texlinestyle#] (#self.texx1#,#self.texy1#) -- (#self.texx2#,#self.texy2#); % sch Line +EndTex diff --git a/sym32a/SchRect.asy2tex b/sym32a/SchRect.asy2tex new file mode 100644 index 0000000..87044d2 --- /dev/null +++ b/sym32a/SchRect.asy2tex @@ -0,0 +1,9 @@ +Type Graphical +TexOrigin 0 0 0 False +SymOrigin 0 0 0 False +BeginPinList +EndPinList +TexElementName None +BeginTex + \draw [#self.texlinestyle#] (#self.texx1#,#self.texy1#) rectangle (#self.texx2#,#self.texy2#); % sch Rect +EndTex diff --git a/sym32a/latex_preamble.tex b/sym32a/latex_preamble.tex index ca4be1e..ad80430 100644 --- a/sym32a/latex_preamble.tex +++ b/sym32a/latex_preamble.tex @@ -42,8 +42,10 @@ } \pgfkeys{/lt2ti/netlabel/font/.initial= \small} \pgfkeys{/lt2ti/text/font/.initial= \small} +\tikzstyle{dashdotdotted}=[dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt] \definecolor{netlabelcolor}{rgb}{0, 0, 0.25} \definecolor{lttotitextcolor}{rgb}{0, 0.4, 0.25} +\definecolor{lttotidrawcolor}{rgb}{0.6, 0.6, 0.6} \begin{document}% %\centering% diff --git a/sym32a/opamps/UniversalOpamp2.asy2tex b/sym32a/opamps/UniversalOpamp2.asy2tex index 47c6695..133faf6 100644 --- a/sym32a/opamps/UniversalOpamp2.asy2tex +++ b/sym32a/opamps/UniversalOpamp2.asy2tex @@ -5,7 +5,7 @@ BeginPinList EndPinList TexElementName op amp BeginTex - \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(0.0,0.0) node {#self.name# #self.value#}; + \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(##labelmirrorx##*0.75, ##labelmirrory##*1.25) node {#self.name# #self.value#}; \draw (#V+:x1#,#V+:y1#) to [*short, -] (#self.name#.up); \draw (#V-:x1#,#V-:y1#) to [*short, -] (#self.name#.down); % supply \draw (#In+:x1#,#In+:y1#) to [*short, -] (#self.name#.+); \draw (#In-:x1#,#In-:y1#) to [*short, -] (#self.name#.-); \draw (#OUT:x1#,#OUT:y1#) to [*short, -] (#self.name#.out); % in/out EndTex diff --git a/sym32a/opamps/differential/fullydifferentialop.asy2tex b/sym32a/opamps/differential/fullydifferentialop.asy2tex index 494eecd..5bacba7 100644 --- a/sym32a/opamps/differential/fullydifferentialop.asy2tex +++ b/sym32a/opamps/differential/fullydifferentialop.asy2tex @@ -5,7 +5,7 @@ BeginPinList EndPinList TexElementName fd op amp BeginTex - \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(0.0,0.0) node {#self.name# #self.value#}; + \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(##labelmirrorx##*0.75, ##labelmirrory##*1.25) node {#self.name# #self.value#}; \draw (#V+:x1#,#V+:y1#) to [*short, -] (#self.name#.up); \draw (#V-:x1#,#V-:y1#) to [*short, -] (#self.name#.down); % supply \draw (#In+:x1#,#In+:y1#) to [*short, -] (#self.name#.+); \draw (#In-:x1#,#In-:y1#) to [*short, -] (#self.name#.-); \draw (#OUT+:x1#,#OUT+:y1#) to [*short, -] (#self.name#.out +); \draw (#OUT-:x1#,#OUT-:y1#) to [*short, -] (#self.name#.out -);% in/out EndTex diff --git a/sym32b/SchLine.asy2tex b/sym32b/SchLine.asy2tex new file mode 100644 index 0000000..117a39f --- /dev/null +++ b/sym32b/SchLine.asy2tex @@ -0,0 +1,9 @@ +Type Graphical +TexOrigin 0 0 0 False +SymOrigin 0 0 0 False +BeginPinList +EndPinList +TexElementName None +BeginTex + \draw [#self.texlinestyle#] (#self.texx1#,#self.texy1#) -- (#self.texx2#,#self.texy2#); % sch Line +EndTex diff --git a/sym32b/SchRect.asy2tex b/sym32b/SchRect.asy2tex new file mode 100644 index 0000000..87044d2 --- /dev/null +++ b/sym32b/SchRect.asy2tex @@ -0,0 +1,9 @@ +Type Graphical +TexOrigin 0 0 0 False +SymOrigin 0 0 0 False +BeginPinList +EndPinList +TexElementName None +BeginTex + \draw [#self.texlinestyle#] (#self.texx1#,#self.texy1#) rectangle (#self.texx2#,#self.texy2#); % sch Rect +EndTex diff --git a/sym32b/latex_preamble.tex b/sym32b/latex_preamble.tex index 0c6411b..299d73d 100644 --- a/sym32b/latex_preamble.tex +++ b/sym32b/latex_preamble.tex @@ -42,8 +42,10 @@ } \pgfkeys{/lt2ti/netlabel/font/.initial= \small} \pgfkeys{/lt2ti/text/font/.initial= \small} +\tikzstyle{dashdotdotted}=[dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt] \definecolor{netlabelcolor}{rgb}{0, 0, 0.25} \definecolor{lttotitextcolor}{rgb}{0, 0.4, 0.25} +\definecolor{lttotidrawcolor}{rgb}{0.6, 0.6, 0.6} \begin{document}% %\centering% diff --git a/sym32b/opamps/UniversalOpamp2.asy2tex b/sym32b/opamps/UniversalOpamp2.asy2tex index 47c6695..133faf6 100644 --- a/sym32b/opamps/UniversalOpamp2.asy2tex +++ b/sym32b/opamps/UniversalOpamp2.asy2tex @@ -5,7 +5,7 @@ BeginPinList EndPinList TexElementName op amp BeginTex - \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(0.0,0.0) node {#self.name# #self.value#}; + \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(##labelmirrorx##*0.75, ##labelmirrory##*1.25) node {#self.name# #self.value#}; \draw (#V+:x1#,#V+:y1#) to [*short, -] (#self.name#.up); \draw (#V-:x1#,#V-:y1#) to [*short, -] (#self.name#.down); % supply \draw (#In+:x1#,#In+:y1#) to [*short, -] (#self.name#.+); \draw (#In-:x1#,#In-:y1#) to [*short, -] (#self.name#.-); \draw (#OUT:x1#,#OUT:y1#) to [*short, -] (#self.name#.out); % in/out EndTex diff --git a/sym32b/opamps/differential/fullydifferentialop.asy2tex b/sym32b/opamps/differential/fullydifferentialop.asy2tex index 494eecd..5bacba7 100644 --- a/sym32b/opamps/differential/fullydifferentialop.asy2tex +++ b/sym32b/opamps/differential/fullydifferentialop.asy2tex @@ -5,7 +5,7 @@ BeginPinList EndPinList TexElementName fd op amp BeginTex - \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(0.0,0.0) node {#self.name# #self.value#}; + \draw (#self.texx1#, #self.texy1#) node[#self.symbol.latexElementName#, xscale=##mirror_xscale_value##, rotate=##rotate##, ##options##] (#self.name#) {} (#self.name#)++(##labelmirrorx##*0.75, ##labelmirrory##*1.25) node {#self.name# #self.value#}; \draw (#V+:x1#,#V+:y1#) to [*short, -] (#self.name#.up); \draw (#V-:x1#,#V-:y1#) to [*short, -] (#self.name#.down); % supply \draw (#In+:x1#,#In+:y1#) to [*short, -] (#self.name#.+); \draw (#In-:x1#,#In-:y1#) to [*short, -] (#self.name#.-); \draw (#OUT+:x1#,#OUT+:y1#) to [*short, -] (#self.name#.out +); \draw (#OUT-:x1#,#OUT-:y1#) to [*short, -] (#self.name#.out -);% in/out EndTex diff --git a/sym48/SchLine.asy2tex b/sym48/SchLine.asy2tex new file mode 100644 index 0000000..117a39f --- /dev/null +++ b/sym48/SchLine.asy2tex @@ -0,0 +1,9 @@ +Type Graphical +TexOrigin 0 0 0 False +SymOrigin 0 0 0 False +BeginPinList +EndPinList +TexElementName None +BeginTex + \draw [#self.texlinestyle#] (#self.texx1#,#self.texy1#) -- (#self.texx2#,#self.texy2#); % sch Line +EndTex diff --git a/sym48/SchRect.asy2tex b/sym48/SchRect.asy2tex new file mode 100644 index 0000000..87044d2 --- /dev/null +++ b/sym48/SchRect.asy2tex @@ -0,0 +1,9 @@ +Type Graphical +TexOrigin 0 0 0 False +SymOrigin 0 0 0 False +BeginPinList +EndPinList +TexElementName None +BeginTex + \draw [#self.texlinestyle#] (#self.texx1#,#self.texy1#) rectangle (#self.texx2#,#self.texy2#); % sch Rect +EndTex diff --git a/sym48/latex_preamble.tex b/sym48/latex_preamble.tex index 88d6e66..a63df79 100644 --- a/sym48/latex_preamble.tex +++ b/sym48/latex_preamble.tex @@ -42,8 +42,10 @@ } \pgfkeys{/lt2ti/netlabel/font/.initial= \small} \pgfkeys{/lt2ti/text/font/.initial= \small} +\tikzstyle{dashdotdotted}=[dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt] \definecolor{netlabelcolor}{rgb}{0, 0, 0.25} \definecolor{lttotitextcolor}{rgb}{0, 0.4, 0.25} +\definecolor{lttotidrawcolor}{rgb}{0.6, 0.6, 0.6} \begin{document}% %\centering%