Optimized gearbox layout

You can use coordinates for the centers of the circles. You can use quite a lot of derivations when defining those. Here I have defined some diameters for the circles that can be changed. It is not the complete picture but might be a good start.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[x=1mm,y=1mm,>=latex]
  \newcommand\Di{10}  %% Diamater of left circle
  \newcommand\Dii{30}  %% Diameter of next circle
  \newcommand\Diiia{16}  %% Diamater of inner circle
  \newcommand\Diiib{25} %% Diameter of outer circle
  \newcommand\Div{22}  %% Diameter of right circle
  \coordinate (C1) at (0,0);
  \coordinate (C2) at (\Di/2+\Dii/2,0);
  \coordinate (C3) at ($(C2)+(\Dii/2+\Diiia/2,0)$);
  \coordinate (C4) at ($(C3)+(\Diiib/2+\Div/2,0)$);
  %% 
  \draw[thick] (C1) circle (\Di/2);
  \draw[thick] (C3) circle (\Diiia/2);
  \draw[thick] (C3) circle (\Diiib/2);
  \draw[fill=white,thick] (C2) circle (\Dii/2);
  \draw[thick] (C4) circle (\Div/2);
  %% 
  \draw[gray!70] ($(C1)+(0,-30)$) -- +(0,30+\Di/2+3) node[pos=0,left,rotate=90,black]{0};
  \pgfmathparse{\Di/2+\Dii/2}\edef\res{\pgfmathresult}
  \draw[gray!70] ($(C2)+(0,-30)$) -- +(0,30+\Dii/2+3) node[pos=0,left,rotate=90,black]{\res};
  \pgfmathparse{\res+\Dii/2+\Diiia/2}\edef\res{\pgfmathresult}
  \draw[gray!70] ($(C3)+(0,-30)$) -- +(0,30+\Diiib/2+3) node[pos=0,left,rotate=90,black]{\res};
  \pgfmathparse{\res+\Diiib/2+\Div/2}\edef\res{\pgfmathresult}
  \draw[gray!70] ($(C4)+(0,-30)$) -- +(0,30+\Div/2+3) node[pos=0,left,rotate=90,black]{\res};
  \draw[gray!70] ($(C1)+(-\Di/2-3,0)$) -- ($(C4)+(\Div/2+3,0)$);
  %%
  \draw (C1 |- {(0,-28)}) circle (1pt);
  \draw[->] (C1 |- {(0,-28)}) -- (C2 |- {(0,-28)});
  \draw[->] (C2 |- {(0,-28)}) -- (C3 |- {(0,-28)});
  \draw[->] (C3 |- {(0,-28)}) -- (C4 |- {(0,-28)});
\end{tikzpicture}
\end{document}

enter image description here

Edit

To add the diameters load \usepackage{wasysym} and append the following to the picture:

  \newcommand\DrawDiameter[3]{% {<center>}{<angle>}{<diameter>}
    \ifnum#2<90\relax
      \draw[->] (#1) +(#2:#3/2+15) -- +(#2:#3/2) node[anchor=south east,pos=0,rotate=#2]{\diameter#3};
    \else
      \draw[->] (#1) +(#2:#3/2+15) -- +(#2:#3/2) node[anchor=south west,pos=0,rotate=180+#2]{\diameter#3};
    \fi
    \draw[gray!70] (#1) +(#2:#3/2) -- +(180+#2:#3/2);
    \draw[<-] (#1) ++(180+#2:#3/2) -- +(180+#2:5);
  }
  \DrawDiameter{C1}{110}{\Di}  
  \DrawDiameter{C2}{110}{\Dii}  
  \DrawDiameter{C3}{110}{\Diiia}  
  \DrawDiameter{C3}{70}{\Diiib}
  \DrawDiameter{C4}{110}{\Div}

enter image description here


First version

Just for fun.

\documentclass{standalone}
\usepackage{tikz}
\tikzset{
  % gear with same center
  gearbox/s/.code n args={3}{% prevdiameter, diameter, style 
    \path[#3] (c) circle (#2/2);
  },
  % gear on the right
  gearbox/r/.code n args={3}{% prevdiameter, diameter, style
    \path (c) ++({#1/2 + #2/2},0) coordinate (c);
    \path[#3] (c) circle (#2/2);
  },
  % a styled chain of gears
  gearbox/chain/.code 2 args={% start point, list of gears
    \coordinate (c) at #1;
    \foreach \diameter/\typeofgear/\mystyle
    [remember=\diameter as \prevdiameter (initially 0)] in {#2}{
      \tikzset{gearbox/\typeofgear={\prevdiameter}{\diameter}{\mystyle}}
    }
  },
}
\begin{document}
\begin{tikzpicture}
  \tikzset{s1/.style={draw,thick},s2/.style={draw=red,thick},s3/.style={draw=blue,thick,dashed}}
  \tikzset{
    gearbox/chain={(0,0)}{10mm/s/s1,30mm/r/s1,16mm/r/s1,25mm/s/s1,22mm/r/s1},
    gearbox/chain={(0,3cm)}{30mm/s/s2,9mm/r/s3,25mm/s/s1,13mm/r/s3,22mm/s/s1,30mm/r/s2},
  }
\end{tikzpicture}
\end{document}

enter image description here

New version

A new version with annotations and layers.

\documentclass{standalone}
\usepackage{tikz}
\pgfdeclarelayer{a}
\pgfdeclarelayer{b}
\pgfsetlayers{b,a,main}
\usepackage{amssymb}
\tikzset{
  % draw gear with diameter
  gearbox/gear with diameter/.code n args={4}{% diameter, angle, style, layer
    \pgfmathsetmacro{\r}{#1 mm/2};
    \begin{pgfonlayer}{\layer}
      \path[#3] (c) circle (\r pt);
    \end{pgfonlayer}
    \draw[gray!50!black,-latex] (c) +(#2:\r pt+1.5cm) -- node[pos=.2,above,sloped]{$\varnothing #1$} +(#2:\r pt);
    \draw[gray!50!black] (c) +(#2:\r pt) -- +(180+#2:\r pt);
    \draw[gray!50!black,-latex] (c) +(180+#2:\r pt+5mm) -- +(180+#2:\r pt);
    \draw[gray!50,dashed] (c)
    +(0:\r pt + 1cm) -- +(180:\r pt)
    +(90:20mm) -- +(-90:20mm);
  },
  % gear with same center
  gearbox/s/.code n args={4}{% prevdiameter, diameter, style, layer
    \tikzset{gearbox/gear with diameter={#2}{110}{#3}{#4}}
  },
  % gear on the right
  gearbox/r/.code n args={4}{% prevdiameter, diameter, style, layer
    \pgfmathsetmacro{\gearpos}{\gearpos+#1/2+#2/2}
    \global\let\gearpos\gearpos
    \draw[-latex] ([yshift=-20mm]c) -- ++({#1 mm/2 + #2 mm/2},0);
    \path (c) ++({#1 mm/2 + #2 mm/2},0) coordinate (c);
    \tikzset{gearbox/gear with diameter={#2}{70}{#3}{#4}}
    \path ([yshift=-20mm]c) node[below=1mm,fill=white,inner sep=.1em]{\gearpos};

  },
  % a styled chain of gears
  gearbox/chain/.code 2 args={
    \pgfmathsetmacro{\gearpos}{0};
    \coordinate (c) at #1;
    \foreach \diameter/\typeofgear/\mystyle/\layer
    [remember=\diameter as \prevdiameter (initially 0)] in {#2}{
      \tikzset{gearbox/\typeofgear={\prevdiameter}{\diameter}{\mystyle}{\layer}}
    }
  },
}

\begin{document}
\begin{tikzpicture}
  \tikzset{
    s1/.style={draw,thick,fill=white},
    s2/.style={draw=red,thick,fill=red!10},
    s3/.style={draw=blue,thick,fill=blue!10},
  }
  \tikzset{
    gearbox/chain={(0,0)}{10/s/s1/a,30/r/s1/a,16/r/s1/a,25/s/s1/b,22/r/s1/a},
    gearbox/chain={(0,6cm)}{30/s/s2/a,8/r/s2/a,25/s/s1/b,22/r/s1/b,13/s/s3/a,30/r/s3/a},
  }
\end{tikzpicture}
\end{document}

enter image description here

Tags:

Tikz Pgf