I'm trying to draw a block diagram. I want to make the edge (red) orthogonal, like the black path made with -|
. I know there are the commands \tikztostart
, \tikztotarget
and the ....!0.5!...
opertator, but cant make them work inside the every edge/.style{}
. Here is my code (dont know how to add the compiled version).
\begin{tikzpicture}[line width=1pt,-{Stealth[scale=3,length=3,width=2]},on grid,node distance=2cm,every node/.style={font=\huge},every edge/.style={draw,red,rounded corners}]
\node[draw,rectangle] (B) {$B$};
\node[draw,circle] (S) [right=of B] {$+$};
\node[draw,rectangle] (I) [right=of S] {$\dfrac{1}{s}$};
\node[draw,rectangle] (C) [right=of I] {$C$};
\node[draw,rectangle] (A) [below=of I] {$A$};
\node[draw,rectangle] (D) [above=of I] {$D$};
\draw (B) edge [auto=left] node {} (S)
(S) edge [auto=right] node {} (I)
(A) edge [auto] node {$A$} (S);
\draw (A) -| node {$A$} (S);
\end{tikzpicture}
Best Answer
Something like this?
Code:
Idea for quadrature edges is stolen from here.
Edit: In above code is typing error: instead of
positionings
should bepositioning
. I correct this now.Upgrade: In a case, that you like to have edges labeled, this can be simply done only for edges of type
L
, for example:however, for edges of type
T
, the definition of edge should be changed as follows:and edges width node are:
or in case, when edge hasn't node:
Another detail: since edges are defined to be in red color, than in case, that you like to have for example in black, you need add option
text=black
in edge node options. An complete example with edge labels:Beside above solution there exist more simple solution:
Both gives the same result:
The second, simpler solution instead complicated edge with orthogonal path use separately draw of each orthogonal path between nodes, i.e. you need for each path write
\draw[L] ...
what in the first case is not needed. Both solution has pros and cons. Which is more suitable? This I left to user(s) :-).