since no knowledge of style and append after command,
I applied rotate 90 degree within the command of adding capacitors with node command
in order to get horizontal capacitor.
Code: Select all
\documentclass[tikz, border=10pt]{standalone}
%\usepackage{tikz}
\usetikzlibrary{positioning}
\makeatletter
\begin{document}
\begin{tikzpicture}[
capacitor/.style = {
fill = white,
inner sep = 0pt,
minimum width = 1mm,
minimum height = 2mm,
append after command =
{ (\tikzlastnode.south west) edge[black] (\tikzlastnode.north west)
(\tikzlastnode.south east) edge[black] (\tikzlastnode.north east)} }
]
\def\height{5}
\def\width{3}
\draw (0, 0) [red] ellipse (\width cm and 1 cm);
\draw (0,-\height ) [red] ellipse (\width cm and 1 cm);
\foreach \i in { 1,...,8 } {
\coordinate (top\i) at (45*\i+138:\width cm and 1cm);
\coordinate [below = \height cm of top\i] (bottom\i);
\coordinate (capacitor-top\i) at (45*\i+138:\width cm and 1cm);
\coordinate [below = \height*0.5 cm of capacitor-top\i]
(capacitor-bottom\i);
}
\foreach \i in { 1,...,5 }
\draw [red](top\i) -- (bottom\i);
\foreach \i in { 6,...,8 }
\draw [red][dashed] (top\i) -- (bottom\i);
\foreach \i in { 1,...,8 } {
% \node [capacitor] at (capacitor-top\i) {};
% \node [capacitor] at (capacitor-top\i) {};
\node [capacitor] [rotate=90] at (capacitor-bottom\i) {};
% rotate 90 of the capacitor .
}
\end{tikzpicture}
\end{document}