1

Good day all, I am trying to merge 2 objects which I have been helped to achieve earlier. I taught it should be easy but nay its not. Kindly see the attached. My dream is the figure on the right while what I am trying to insert is the object on the left. The code is for the drawn object which I want to insert the object into.enter image description here. The portion that is not clear is where I tried to insert it into (please pardon me if it is not clear).

\documentclass{article}
\usepackage{graphicx} % to add figure environment that comes with caption
\usepackage{caption} %if you don't want to float your figure for using \captionof
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,circuits}

\tikzset{
   mysnake/.style={decoration={snake,segment length=8.7mm,amplitude=1.5mm},decorate
     },
   spring/.style = {thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,
          segment length=6}},
   dampener/.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},
 }
\begin{document}
\begin{figure}[htbp]
\centering
 \begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
 \begin{scope}
 \node at (0,0) [draw,rectangle, minimum width=2cm,minimum height=1cm,fill=gray,anchor=south,,transform shape](m1) {$Engine\: mass$};
 \draw [very thick, -latex](m1.east) -- +(1,0)--+(1,1)node[draw=none,midway,right=0.4cm] {y};
 \node at (0,-2) [rectangle, minimum width=4cm,minimum height=1cm,fill=gray,anchor=north,transform shape](m2) {$Body\: mass$};
 \draw [very thick, -latex](m2.east) -- +(1,0)--+(1,1)node[draw=none,midway,right=0.4cm] {x};
% \draw [spring] (-0.5,-2) -- (-0.5,0) node[draw=none,midway,left=0.3cm] {$3{k}{_R}$};
 %\draw [dampener,label=D1,] (0.5,-2) -- (0.5,0)node[draw=none,midway,right=0.4cm] {$3{C}{_R}$};

\draw [line width=0.8pt] ($(wall.north west)!0.2!(wall.north east)$) -- ++(0,2cm)coordinate (z);
\draw [spring]   (z) -- ++(0,2cm)coordinate (u) node[draw=none,midway,right=0.1cm] {${k}{_1}$}; 
\draw [line width=0.8pt] (u) -- ($(walle.south west)!0.2!(walle.south east)$);

\draw [line width=0.8pt]   ($(walle.south west)!0.8!(walle.south east)$) -- ++(0,-1cm)coordinate (w);
\draw [spring] (w) -- ++(0,-2cm)coordinate (t) node[draw=none,midway,right=0.1cm] {${k}{_2}$}; 

\coordinate (upperright) at ( $ (t)+(0.5,0) $ ); 
\coordinate (lowerleft) at ( $ (t)+(-0.5,-2) $ ); 

\draw (lowerleft) -- (lowerleft-|upperright);
\draw (upperright) -- (lowerleft|-upperright);
\draw [damper,label=D1,](lowerleft|-upperright) -- (lowerleft)  node[draw=none,midway,left=0.3cm] {${\eta}$};
\draw [spring] (upperright) -- (lowerleft-|upperright)  node[draw=none,midway,right=0.1cm] {${k}{_3}$};

\draw [line width=0.8pt] ($(wall.north west)!0.8!(wall.north east)$) -- (t|-lowerleft);








  \draw [spring] (-0.5,-5) -- (-0.5,-3)node[draw=none,midway,left=0.3cm] {$2{k}{_s}{_f}+2{k}{_s}{_r}$};
 \draw [dampener] (0.5,-5) -- (0.5,-3)node[draw=none,midway,right=0.4cm] {$2{C}{_s}{_f}+2{C}{_s}{_r}$};
 \fill[red]decorate[mysnake]{(-2,-4.8) -- (2,-4.8)} --(2,-5.2) -- (-2,-5.2) -- (-2,-4.8) --cycle;
\draw[mysnake] (-2,-4.8) -- (2,-4.8)node at (2.5,-5.1)[draw=none,left=(4.8cm)] {$x_{o}{t}{=}{X_o}{sin}({2}{\pi}{f}{t})$};
 \end{scope}
 \end{tikzpicture}
 \caption{2-parameter rubber mount}\label{fig:3-parameter rubber mount}
 \end{figure}
 \end{document}
2

Hopefully I understood what you want...

\documentclass{article}
\usepackage{graphicx} % to add figure environment that comes with caption
\usepackage{caption} %if you don't want to float your figure for using \captionof
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,circuits}

\tikzset{
   mysnake/.style={decoration={snake,segment length=8.7mm,amplitude=1.5mm},decorate
     },
   spring/.style = {thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,
          segment length=6}},
   dampener/.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},
 }
\begin{document}
\begin{figure}[htbp]
\centering
 \begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
 \begin{scope}
 \node at (0,3) [draw,rectangle, minimum width=2cm,minimum height=1cm,fill=gray,anchor=south,,transform shape](m1) {$Engine\: mass$};
 \draw [very thick, -latex](m1.east) -- +(1,0)--+(1,1)node[draw=none,midway,right=0.4cm] {y};
 \node at (0,-1.7) [rectangle, minimum width=4cm,minimum height=1cm,fill=gray,anchor=north,transform shape](m2) {$Body\: mass$};
 \draw [very thick, -latex](m2.east) -- +(1,0)--+(1,1)node[draw=none,midway,right=0.4cm] {x};
% \draw [spring] (-0.5,-2) -- (-0.5,0) node[draw=none,midway,left=0.3cm] {$3{k}{_R}$};
 %\draw [dampener,label=D1,] (0.5,-2) -- (0.5,0)node[draw=none,midway,right=0.4cm] {$3{C}{_R}$};

\draw [line width=0.8pt] ($(m1.south west)!0.2!(m1.south east)$) -- ++(0,-1.5cm)coordinate (z);
\draw [spring]   (z) -- ++(0,-2cm)coordinate (u) node[draw=none,midway,left=0.1cm] {${k}{_1}$};
\draw [line width=0.8pt] (u) -- (u|-m2.north);

\draw [line width=0.8pt]   ($(m1.south west)!0.8!(m1.south east)$) -- ++(0,-0.05cm)coordinate (w);
\draw [spring] (w) -- ++(0,-1.5cm)coordinate (t) node[draw=none,midway,right=0.1cm] {${k}{_2}$};

\coordinate (upperright) at ( $ (t)+(0.5,0) $ );
\coordinate (lowerleft) at ( $ (t)+(-0.5,-2) $ );

\draw (lowerleft) -- (lowerleft-|upperright)coordinate[pos=0.5] (aa);
\draw (upperright) -- (lowerleft|-upperright);
\draw [dampener,label=D1,](lowerleft|-upperright) -- (lowerleft)  node[draw=none,midway,left=0.3cm] {${\eta}$};
\draw [spring] (upperright) -- (lowerleft-|upperright)  node[draw=none,midway,right=0.1cm] {${k}{_3}$};

\draw [line width=0.8pt] (aa|-m2.north) -- (t|-lowerleft);


  \draw [spring] ($(m2.south west)!0.4!(m2.south east)$) -- +(0,-2.3)node[draw=none,midway,left=0.3cm] {$2{k}{_s}{_f}+2{k}{_s}{_r}$};
 \draw [dampener] ($(m2.south west)!0.6!(m2.south east)$) -- +(0,-2.3)node[draw=none,midway,right=0.4cm] {$2{C}{_s}{_f}+2{C}{_s}{_r}$};
 \fill[red]decorate[mysnake]{(-2,-4.8) -- (2,-4.8)} --(2,-5.2) -- (-2,-5.2) -- (-2,-4.8) --cycle;
\draw[mysnake] (-2,-4.8) -- (2,-4.8)node at (2.5,-5.1)[draw=none,left=(4.8cm)] {$x_{o}{t}{=}{X_o}{sin}({2}{\pi}{f}{t})$};
 \end{scope}
 \end{tikzpicture}
 \caption{2-parameter rubber mount}\label{fig:3-parameter rubber mount}
 \end{figure}
 \end{document}

enter image description here

  • Thanks Harish. I hope to be able to help on this forum like you soon. Really grateful. – Ismail Ladele Ladipo Jan 17 '15 at 14:35
  • @IsmailLadeleLadipo You are welcome :-) Happy learning TeX/LaTeX and tikz too. :-) – user11232 Jan 17 '15 at 14:36

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.