我想在 TikZ 中绘制一个圆环,如下面的示例图所示:
我已经发现了一些东西:修改TikZ线圈装饰
但我不知道该如何将其变成一个圆圈。
首先,是的,它必须是 Tikz,没有其他选择!其次,是的,它必须看起来完全一样!任何帮助都非常感谢!
答案1
我会使用极坐标和循环。
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[declare function={R=3cm;r=1cm;w=5mm;
Rp=R+0.5*r+0.5*w;Rm=R-0.5*r-0.5*w;}]
\draw[line width=w,line cap=round] foreach \X in {-1,...,6}
{(15+\X*30:Rp) -- (\X*30:Rm)} (-R,-2*R) -- (210:Rm);
\draw[fill=gray,even odd rule] circle[radius=R+0.5*r] circle[radius=R-0.5*r];
\draw[line width=w,line cap=round] foreach \X in {0,...,7}
{(\X*30:Rm) -- (-15+\X*30:Rp)}
(R,-2*R) -- (-30:Rm);
\end{tikzpicture}
\end{document}
答案2
我想我找到了一种方法:
\begin{circuitikz}
%\tikzstyle{help lines}=[blue!50];
%\draw[style=help lines] (0,0) grid (10,10);
%%%
\draw[line width=12,line cap=round] (3.00,2) -- (4.20,4.2);
\draw[line width=12,line cap=round] (2.75,4.5) -- (4.00,5.1);
\draw[line width=12,line cap=round] (3.20,6.40) -- (4.5,5.8);
\draw[line width=12,line cap=round] (4.5,7.3) -- (5.1,6.1);
\draw[line width=12,line cap=round] (5.9,7.1) -- (5.8,5.8);
\draw[line width=12,line cap=round] (7,6) -- (6,5.1);
\draw[line width=12,line cap=round] (7.2,4.5) -- (5.8,4.2);
%%%
\path [draw=black,fill=lightgray, even odd rule]
(5,5) circle (2.1) (5,5) circle (1.3);
%%%
\draw[line width=12,line cap=round] (4.20,4.2) -- (2.75,4.50);
\draw[line width=12,line cap=round] (4.00,5.1) -- (3.20,6.40);
\draw[line width=12,line cap=round] (4.5,5.8) -- (4.5,7.3);
\draw[line width=12,line cap=round] (5.1,6.1) -- (5.9,7.1);
\draw[line width=12,line cap=round] (5.8,5.8) -- (7,6);
\draw[line width=12,line cap=round] (6,5.1) -- (7.2,4.5);
\draw[line width=12,line cap=round] (5.8,4.2) -- (7,2);
\end{circuitikz}