我需要帮助来拉直连接质量东南方向M1
和西南方向的倾斜阻尼器wall1
:
我尝试多次更改坐标,但均未成功。我该如何修复此问题?我的代码如下:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{graphics,epsfig,graphicx}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usetikzlibrary{calc,patterns,decorations.markings}
\usetikzlibrary{positioning}
\begin{document}
\vspace{1cm}
\begin{figure}[hbp]
\centering
\tikzset{
spring/.style={thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}},
blank/.style={draw=none,fill=none,pos=0.5},
ground/.style={fill,pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.3cm},
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=10pt,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,-3pt)$) -- ($(dmp.north)+(0,3pt)$);
}
}, decorate
}
}
\par
\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\begin{scope}[xshift=7cm]
\node (M) [minimum width=1cm, minimum height=1cm] {$M$};
%\draw [<-,thick](-2.6,.6) -- (-1.5,-.2);
\node (wall) [ground, rotate=-90, minimum width=2cm,yshift=-3cm] {};
\draw (wall.north east) -- (wall.north west);
\draw [spring] (wall.120) -- ($(M.north west)!(wall.120)!(M.south west)$) ;
\draw [damper] (wall.20) -- ($(M.north west)!(wall.20)!(M.south west)$);
\end{scope}
\begin{scope}[xshift=10.3cm]
\node (M1) [minimum width=1cm, minimum height=1cm] {$M_{1}$} ;
\draw [spring] (M.10) -- ($(M1.north west)!(M.10)!(M1.south west)$);
\draw [damper] (M.-40) -- ($(M1.north west)!(M.-40)!(M1.south west)$);
%\draw [->,thick](1.4,-.2) -- (2.5,.6);
\end{scope}
\begin{scope}[xshift=10.3cm]
\node[] (wall1) [ground, rotate=90, minimum width=2cm,yshift=-3cm] {};
\draw (wall1.north west) -- (wall1.north east);
\draw [spring] (wall1.60) -- ($(M1.north east)!(wall1.60)!(M1.south east)$);
\draw [damper] (M1.-40) -- ($(wall1.north west)!0!(wall1.south west)$);
\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}
答案1
嗨,我刚刚修改了最后一个阻尼器绘图命令 \draw [damper] (M1.-40) -| (M1.-40-|wall1.60);
\documentclass{article}
\usepackage{pgfplots}
\usepackage{graphics,epsfig,graphicx}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usetikzlibrary{calc,patterns,decorations.markings}
\usetikzlibrary{positioning}
\begin{document}
\vspace{1cm}
\begin{figure}[hbp]
\centering
\tikzset{
spring/.style={thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}},
blank/.style={draw=none,fill=none,pos=0.5},
ground/.style={fill,pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.3cm},
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=10pt,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,-3pt)$) -- ($(dmp.north)+(0,3pt)$);
}
}, decorate
}
}
\par
\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\begin{scope}[xshift=7cm]
\node (M) [minimum width=1cm, minimum height=1cm] {$M$};
%\draw [<-,thick](-2.6,.6) -- (-1.5,-.2);
\node (wall) [ground, rotate=-90, minimum width=2cm,yshift=-3cm] {};
\draw (wall.north east) -- (wall.north west);
\draw [spring] (wall.120) -- ($(M.north west)!(wall.120)!(M.south west)$) ;
\draw [damper] (wall.20) -- ($(M.north west)!(wall.20)!(M.south west)$);
\end{scope}
\begin{scope}[xshift=10.3cm]
\node (M1) [minimum width=1cm, minimum height=1cm] {$M_{1}$} ;
\draw [spring] (M.10) -- ($(M1.north west)!(M.10)!(M1.south west)$);
\draw [damper] (M.-40) -- ($(M1.north west)!(M.-40)!(M1.south west)$);
%\draw [->,thick](1.4,-.2) -- (2.5,.6);
\end{scope}
\begin{scope}[xshift=10.3cm]
\node[] (wall1) [ground, rotate=90, minimum width=2cm,yshift=-3cm] {};
\draw (wall1.north west) -- (wall1.north east);
\draw [spring] (wall1.60) -- ($(M1.north east)!(wall1.60)!(M1.south east)$);
\draw [damper] (M1.-40) -| (M1.-40-|wall1.60);
\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}