我已经阅读过关于创建自定义地面符号。我还没有技能来编辑针对此问题提出的解决方案。我正在尝试获得如下图所示的地面:
以下是一个例子:
\documentclass{standalone}
\usepackage{circuitikz}
\makeatletter
\pgfdeclareshape{ground}{
\anchor{center}{
\pgfpointorigin
}
\behindforegroundpath{
\pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen
\pgfscope
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
\pgfusepath{draw}
\pgfsetlinewidth{6\pgflinewidth} % thickness
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
\pgfusepath{draw}
\endpgfscope
}
}
\makeatother
\begin{document}
\begin{circuitikz}[american voltages]
\draw
(0,0) node [ground] {}
to [V] (0,2)
;
\end{circuitikz}
\end{document}
答案1
\documentclass{standalone}
\usepackage{circuitikz}
\makeatletter
\pgfdeclareshape{ground}{
\anchor{center}{
\pgfpointorigin
}
\behindforegroundpath{
\pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen
\pgfscope
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
\pgfusepath{stroke}
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
\pgfpathmoveto{\pgfpoint{-0.67\pgf@circ@res@step}{-1.5\pgf@circ@res@step}}
\pgfpathlineto{\pgfpoint{0.67\pgf@circ@res@step}{-1.5\pgf@circ@res@step}}
\pgfpathmoveto{\pgfpoint{-0.33\pgf@circ@res@step}{-2\pgf@circ@res@step}}
\pgfpathlineto{\pgfpoint{0.33\pgf@circ@res@step}{-2\pgf@circ@res@step}}
\pgfusepath{stroke}
\endpgfscope
}
}
\makeatother
\begin{document}
\begin{circuitikz}[american voltages]
\draw
(0,0) node [ground] {}
to [V] (0,2)
;
\end{circuitikz}
\end{document}