0

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?

closed position

Thanks in advance!

  • 1
    Welcome! Please provide us with what you've tried so far. – user121799 Jun 10 '18 at 0:39
  • 1
    How do you do it modifying, for example? (I don't know what this means, so I don't know what you're asking, but post what you have and it might be a bit clearer to somebody.) – cfr Jun 10 '18 at 1:58
  • Thank you. Well, here is a link where I saw how it is possible bonlacfoods.com/pdf/018827679.pdf but at the moment I'm kind of slow learner and did not manage how to do that. It is all explained, I know :( – Vanessa Garcez Jun 10 '18 at 13:48
1

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}

demo

  • Thank you so much!! It works perfectly. When I grow up I want to be like you :)) – Vanessa Garcez Jun 10 '18 at 17:36
  • The work if fine, but the pay is lousy. – John Kormylo Jun 11 '18 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.