I am trying to draw an image similar to those in this thread:
If you look at Jake's answer though, I want to modify it a little...
\begin{tikzpicture}[]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]
\tikzstyle{damper}=[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]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm]
\node [style={draw,outer sep=0pt,thick}] (M) [minimum width=1cm, minimum height=2.5cm] {$m$};
\node (ground) [ground,anchor=north,yshift=-0.25cm,minimum width=5.6cm,xshift=-0.03cm] at (M.south) {};
\draw (ground.north east) -- (ground.north west);
\draw (ground.south east) -- (ground.south west);
\draw (ground.north east) -- (ground.south east);
\node (fill) [ground,xshift=-0.15cm,minimum height = 0.3cm, minimum width = 0.3cm] at (ground.west) {};
\draw (fill.north west) -- (fill.south west);
\draw (fill.south west) -- (fill.south east);
\draw [thick] (M.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
\draw [thick] (M.south west) ++ (2.5cm,-0.625cm) circle (0.25cm) (M.south east) ++ (-2.5cm,-0.625cm) circle (0.25cm);
\node (wall) [ground, rotate=-90, minimum width=3cm,yshift=-3cm] {};
\draw (wall.north east) -- (wall.north west);
\draw (wall.north west) -- (wall.south west);
\draw (wall.south west) -- (wall.south east);
\node (y) at (M.east) [xshift = 1.2cm] {$y$};
\draw [spring] (wall.170) -- ($(M.north west)!(wall.170)!(M.south west)$);
\draw [damper] (wall.10) -- ($(M.north west)!(wall.10)!(M.south west)$);
\node (b) at (wall.10) [xshift = 1.2cm,yshift=0.55cm] {$b$};
\node (k) at (wall.170) [xshift = 1.2cm,yshift=0.35cm] {$k$};
\draw [-latex,ultra thick] (M.east) ++ (0cm,0cm) -- +(1cm,0cm);
\draw [-latex,ultra thick] (wall.north west) ++ (0cm, 0.5cm) -- +(1cm,0cm);
\draw [dashed] (wall.north west) ++ (0cm, 0cm) -- +(0cm,0.8cm);
\end{tikzpicture}
Notice the nodes called (fill), these are used to ensure that the surface the mass m is one continuous surface (a cart...) Upon zooming in however, I see a discontinuity between the lines. How can I fix this?
I am new with Tikz, so I would appreciate a solution that does not completely blow me away - simple solutions will be appreciated more.
So, I am trying to now draw a second image, and it is almost complete, excluding a few glitches... (I have chosen not to make a new thread, because it's almost the same code...)
How can I make the floor the same height as the width of the wall? When I change it, it draws something crazy...
\begin{center}\hspace*{-4.5cm}
\begin{tikzpicture}[scale=1.1, every node/.style={scale=1.3},
spring/.style={thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,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={minimum width=0.75cm,minimum height=0.3cm}
]
\node [draw, outer sep=0pt, thick] (M) [minimum width=2cm, minimum height=1.5cm] {$m_1$};
\node [draw, outer sep=0pt, thick] (M2) [minimum width=2cm, minimum height=1.5cm, xshift = 4cm] {$m_2$};
\draw [thick, fill=white] (M2.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M2.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
\node (ground) [anchor=north,minimum width=13cm] at (M.south) {};
\draw [spring] (M.east) -- (M2.west);
\draw [thick, fill=white] (M.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
\node (wall) [rotate=-90, minimum width=3cm,yshift=-3cm] {};
\draw[pattern=north east lines ] (wall.south west)|-(ground.south east)|-(wall.north east)|- cycle;
\draw [damper] (wall.75) -- ($(M.north west)!(wall.75)!(M.south west)$);
\node (b) at (wall.75) [xshift = 1cm,yshift=0.55cm] {$b$};
\node (k) at (wall.75) [xshift = 4.85cm,yshift=0.35cm] {$k$};
\draw [-latex,ultra thick] (M2.east) ++ (0cm,0cm) -- +(1cm,0cm);
\draw [-latex,ultra thick] (M.north east) ++ (0cm, 0.5cm) -- +(1cm,0cm);
\draw [dashed] (M.north east) ++ (0cm, 0cm) -- +(0cm,0.8cm);
\node (y1) at (M.north east) [xshift = 1.2cm, yshift = 0.5cm] {$y_1$};
\draw [-latex,ultra thick] (M2.north east) ++ (0cm, 0.5cm) -- +(1cm,0cm);
\draw [dashed] (M2.north east) ++ (0cm, 0cm) -- +(0cm,0.8cm);
\node (y1) at (M2.north east) [xshift = 1.2cm, yshift = 0.5cm] {$y_2$};
\end{tikzpicture}
\end{center}
I have since migrated to another solution:
\begin{center}
\begin{tikzpicture}[scale=1.1, every node/.style={scale=1.3}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]
\tikzstyle{damper}=[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]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm,inner sep=0pt,outer sep=0pt]
\node [draw, outer sep=0pt, thick] (M) [minimum width=2cm, minimum height=1.5cm] {$m_1$};
\node [draw, outer sep=0pt, thick] (M2) [minimum width=2cm, minimum height=1.5cm, xshift = 4cm] {$m_2$};
\draw [thick, fill=white] (M2.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M2.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
%\node (ground) [anchor=north,minimum width=13cm] at (M.south) {};
\node (ground) [ground,anchor=north,yshift=-0.2cm,minimum width=10cm,xshift=2.03cm] at (M.south) {};
\draw (ground.north east) -- (ground.north west);
\draw (ground.south east) -- (ground.south west);
\draw (ground.north east) -- (ground.south east);
\node (fill) [ground,xshift=-0.15cm,minimum height = 0.3cm, minimum width = 0.3cm] at (ground.west) {};
\draw (fill.north west) -- (fill.south west);
\draw (fill.south west) -- (fill.south east);
\draw [spring] (M.east) -- (M2.west);
\draw [thick, fill=white] (M.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
\node (wall) [ground, rotate=-90, minimum width=3cm,anchor=south east] at (fill.north west) {};
\draw (wall.north east) -- (wall.north west);
\draw (wall.north west) -- (wall.south west);
\draw (wall.south west) -- (wall.south east);
%\node (wall) [rotate=-90, minimum width=3cm,yshift=-3cm] {};
%\draw[pattern=north east lines ] (wall.south west)|-(ground.south east)|-(wall.north east)|- cycle;
\draw [damper] (wall.15) -- ($(M.north west)!(wall.15)!(M.south west)$);
\node (b) at (wall.15) [xshift = 1cm,yshift=0.55cm] {$b$};
\node (k) at (wall.15) [xshift = 4.85cm,yshift=0.35cm] {$k$};
\draw [-latex,ultra thick] (M2.east) ++ (0cm,0cm) -- +(1cm,0cm);
\draw [-latex,ultra thick] (M.north east) ++ (0cm, 0.5cm) -- +(1cm,0cm);
\draw [dashed] (M.north east) ++ (0cm, 0cm) -- +(0cm,0.8cm);
\node (y1) at (M.north east) [xshift = 1.2cm, yshift = 0.5cm] {$y_1$};
\draw [-latex,ultra thick] (M2.north east) ++ (0cm, 0.5cm) -- +(1cm,0cm);
\draw [dashed] (M2.north east) ++ (0cm, 0cm) -- +(0cm,0.8cm);
\node (y1) at (M2.north east) [xshift = 1.2cm, yshift = 0.5cm] {$y_2$};
\node (y1) at (M2.east) [xshift = 1.05cm] {$u$};
\end{tikzpicture}
\end{center}










