我需要使用 tikz 的代码绘制上面的图片,并且我想知道放置“之字形”线的更好方法。我还想将箭头的尖端放在连接线的中间。有人可以帮我吗?谢谢。
这是一张不同的图片,但存在同样的问题:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,
intersections,
shapes.geometric,
decorations.pathmorphing,
decorations.pathreplacing,
decorations.shapes,
decorations.markings,
patterns,
calc,
fit,
arrows,
backgrounds,
matrix}
\begin{document}
\begin{tikzpicture}[auto]
\tikzset{deco/.style={decoration={
markings,
mark=at position #1 with {\arrow{>} }
},
postaction={decorate}},
trape/.style={trapezium,draw,shape border rotate=90,minimum width=2cm},
box/.style={rectangle,draw,minimum height=1cm,minimum width=2.5cm},
cerchi/.style={circle,draw,minimum size=1cm}
}
\matrix [row sep={1.5cm}] {
&[2cm] \node [box] (genera) {}; &[2cm] &[1cm] \\
\node [cerchi] (pompa) {}; & & \node [trape] (turbina) {}; & \node [cerchi] (ultiliz) {}; \\
& \node [cerchi] (condensa) {}; & & \\
};
\begin{scope}[>=triangle 60]
\draw [deco=0.6] (genera) -| node[pos=0.6]{2} (turbina.top right corner);
\draw [deco=0.6] (turbina.bottom left corner) |- node[above=1mm,pos=0.71]{3} (condensa);
\draw [deco=0.4] (condensa) -| node[above=1mm,pos=0.31]{4} (pompa);
\draw [deco=0.6] (pompa) |- node[below=1mm,pos=0.63]{1} (genera);
\end{scope}
\draw [->,>=latex,very thick, shorten >=4 pt,shorten <=4pt] (pompa.south)--(pompa.north);
\node [coordinate] (B) at ($ (condensa.center)!.6!(condensa.west) $) {};
\node [coordinate] (C) at ($ (condensa.center)!.6!(condensa.east) $) {};
\node [coordinate] (A) at ($ (B)+(0,-1.5cm)$) {};
\node [coordinate] (D) at ($ (C)+(0,-1.5cm)$) {};
\draw (A)--(B); \draw[decorate,decoration={zigzag,amplitude=3pt,segment length=8pt}] (B)--(C); \draw (C)--(D);
\end{tikzpicture}
\end{document}
答案1
以下是圆圈电阻的简单结构:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC,decorations.markings}
\begin{document}
\begin{tikzpicture}
\node[anchor=west,shape=var resistor IEC,minimum width=1cm,draw,outer sep=0] (heater){};
\node[draw,circle,minimum size=3cm] (heater frame) at (heater.center) {};
\draw (-0.5cm,-2cm) |- (heater.west) (heater.east) -| (1.5cm,-2cm);
\draw[-latex,ultra thick,red] (heater frame.west) -- ++(-2cm,0);
\draw[latex-,ultra thick,blue] (heater frame.east) -- ++(2cm,0);
\end{tikzpicture}
\end{document}
如果你将它与关于带节点的箭头的答案这样你就得到了创建图形所需的基本部分。