Tikz Mechanical picture Fix issues

  1. To make adjustments to the positions of the labels you can use xshift and yshift

  2. You can also adjust the coordinates of (m_a1.north west) and (m_a1.south west) using xshift and yshift. These go inside using square brackets, e.g. ([yshift=-1mm]m_a1.north west).

  3. For a Times New Roman style font, I recommend using newtx.

enter image description here

\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\usepackage{newtxtext,newtxmath}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,positioning}

\begin{document}
\tikzset{spring/.style={thick,decorate,decoration={zigzag,pre length=0.3cm,post
length=0.3cm,segment length=6}},
short spring/.style={thick,decorate,decoration={zigzag,pre length=0.05cm,post
length=0.05cm,segment length=6}},
damper/.style={thick,decoration={markings,  
mark connection node=dmp,
mark=at position 0.5 with 
{
 \node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum 
 width=15pt,minimum height=3pt,draw=none] {};
\draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
 }
}, decorate},
ground/.style={fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm},
ground_magenta/.style={fill,pattern=north east lines,pattern color=magenta,draw=none,minimum
width=0.75cm,minimum height=0.3cm}}

\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick},font=\sffamily]

%ORIGINAL SYSTEM
\node (m_1) [minimum width=1cm,minimum height=0.8cm]{$m_1$};
\node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_2$};
\draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]{$k_{12}$};
\node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground1.south west) -- (ground1.south east); 
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g1}$} ;


\node (m_3)[right of= m_2,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_3$};
\draw [spring] (m_2.east) -- (m_3.west) node[midway,below=1mm,draw=none]{$k_{23}$};
\node (ground2) at (m_2.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground2.south west) -- (ground2.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground2.south) -| (m_2.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g2}$} ;

\node (m_4)[right of= m_3,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_4$};
\draw [spring] (m_3.east) -- (m_4.west) node[midway,below=1mm,draw=none]{$k_{34}$};
\node (ground3) at (m_3.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground3.south west) -- (ground3.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground3.south) -| (m_3.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g3}$} ;

\node (m_5)[right of= m_4,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_5$};
\draw [spring] (m_4.east) -- (m_5.west) node[midway,below=1mm,draw=none]{$k_{45}$};
\node (ground4) at (m_4.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground4.south west) -- (ground4.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground4.south) -| (m_4.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g4}$} ;

\node (ground5) at (m_5.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground5.south west) -- (ground5.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground5.south) -| (m_5.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g5}$} ;

\node (m_a1)[right of= m_5,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm,yshift=1cm,ultra thick]{$m_{a1}$};
\node (m_a2)[right of= m_a1,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm,ultra thick]{$m_{a2}$};
\draw [spring,ultra thick] (m_a1.east) -- (m_a2.west) node[midway,below=1mm,draw=none]{$k_{a3}$};
\draw [ultra thick,decorate,decoration={zigzag,pre
length=3cm,post length=0.85cm,segment length=6}] (m_4.north) |- ([yshift=-1.5mm]m_a1.north west) node[midway,above=2mm,xshift=28mm,draw=none]{$k_{a1}$} ;
\draw [ultra thick,decorate,decoration={zigzag,pre
length=0.8cm,post length=0.65cm,segment length=6}] (m_5.north) |- ([yshift=1.5mm]m_a1.south west) node[midway,below=1mm,xshift=9mm,draw=none]{$k_{a2}$} ;

\end{tikzpicture}

\end{document}  

Slightly different from Milo's nice answer.

  1. midway in conjunction of -| is a bit tricky as this will be the coordinate of the kink. pos=0.75 is in the middle of the vertical stretch and pos=0.25 in the middle of the horizontal one. I thus propose just to play with pos=... instead of adding too many xshifts.
  2. north west corresponds to 135. If you use 145 instead you are slightly below north west.
  3. I am not an expert on fonts, sorry.

Here's the code.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,positioning}

\begin{document}
\tikzset{spring/.style={thick,decorate,decoration={zigzag,pre length=0.3cm,post
length=0.3cm,segment length=6}},
short spring/.style={thick,decorate,decoration={zigzag,pre length=0.05cm,post
length=0.05cm,segment length=6}},
damper/.style={thick,decoration={markings,  
mark connection node=dmp,
mark=at position 0.5 with 
{
 \node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum 
 width=15pt,minimum height=3pt,draw=none] {};
\draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
 }
}, decorate},
ground/.style={fill,pattern=north east lines,draw=none,minimum
width=0.75cm,minimum height=0.3cm},
ground_magenta/.style={fill,pattern=north east lines,pattern color=magenta,draw=none,minimum
width=0.75cm,minimum height=0.3cm}}

\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick},font=\sffamily]

%ORIGINAL SYSTEM
\node (m_1) [minimum width=1cm,minimum height=0.8cm]{$m_1$};
\node (m_2)[right of= m_1,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_2$};
\draw [spring] (m_1.east) -- (m_2.west) node[midway,below=1mm,draw=none]{$k_{12}$};
\node (ground1) at (m_1.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground1.south west) -- (ground1.south east); 
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground1.south) -| (m_1.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g1}$} ;


\node (m_3)[right of= m_2,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_3$};
\draw [spring] (m_2.east) -- (m_3.west) node[midway,below=1mm,draw=none]{$k_{23}$};
\node (ground2) at (m_2.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground2.south west) -- (ground2.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground2.south) -| (m_2.south) node[midway,below=1mm,xshift=-3mm,draw=none]{$k_{g2}$} ;

\node (m_4)[right of= m_3,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_4$};
\draw [spring] (m_3.east) -- (m_4.west) node[midway,below=1mm,draw=none]{$k_{34}$};
\node (ground3) at (m_3.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground3.south west) -- (ground3.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground3.south) -|
(m_3.south) node[midway,below=2pt,xshift=-3mm,draw=none]{$k_{g3}$} ;

\node (m_5)[right of= m_4,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm]{$m_5$};
\draw [spring] (m_4.east) -- (m_5.west) node[midway,below=2pt,draw=none]{$k_{45}$};
\node (ground4) at (m_4.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground4.south west) -- (ground4.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground4.south) -|
(m_4.south) node[midway,below=2pt,xshift=-3mm,draw=none]{$k_{g4}$} ;

\node (ground5) at (m_5.south west) [ground,yshift=-0.8cm,xshift=-0.5cm,rotate=90,anchor=north] {};
\draw (ground5.south west) -- (ground5.south east);
\draw [thick,decorate,decoration={zigzag,pre
length=0.1cm,post length=0.85cm,segment length=6}] (ground5.south) -|
(m_5.south) node[midway,below=2pt,xshift=-3mm,draw=none]{$k_{g5}$} ;

\node (m_a1)[right of= m_5,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm,yshift=1cm,ultra thick]{$m_{a1}$};
\node (m_a2)[right of= m_a1,node distance=2.5cm,minimum width=1cm,minimum height=0.8cm,ultra thick]{$m_{a2}$};
\draw [spring,ultra thick] (m_a1.east) -- (m_a2.west) node[midway,below=2pt,draw=none]{$k_{a3}$};
\draw [ultra thick,decorate,decoration={zigzag,pre
length=3cm,post length=0.85cm,segment length=6}] (m_4.north) |- (m_a1.145)
node[pos=0.8,below=2pt,draw=none]{$k_{a1}$} ;
\draw [ultra thick,decorate,decoration={zigzag,pre
length=0.5cm,post length=0.85cm,segment length=6}] (m_5.north) |- (m_a1.215) 
node[pos=0.7,below=2pt,draw=none]{$k_{a2}$} ;

\end{tikzpicture}

\end{document}  

enter image description here

Tags:

Tikz Pgf