I want to add a normally closed push button schematic sign in a circuit. I'm a beginner in circuitikz and I couldn't find how to do it directly, only by modifying... Can someone help me?
Thanks in advance!
I want to add a normally closed push button schematic sign in a circuit. I'm a beginner in circuitikz and I couldn't find how to do it directly, only by modifying... Can someone help me?
Thanks in advance!
I create a new component named pushed button
. I copied pushbotton
and moved the bottom to \pgf@circ@res@temp
.
\documentclass{standalone}
\usepackage{circuitikz}
\makeatletter
%% Push Button
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/pushbutton/height 2}}{pushedbutton}{\ctikzvalof{bipoles/pushbutton/height}}{\ctikzvalof{bipoles/pushbutton/width}}{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgf@circ@res@temp=-\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen
\advance\pgf@circ@res@temp by -2\pgfstartlinewidth
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
\pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
\pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
\pgfusepath{draw}
\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
\pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
\pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
\pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
}
\def\pgf@circ@pushedbutton@path#1{\pgf@circ@bipole@path{pushedbutton}{#1}}
\compattikzset{pushed button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushedbutton@path, l=#1}}
\makeatother
\begin{document}
\begin{circuitikz}
\draw (0,0) to[pushed button] (2,0);
\end{circuitikz}
\end{document}