6

I now did it manually, but I'm interested in how I can do this with a loop:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\tikzstyle{Punkt} = [coordinate]

\node[Punkt] (Center) at (0, 0) {};
\draw[-, thick, fill=black!30!white]{[rounded corners=1.5pt] ([shift={(30:1.2)}]Center)  arc (30:34:1.2) -- 
                                             ([shift={(36:1.5)}]Center)  arc (36:84:1.5) --  
                                             ([shift={(86:1.2)}]Center)  arc (86:94:1.2) --
                                             ([shift={(96:1.5)}]Center)  arc (96:144:1.5) --
                                             ([shift={(146:1.2)}]Center)  arc (146:154:1.2) --
                                             ([shift={(156:1.5)}]Center)  arc (156:204:1.5) --
                                             ([shift={(206:1.2)}]Center)  arc (206:214:1.2) --
                                             ([shift={(216:1.5)}]Center)  arc (216:264:1.5) --
                                             ([shift={(266:1.2)}]Center)  arc (266:274:1.2) --
                                             ([shift={(276:1.5)}]Center)  arc (276:324:1.5) --
                                             ([shift={(326:1.2)}]Center)  arc (326:334:1.2) --
                                             ([shift={(336:1.5)}]Center)  arc (336:384:1.5) --
                                             ([shift={(386:1.2)}]Center)  arc (386:390:1.2)                                     
                                            };
\draw [fill=white, opacity=1, thick] (Center) circle [radius=1];

\end{tikzpicture}

\end{document} 

pic1

If I try something like this:

\foreach \i in {1,2,...,6}{ 
\draw[-, fill=green][rotate=(\i-1)*360/6] 
{[rounded corners=1.5pt] ([shift={(29:1.2)}]Center)  arc (29:34:1.2) -- 
([shift={(36:1.5)}]Center)  arc (36:84:1.5) --  
([shift={(86:1.2)}]Center)  arc (86:91:1.2);
}

It is only filled between the start- and end-point of each segment:

pic2

Thank you for help. Konne

7

Put the \foreach inside the \draw. This makes it a single path and thus fully fillable.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\tikzstyle{Punkt} = [coordinate]

\node[Punkt] (Center) at (0, 0) {};

\draw[-, fill=green]  ([shift={(29:1.2)}]Center)
\foreach \i in {1,2,...,6}{ 
  [rotate=(\i-1)*360/6]
  {[rounded corners=1.5pt]  arc (29:34:1.2)    -- 
([shift={(36:1.5)}]Center)  arc (36:84:1.5) --  
([shift={(86:1.2)}]Center)  arc (86:91:1.2) --   ([shift={(89:1.2)}]Center)
}
};

\draw [fill=white, opacity=1, thick] (Center) circle [radius=1];


\end{tikzpicture}

\end{document} 

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.