我正在使用这些样式:
\usetikzlibrary{arrows.meta, bending, calc, chains, positioning,
shapes,patterns,decorations.pathmorphing,decorations.markings}
\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]
\begin{tikzpicture}[
node distance = 0mm,
start chain = going right,
box/.style = {draw,
font=\linespread{0.75}\selectfont\small,
align=center, inner sep=2mm, outer sep=0pt,
on chain},
axs/.style = {draw, minimum width=12mm, minimum height=2mm,
inner sep=0pt, outer sep=0pt,
on chain, node contents={}},
arr/.style = {color=#1, line width=0.8mm,
shorten >=-1mm, shorten <=-1mm,
-{Stealth[length=1.6mm,width=3mm,flex=1.2]},
bend angle=60},
bar/.style = {draw, minimum width=0.1mm, minimum height=6mm,
inner sep=0pt, outer sep=0pt,
on chain, node contents={}},
]
我尝试使用给出的解决方案在 LaTeX 中绘制机械系统。
但我无法找到表示此元素的方法(也许有一个宏可以将其插入图片中)。确切地说,我想连接使用以下方法创建的左侧和右侧框:
\node (node_example) [box,label=below:$Example$] {example};
对于我的粘弹性节点只需调用一个宏,我可以这样调用:
\node (new_node) [visco_elastic_node,....]{....}
我能做什么?
答案1
这spring
自杰克回答,damper
绘制为小图片pic
,其余的图像用于我的答案上一个问题:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
bending,
calc, chains,
decorations.pathmorphing, % added
positioning
}
\begin{document}
%\begin{figure}[!h] % when use article \documentclass{article}
%\centering % when use article \documentclass{article}
\begin{tikzpicture}[
node distance = 0mm,
start chain = going right,
box/.style = {draw,
font=\linespread{0.75}\selectfont\small,
align=center, inner sep=2mm, outer sep=0pt,
on chain},
axs/.style = {draw, minimum width=12mm, minimum height=2mm,
inner sep=0pt, outer sep=0pt,
on chain, node contents={}},
arr/.style = {color=#1, line width=0.8mm,
shorten >=-1mm, shorten <=-1mm,
-{Stealth[length=1.6mm,width=3mm,flex=1.2]},
bend angle=60},
spring/.style = {thick, decorate, % new,
decoration={zigzag,pre length=3mm,post length=3mm,segment length=6}
},
damper/.pic = {\coordinate (-east); % new
\coordinate[left=1mm of -east] (-west);
\draw[very thick] ($(-east)+(0,2mm)$) -- ++ (0,-4mm);
\draw[semithick] ($(-east)+(0,3mm)$) -| ++ (-1mm,-6mm) -- ++ (1mm,0);
},
shorten <>/.style = {shorten >=#1, shorten <=#1},
]
% blocks (boxes)
\node (n1) [box,label=below:$J_M$] {Motore};
\node (n2) [axs];
\node (n3) [box] {$\tau$};
\node (n4) [axs];
\node (n5) [minimum height=6mm,minimum width=12mm,
label={[yshift= 1mm]above:$K$},
label={[yshift=-3mm]below:$D$},
on chain] {};% for spring and dumper
\node (n6) [axs];
\node (n7) [box,label=below:$J_C$] {C\\a\\r\\i\\c\\o};
% spring and damper, added
\draw[ultra thick,shorten <>=-2mm]
(n5.north west) -- (n5.south west);
\draw[ultra thick,shorten <>=-2mm]
(n5.north east) -- (n5.south east);
\draw[spring] (n5.north west) -- (n5.north east);
\pic (dmp) at (n5.south) {damper};
\draw(n5.south west) -- (dmp-west) (dmp-east) -- (n5.south east);
% arrows
\draw[transform canvas={xshift=-2mm}]
(n1.south -| n2) edge[arr=gray,bend right] (n1.north -| n2)
node[below,at={(n1.south -| n2)}] {$C_M$}
(n1.north -| n6) edge[arr=gray,bend left] (n1.south -| n6)
node[below,at={(n1.south -| n6)}] {$C_R$};
\draw
(n1.south -| n4) edge[arr=black,bend right] (n1.north -| n4)
node[above,at={(n1.north -| n4)}] {$\theta_R$};
\draw[transform canvas={xshift=+2mm}]
(n1.south -| n2) edge[arr=black,bend right] (n1.north -| n2)
node[above,at={(n1.north -| n2)}] {$\theta_M$}
(n1.south -| n6) edge[arr=black,bend right] (n1.north -| n6)
node[above,at={(n1.north -| n6)}] {$\theta_R$};
\end{tikzpicture}
%\end{figure} % when use article \documentclass{article}
\end{document}
注(1):箭头符号处的下标不正确,但重写它们应该没有问题......
笔记2):如果变量的下标J,C和\theta
是描述性文本,即不是变量,它们应该直立放置(参见磅磅's comment below)。在这种情况下(在所有方程式中...),您应该写下Motore 的$J_{\mathrm{M}}$
代表位置M
。只有变量在数学中才应该是斜体。但是,据我记得,关于这个主题的文献对这种符号不是很严格 :-)。