Skip to content

Commit

Permalink
improved net labels and text output: Now handled by asc2tex files as …
Browse files Browse the repository at this point in the history
…well.
  • Loading branch information
CKuhlmann committed May 3, 2017
1 parent 70c38a5 commit c95e7d8
Show file tree
Hide file tree
Showing 17 changed files with 471 additions and 151 deletions.
524 changes: 377 additions & 147 deletions lt2ti.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This is lt2circuitTikz.
It reads the schematic files produced by LTspice (R) and converts them into a latex graphic using pgfplot,tikz and circuitikz.
These graphics can then be compiled using pdflatex into pdf format.

This translation process requires the following
This translation process requires the following (in addition to python 3.5+)
1) an input *.asc schematic of version 4 (LTspice IV and XVII)
2) for every schematic component, the corresponding *.asy symbol file, copied to the sym32a subdirectory
if the symbol is not in the LTspice library root folder, the symbol must be copied to a subfolder structure with the same relative path as the symbol file in the library directory.
Expand Down
6 changes: 5 additions & 1 deletion sym32a/latex_preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\documentclass[tikz,margin={2pt 2pt 2pt 2pt}]{standalone}
\usepackage[compatibility,siunitx, americanvoltages, americancurrents, europeanresistors, europeaninductors, americanports,%
straightlabels, fetbodydiode]{circuitikz}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfkeys,siunitx,ifthen}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfkeys,siunitx,ifthen,ulem}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usetikzlibrary{shapes,arrows}
Expand Down Expand Up @@ -40,6 +40,10 @@
/tikz/circuitikz/tripoles/op amp/width=1.2,%
/tikz/circuitikz/tripoles/op amp/font=\footnotesize,
}
\pgfkeys{/lt2ti/netlabel/font/.initial= \small}
\pgfkeys{/lt2ti/text/font/.initial= \small}
\definecolor{netlabelcolor}{rgb}{0, 0, 0.25}
\definecolor{lttotitextcolor}{rgb}{0, 0.4, 0.25}

\begin{document}%
%\centering%
Expand Down
3 changes: 3 additions & 0 deletions sym32a/netlabel.asy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 4
SymbolType CELL
LINE Normal 3 0 -3 0
10 changes: 10 additions & 0 deletions sym32a/netlabel.asy2tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Type Bipole
TexOrigin 0 0 0 False
SymOrigin 0 0 0 False
BeginPinList
EndPinList
TexElementName *netlabel
BeginTex
\node (#self.label#) [] at (#self.texx1#,#self.texy1#) {};% label mark
\node (#self.label#txt) [##options## netlabelcolor, above= -0.25cm of #self.label#] {{\pgfkeysvalueof{/lt2ti/netlabel/font}#self.labelstr#}};
EndTex
3 changes: 3 additions & 0 deletions sym32a/text.asy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 4
SymbolType CELL
LINE Normal 3 0 -3 0
10 changes: 10 additions & 0 deletions sym32a/text.asy2tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Type Bipole
TexOrigin 0 0 0 False
SymOrigin 0 0 0 False
BeginPinList
EndPinList
TexElementName *netlabel
BeginTex
\node (#self.value#) [] at (#self.texx1#,#self.texy1#) {};% text mark
\node (#self.value#txt) [##options## lttotitextcolor, right= -0.25cm of #self.value#, scale=0.5*#self.size#] {{\pgfkeysvalueof{/lt2ti/text/font}#self.textstr#}};
EndTex
6 changes: 5 additions & 1 deletion sym32b/latex_preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\documentclass[tikz,margin={2pt 2pt 2pt 2pt}]{standalone}
\usepackage[compatibility,siunitx, americanvoltages, americancurrents, europeanresistors, europeaninductors, americanports,%
straightlabels, fetbodydiode]{circuitikz}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfkeys,siunitx,ifthen}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfkeys,siunitx,ifthen,ulem}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usetikzlibrary{shapes,arrows}
Expand Down Expand Up @@ -40,6 +40,10 @@
/tikz/circuitikz/tripoles/op amp/width=1.2,%
/tikz/circuitikz/tripoles/op amp/font=\footnotesize,
}
\pgfkeys{/lt2ti/netlabel/font/.initial= \small}
\pgfkeys{/lt2ti/text/font/.initial= \small}
\definecolor{netlabelcolor}{rgb}{0, 0, 0.25}
\definecolor{lttotitextcolor}{rgb}{0, 0.4, 0.25}

\begin{document}%
%\centering%
Expand Down
3 changes: 3 additions & 0 deletions sym32b/netlabel.asy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 4
SymbolType CELL
LINE Normal 3 0 -3 0
10 changes: 10 additions & 0 deletions sym32b/netlabel.asy2tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Type Bipole
TexOrigin 0 0 0 False
SymOrigin 0 0 0 False
BeginPinList
EndPinList
TexElementName *netlabel
BeginTex
\node (#self.label#) [] at (#self.texx1#,#self.texy1#) {};% label mark
\node (#self.label#txt) [##options## netlabelcolor, above= -0.25cm of #self.label#] {{\pgfkeysvalueof{/lt2ti/netlabel/font}#self.labelstr#}};
EndTex
3 changes: 3 additions & 0 deletions sym32b/text.asy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 4
SymbolType CELL
LINE Normal 3 0 -3 0
10 changes: 10 additions & 0 deletions sym32b/text.asy2tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Type Bipole
TexOrigin 0 0 0 False
SymOrigin 0 0 0 False
BeginPinList
EndPinList
TexElementName *netlabel
BeginTex
\node (#self.value#) [] at (#self.texx1#,#self.texy1#) {};% text mark
\node (#self.value#txt) [##options## lttotitextcolor, right= -0.25cm of #self.value#, scale=0.5*#self.size#] {{\pgfkeysvalueof{/lt2ti/text/font}#self.textstr#}};
EndTex
6 changes: 5 additions & 1 deletion sym48/latex_preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\documentclass[tikz,margin={2pt 2pt 2pt 2pt}]{standalone}
\usepackage[compatibility,siunitx, americanvoltages, americancurrents, europeanresistors, europeaninductors, americanports,%
straightlabels, fetbodydiode]{circuitikz}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfkeys,siunitx,ifthen}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfkeys,siunitx,ifthen,ulem}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usetikzlibrary{shapes,arrows}
Expand Down Expand Up @@ -40,6 +40,10 @@
% /tikz/circuitikz/tripoles/op amp/height=0.5,%
% /tikz/circuitikz/tripoles/op amp/width=0.5,%
}
\pgfkeys{/lt2ti/netlabel/font/.initial= \small}
\pgfkeys{/lt2ti/text/font/.initial= \small}
\definecolor{netlabelcolor}{rgb}{0, 0, 0.25}
\definecolor{lttotitextcolor}{rgb}{0, 0.4, 0.25}

\begin{document}%
%\centering%
Expand Down
3 changes: 3 additions & 0 deletions sym48/netlabel.asy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 4
SymbolType CELL
LINE Normal 3 0 -3 0
10 changes: 10 additions & 0 deletions sym48/netlabel.asy2tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Type Bipole
TexOrigin 0 0 0 False
SymOrigin 0 0 0 False
BeginPinList
EndPinList
TexElementName *netlabel
BeginTex
\node (#self.label#) [] at (#self.texx1#,#self.texy1#) {};% label mark
\node (#self.label#txt) [##options## netlabelcolor, above= -0.25cm of #self.label#] {{\pgfkeysvalueof{/lt2ti/netlabel/font}#self.labelstr#}};
EndTex
3 changes: 3 additions & 0 deletions sym48/text.asy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 4
SymbolType CELL
LINE Normal 3 0 -3 0
10 changes: 10 additions & 0 deletions sym48/text.asy2tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Type Bipole
TexOrigin 0 0 0 False
SymOrigin 0 0 0 False
BeginPinList
EndPinList
TexElementName *netlabel
BeginTex
\node (#self.value#) [] at (#self.texx1#,#self.texy1#) {};% text mark
\node (#self.value#txt) [##options## lttotitextcolor, right= -0.25cm of #self.value#, scale=0.5*#self.size#] {{\pgfkeysvalueof{/lt2ti/text/font}#self.textstr#}};
EndTex

0 comments on commit c95e7d8

Please sign in to comment.