# Draw an electrical machine

I want to draw the following figure on Tikz: I have tried with this code, but the lines are distorced:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=0.6,xscale=0.6]
\def\n{24}
\def\nst{6}
\coordinate (O) at (0,0);

\draw[black, line width=1mm] (0,0) circle (5);
\draw[line width=0.3mm] (0,0) circle (1);

\draw (7.5,0) node [anchor=east][inner sep=0.75pt]    {$A_Z = 0$};

\foreach \angle in {1,...,\n}{%
\pgfmathsetmacro\compute{\angle*360/\n}
\begin{scope}[rotate around={\compute:(O)}]

\draw (3.5,0) -- ++(0:0.5)  arc (0:7.5:3.5) -- ++(7.5:-0.5) arc (0:7.5:3);

\draw (4,0) arc (0:7.5:4);

\end{scope}
}

\foreach \angle in {1,...,\nst}{%
\pgfmathsetmacro\compute{\angle*360/\nst}
\begin{scope}[rotate around={\compute:(O)}]

\draw (2,0) -- ++ (0:0.3) arc (0:-10:2) -- ++ (0:0.5);
\end{scope}
}

\end{tikzpicture}
\end{document} Does anybody can give me some tips and help me?

• Try adding cm to the radius in arc. Oct 17, 2021 at 16:18
• I tried, but did not result :/ Oct 17, 2021 at 16:31

This is a possibility. All is pretty straightforward except for the blue lines. For them I used the calc library to previously compute some coordinates (rotating a scope).

This is my code:

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,thick,rotate=30]
\draw[line width=1mm,fill=gray!15] (0,0) circle (5);
\draw[red,fill=white] (-1.5:4) foreach\i in {0,10,...,350} {arc (\i-1.5:\i+1.5:4) -- (\i+1.5:3.5) arc (\i+1.5:\i+8.5:3.5) -- (\i+8.5:4)};
\foreach\i in {1,2,...,6}
{
\begin{scope}[rotate=60*\i-60]
\coordinate (A\i) at (-10:2.5);
\coordinate (B\i) at ($(A\i)+(0.4,0)$);
\coordinate (C\i) at ($(A\i)+(0.4,-0.2)$);
\coordinate (D\i) at ($(A\i)+(0.6,-0.2)$);
\coordinate (H\i) at (10:2.5);
\coordinate (G\i) at ($(H\i)+(0.4,0)$);
\coordinate (F\i) at ($(H\i)+(0.4,0.2)$);
\coordinate (E\i) at ($(H\i)+(0.6,0.2)$);
\end{scope}
}
\draw[blue,fill=blue!20] (A1) \foreach\i in {1,...,6}
{-- (B\i) -- (C\i) -- (D\i) to[out=60*\i+10,in=60*\i+230]
(E\i) -- (F\i) -- (G\i) -- (H\i) arc (60*\i-50:60*\i-10:2.5)};
\draw[fill=white] (0,0) circle (1.5);
\end{tikzpicture}
\end{document}


Edit 1: And these are the coordinates I'm using. Edit 2: A little bit explanation of some syntax. Let's take a look at the line

\draw[red,fill=white] (-1.5:4) foreach\i in {0,10,...,350} {arc (\i-1.5:\i+1.5:4) ...};


This will draw a complex path starting at the point (-1.5:4), that is, a point which polar coordinates are radius 4 (4 cm from the origin) and angle -1.5 (1.5 degrees from the x-axis, clockwise). Then it will repeat the code inside the curly brackets six times, substituting \i for the values 0,60,120,180,240,300. For example, the first iteration will be for \i=0, so

\draw[red,fill=white] (-1.5:4) arc (0-1.5:0+1.5:4) ...;


So the first part of the complex path will be an arc starting at the point (-1.5:4) with an initial angle of -1.5 degrees, a final angle of 1.5 degrees and a radius of 4 cm. In this case all the angles are centered at the origin, but for more information about the center of the arcs this post could be helpful: How is arc defined in TikZ?

• +1 very nice figure -- can you kindly educate on the arc syntax Oct 18, 2021 at 1:25
• Thanks @jsbibra!!! I made an edit with some explanations about the syntax. Oct 18, 2021 at 5:20
{"ft_lang_label":"__label__en","ft_lang_prob":0.7178417,"math_prob":0.9951913,"size":2184,"snap":"2022-27-2022-33","text_gpt3_token_len":844,"char_repetition_ratio":0.13394496,"word_repetition_ratio":0.020338982,"special_character_ratio":0.41712454,"punctuation_ratio":0.24046434,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9994382,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,2,null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-08-16T20:12:58Z\",\"WARC-Record-ID\":\"<urn:uuid:e4930390-94c8-4fec-8943-04ad28b70ac9>\",\"Content-Length\":\"231096\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5d6aa03f-227d-4183-b3b6-11085d3c36ea>\",\"WARC-Concurrent-To\":\"<urn:uuid:29f784a9-a3ab-44ff-ade3-95bb70606a8a>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/619311/draw-an-electrical-machine/619318\",\"WARC-Payload-Digest\":\"sha1:54JTBTJYV6OQXP6NZXFUWFHHUIO5XNPS\",\"WARC-Block-Digest\":\"sha1:QNDYVQ6YYPR2HPS3H5UM353CDAZFVVXV\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-33/CC-MAIN-2022-33_segments_1659882572515.15_warc_CC-MAIN-20220816181215-20220816211215-00642.warc.gz\"}"}