3

I am trying to draw some curved torsional springs and curved dampers in a mechanical system drawing. There are a number of questions on this site which deal with how to draw spring and damper components (see, for example, Drawing Mechanical Systems in LaTeX), however, these all deal with springs and dampers which are not curved.

Specifically, I am trying to replicate this diagram:

enter image description here Here's what I've got so far:

enter image description here

Code

\documentclass[tikz,margin=1cm]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}

\tikzstyle{interface}=[postaction={draw,decorate,decoration={border,angle=-30,amplitude=0.1cm,segment length=0.6mm}}]
\tikzstyle{interfaceflipped}=[postaction={draw,decorate,decoration={border,angle=30,amplitude=0.1cm,segment length=0.6mm}}]

\newcommand\beamL{5cm}
\newcommand\beamH{0.1cm}
\newcommand\massL{0.5cm}
\newcommand\massH{0.5cm}

\draw (0,0)--++(0,-\beamH)--++(\beamL,0)--++(0,2*\beamH)--++(-\beamL,0)--cycle;
\draw (0,0)--++(0,-\massH)--++(-\massL,0)--++(0,2*\massH)--++(\massL,0)--cycle;
\draw [xshift=\beamL+\massL] (0,0)--++(0,-\massH)--++(-\massL,0)--++(0,2*\massH)--++(\massL,0)--cycle;

\coordinate (G1) at (5.5,-1); % Coordinates of ground 1
\path (G1) +(150:0.2) coordinate (G1start);
\draw [interface] (G1start)--++(-30:0.4);
\draw plot [smooth, tension=1] coordinates {(\beamL,\beamH) ([yshift = 0.5cm,xshift = -0.08cm]\beamL,\beamH) ([yshift = 0.8cm]\beamL+\massL,\beamH) ([yshift = 1.1cm,xshift = 0.5cm]G1) (G1)};

\coordinate (G2) at (6.1,-1); % Coordinates of ground 2
\path (G2) +(150:0.2) coordinate (G2start);
\draw [interface] (G2start)--++(-30:0.4);
\draw plot [smooth, tension=1] coordinates {(\beamL-0.2cm,\beamH) ([yshift = 0.8cm,xshift = -0.08cm]\beamL-0.2cm,\beamH) ([yshift = 1.3cm]\beamL+\massL,\beamH) ([yshift = 1.3cm,xshift = 0.5cm]G2) (G2)};

\begin{scope}[xshift=\beamL,xscale=-1]
\coordinate (G3) at (5.5,-1); % Coordinates of ground 3
\path (G3) +(150:0.2) coordinate (G3start);
\draw [interfaceflipped] (G3start)--++(-30:0.4);
\draw plot [smooth, tension=1] coordinates {(\beamL,\beamH) ([yshift = 0.5cm,xshift = -0.08cm]\beamL,\beamH) ([yshift = 0.8cm]\beamL+\massL,\beamH) ([yshift = 1.1cm,xshift = 0.5cm]G3) (G3)};

\coordinate (G4) at (6.1,-1); % Coordinates of ground 4
\path (G4) +(150:0.2) coordinate (G4start);
\draw [interfaceflipped] (G4start)--++(-30:0.4);
\draw plot [smooth, tension=1] coordinates {(\beamL-0.2cm,\beamH) ([yshift = 0.8cm,xshift = -0.08cm]\beamL-0.2cm,\beamH) ([yshift = 1.3cm]\beamL+\massL,\beamH) ([yshift = 1.3cm,xshift = 0.5cm]G4) (G4)};
\end{scope}

\end{tikzpicture}
\end{document}
  • 1
    With all respect, that's a horrific diagram. That's not even a torsional spring. – percusse Jun 27 '18 at 17:20
3

The good news is that TikZ has these coils in decorations.pathmorphing. The bad news is that one can get easily get dimension too large errors with that if one uses plot[smooth]. One way to go is to scale the picture up such that these errors don't show, create a pdf and scale it down. On the other hand, if one uses just the to syntax, this scaling is not needed. This is smooth as well as long in and the subsequent out differ by 180. (Another neat side-effect of switching to this syntax is that it is slightly more straightforward to add labels.)

\documentclass[tikz,margin=1cm]{standalone}
\usetikzlibrary{decorations.pathreplacing,decorations.pathmorphing,arrows.meta}

\begin{document}
\begin{tikzpicture}

\tikzset{interface/.style={postaction={draw,decorate,decoration={border,angle=-30,amplitude=0.1cm,segment
length=0.6mm}}},
interfaceflipped/.style={postaction={draw,decorate,decoration={border,angle=30,amplitude=0.1cm,segment
length=0.6mm}}},
mycoil/.style={decorate,decoration={coil,segment
length=6pt,aspect=0.6,amplitude=5pt,post length=1mm,pre length=4mm}}}

\newcommand\beamL{5cm}
\newcommand\beamH{0.1cm}
\newcommand\massL{0.5cm}
\newcommand\massH{0.5cm}

\node[draw,minimum height={2*\massH},anchor=east,font=\small,inner sep=1pt] (I1)
at (0,0) {$I_{01}$};
\node[draw,minimum height={2*\massH},anchor=west,font=\small,inner sep=1pt] (I2)
at (\beamL,0) {$I_{02}$};
\draw ([yshift=\beamH]I1.east) -- ([yshift=\beamH]I2.west)
([yshift=-\beamH]I1.east) -- ([yshift=-\beamH]I2.west);

\coordinate (G1) at (5.5,-1); % Coordinates of ground 1
\path (G1) +(150:0.2) coordinate (G1start);
\draw [interface] (G1start)--++(-30:0.4);
\draw[-{Bar},shorten >=-2pt] (\beamL,\beamH) to[out=100,in=-120] 
([yshift = 0.5cm,xshift = -0.08cm]\beamL,\beamH) to[out=60,in=-180] 
([yshift=0.8cm]\beamL+\massL,\beamH) to[out=0,in=80]
([yshift = 1.1cm,xshift = 0.5cm]G1) node[above left,font=\small,xshift=1pt]{$c_{t2}$};

\draw[{Tee Barb[width=10pt,length=5pt,inset'={-4.5pt}]}-,shorten <=-3pt] 
([yshift = 1.1cm,xshift = 0.5cm]G1) to[out=-100,in=70] 
(G1);

\coordinate (G2) at (6.1,-1); % Coordinates of ground 2
\path (G2) +(150:0.2) coordinate (G2start);
\draw [interface] (G2start)--++(-30:0.4);
\draw[mycoil] (\beamL-0.2cm,\beamH) to[out=110,in=-110]
([yshift = 0.8cm,xshift = -0.08cm]\beamL-0.2cm,\beamH) to[out=70,in=180]  
([yshift = 1.3cm]\beamL+\massL,\beamH) to[out=0,in=80]
([yshift = 1.3cm,xshift = 0.5cm]G2) node[above right=0.4cm]{$k_{t2}$} to[out=-100,in=70]
(G2);

\begin{scope}[xshift=\beamL,xscale=-1]
\coordinate (G3) at (5.5,-1); % Coordinates of ground 3
\path (G3) +(150:0.2) coordinate (G3start);
\draw [interfaceflipped] (G3start)--++(-30:0.4);
\draw[-{Bar},shorten >=-2pt] (\beamL,\beamH) to[out=100,in=-120] 
([yshift = 0.5cm,xshift = -0.08cm]\beamL,\beamH) to[out=60,in=-180] 
([yshift = 0.8cm]\beamL+\massL,\beamH) to[out=0,in=80] 
 ([yshift = 1.1cm,xshift = 0.5cm]G3) node[above right,font=\small,xshift=-1pt]{$c_{t1}$};
\draw[{Tee Barb[width=10pt,length=5pt,inset'={-4.5pt}]}-,shorten <=-3pt] ([yshift = 1.1cm,xshift = 0.5cm]G3)
 to[out=-100,in=70]  (G3);

\coordinate (G4) at (6.1,-1); % Coordinates of ground 4
\path (G4) +(150:0.2) coordinate (G4start);
\draw [interfaceflipped] (G4start)--++(-30:0.4);
\draw[mycoil] (\beamL-0.2cm,\beamH) to[out=110,in=-110] 
([yshift = 0.8cm,xshift = -0.08cm]\beamL-0.2cm,\beamH) to[out=70,in=180]  
([yshift = 1.3cm]\beamL+\massL,\beamH)  to[out=0,in=80]  
([yshift = 1.3cm,xshift = 0.5cm]G4) node[above left=0.4cm]{$k_{t1}$} to[out=-100,in=70] (G4);
\end{scope}

\end{tikzpicture}
\end{document}

enter image description here

EDIT: Added dampers using arrows.meta, simplified the code and also introduced pre length and post length to make the springs more "realistic".

  • +1 Thanks! Any ideas for how I could go about drawing the dampers? – Milo Jun 27 '18 at 17:44
  • 1
    @Milo Yes, I do. Please se my update. (You can of course play with the dimensions like width, length, inset and shorten.) – user121799 Jun 27 '18 at 17:54

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.