# Slightly complicated free body diagram

I would like to use TikZ to draw the following drawing:

I am brand new to TikZ. My first attempt is

\begin{tikzpicture}[>=Latex]

\draw[thick] (0,0) rectangle (10mm,10mm);
\node at (0.5,0.5) {$M_{1}$};
\draw[thick,->](0.5,0)--(0.5,-1)node[below]{$M_{1}g$};
\draw[thick,->](0.5,1)--(0.5,2)node[above]{$T_1$};
\draw[thick,->](1,0.5)--(2,0.5)node[right]{$N_{31}$};

\draw[thick] (2,0) rectangle (10mm,10mm);
\node at (4.5,0.5) {$M_{1}$};
\draw[thick,->](4.5,0)--(4.5,-1)node[below]{$M_{1}g$};
\draw[thick,->](4.5,1)--(4.5,2)node[above]{$T_1$};
\draw[thick,->](4,0.5)--(3,0.5)node[above]{$N_{31}$};
\end{tikzpicture}


which draws the first two rectangles. However the second rectangle is drawn next to the first (no space like the space between the M1 and M2 rectangles). I am also not sure how to build the circle in M3. Any pointers would be appreciated.

Welcome to TeX.SE! I think that one of the greatest advantages of TikZ is that you can do almost everything with relative coordinates. This is illustrated by the following MWE, in which no object is positioned at an absolute coordinate (except for the very first box).

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,arrows.meta,angles,quotes}
\begin{document}
\begin{tikzpicture}[>=Latex,Box/.style={draw,thick,minimum width=10mm,minimum
height=10mm}]
% first box
\node[Box] (M1){$M_{1}$};
\draw[thick,->](M1.south) -- ++(0,-0.5) node[below]{$M_{1}g$};
\draw[thick,->](M1.north) --  ++(0,0.5) node[above]{$T_1$};
\draw[thick,->](M1.east) -- ++(0.5,0) node[right] (N31){$N_{31}$};
% second box
\node[Box,right=1mm of N31] (M2){$M_{2}$};
\draw[thick,->](M2.south) -- ++(0,-0.5) node[below]{$M_{2}g$};
\draw[thick,->](M2.north) --  ++(0,0.5) node[above]{$N_{32}$};
\draw[thick,->](M2.east) -- ++(0.5,0) node[right] (T1){$T_{1}$};
% third box
\node[Box,right=1.5cm of M2,minimum size=2cm] (M3){$M_{3}$};
\draw[thick,->](M3.north) --  ++(0,0.5) node[above]{$N_{3}$};
\draw[thick](M3.north east) --  ++(0.3,0.3) node[circle,draw,minimum
size=3mm,fill=white] (Circ){};
\draw[thick,->] (Circ.north) -- ++(-0.5,0) node[left]{$T_1$};
\draw[thick,->] (Circ.east) -- ++(0,-0.5) node[below]{$T_1$};
\draw[thick,->]([xshift=-4mm]M3.south) -- ++(0,-0.5) node[below]{$M_{3}g$};
\draw[thick,->]([xshift=4mm]M3.south) -- ++(0,-0.5) node[below]{$N_{23}$};
% fourth box
\node[Box,right=1.5cm of M3,minimum size=1.5cm] (M4){$M_{4}$};
\draw[thick,->](M4.south) -- ++(0,-0.5) node[below]{$M_{4}g$};
\draw[thick,->](M4.north) --  ++(0,0.5) node[above]{$N_{4}$};
\draw[dashed]([yshift=-3mm]M4.north east) coordinate (aux1) --  ++(0.7,0) coordinate (aux2);
\draw[thick,->] (aux1) -- ++ (0.7,-0.7) coordinate (aux3) node[below]{$T_2$};
\draw pic ["$\theta$",angle eccentricity=1.33,draw,-,angle radius=4mm]
{angle = aux3--aux1--aux2};
\end{tikzpicture}
\end{document}


Let me try to explain a bit what's going on here.

1. The positioning library is used to position objects (nodes) relative to each other. For instance, \node[Box,right=1.5cm of M2,minimum size=2cm] (M3){$M_{3}$}; says that the box M3 should be 1.5cm right of M2. This has the big advantage that if you decide that the distance between M2 and M3 is to be increased, you only increase 1.5cm and everything else will move automatically. No need to adjust tons of coordinates.
2. As you see, I use nodes to draw these boxes. Apart from the fact that I do not have to draw the rectangles around the text, I can used the anchors of the node(s) to draw other elements like \draw[thick,->](M1.south) -- ++(0,-0.5) node[below]{$M_{1}g$};. Here, I draw an arrow from the middle of the lower boundary, i.e. the south anchor, 0.5cm into the negative y direction and add a node below.
3. This also helps to draw the circle, where I just attach the arrows to the north and east anchors.
4. TikZ also has a library that allows one to draw and annotate angles, which is illustrated in \draw pic ["$\theta$",angle eccentricity=1.33,draw,-,angle radius=4mm] {angle = aux3--aux1--aux2};.
• Your advice comes to me like a glove! I am starting to make preliminary free body diagrams with Office and in a while I will move to LaTeX. If you're curious, see here and here. :) – manooooh Sep 27 '18 at 5:59
• @manooooh You are the first duck wearing a glove that I know of. ;-) – user121799 Sep 27 '18 at 6:59