TikZ:如何以另一种方式连接节点

TikZ:如何以另一种方式连接节点

我有这个...

\documentclass{standalone} 
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.geometric,decorations.pathmorphing,decorations.pathreplacing,decorations.shapes,decorations.markings,patterns,calc,fit,arrows}

\begin{document}

\begin{tikzpicture}[>=latex',auto,inner sep=2mm,node distance=2cm and 3cm,scale=1]

%set styles for the axis between turbine and pump and for the boxes

\tikzset{box1/.style={draw,minimum width=2.5cm,rectangle,thick}}
\tikzset{deco/.style={decoration={markings,
                       mark=at position #1 with {\arrow{>}}},
                       postaction={decorate}}}
\tikzset{turb/.style={draw,trapezium,shape border rotate=90,inner sep=1pt,minimum width=2.5cm,trapezium stretches=true,trapezium angle=80,on grid}}   

% draw nodes
\node[turb] (turbine) {Turbine};
\node[box1,on grid,below left=of turbine] (condenser){Condenser};
%connections
\begin{scope}[>=triangle 45]
 \draw [deco=0.6]  (turbine.bottom left corner) |- (condenser);
 \end{scope}
%
\end{tikzpicture}
\end{document} 

在此处输入图片描述

但我需要这种方式......新的粉红色连接

在此处输入图片描述

是否可以连接在末端(红线)附近?比如说距离涡轮机左下角 1 或 2 毫米...

在此处输入图片描述

答案1

($(turbine)!.5!(condenser)$)计算和之间的中间值 ( 0.5) 。turbinecondenser

turbine.south相当于turbine.-90(-90 是一个角度)并且condenser.east相当于condenser.0

因此,这里还有另外两种可能性:

\documentclass{standalone} 
\usepackage{tikz}
\usetikzlibrary{%
  positioning,shapes.geometric,decorations.pathmorphing,%
  decorations.pathreplacing,decorations.shapes,%
  decorations.markings,patterns,calc,fit,arrows,%
}

\begin{document}

\begin{tikzpicture}%
  [>=latex',auto,inner sep=2mm,node distance=2cm and 3cm,scale=1]

  % set styles for the axis between turbine and pump and for the boxes

  \tikzset{box1/.style={draw,minimum width=2.5cm,rectangle,thick}}
  \tikzset{
    deco/.style={%
      decoration={%
        markings,
        mark=at position #1 with {\arrow{>}}
      },
      postaction={decorate},
    },
    turb/.style={%
      draw,trapezium,shape border rotate=90,
      inner sep=1pt,minimum width=2.5cm,
      trapezium stretches=true,trapezium angle=80,on grid,
    }
  }   

  % draw nodes
  \node[turb] (turbine) {Turbine};
  \node[box1,on grid,below left=of turbine] (condenser){Condenser};
  % connections
  \begin{scope}[>=triangle 45]

    \draw [deco=0.5,red] (turbine.south)
    |- ($(turbine.south)!.5!(condenser.north)$)
    -| (condenser.north);

    \draw [deco=0.5,violet] (turbine.-70) |- (condenser.10);
  \end{scope}
%
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

添加

\draw [deco=0.7,pink] (turbine.south) |- ++(-1,-0.2) -| (condenser);

到最后一个范围就足够了。

在此处输入图片描述

相关内容