순서도 분기 및 수렴 화살표
Nov 24 2020
질문 : 순서도에서 화살표를 분할하는 데 어려움을 겪고 있습니다. 비슷한 코드를 살펴 보았지만 재현 할 수없는 것 같습니다. 이상적인 결과를 얻으려면 어떻게해야합니까?
관련 연구 :
- 발산 화살표, tikz / pgf-순서도
- tikz 순서도에서 노드 간 수직 및 수평 공간 조정
- 순서도의 수렴 및 분기 노드
MWE :
\begin{document}
\begin{center}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=4.5cm, text badly centered, rounded corners, minimum height=4em, minimum width=5cm]
\tikzstyle{line} = [draw, -latex']
% \tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em]
\begin{tikzpicture}[node distance = 2.5cm, auto]
% Place nodes
\node [block, below of=dav] (install) {Install fan, heat sink, thermal dough and 4 jumpers on the board};
\node [block, below of=install] (voltage) {Complete Voltage Testing};
\node [block, below of=voltage] (recordvalue) {Record serial number Voltage Testing is a pass or fail to spreadsheet};
\node [block, below left of=recordvalue, node distance=6.5cm] (flashTX) {Flash as Tx};
\node [block, below right of=recordvalue, node distance=6.5cm] (flashRX) {Flash as Rx};
\node [block, below of=flashTX] (testflashTX) {Test Tx with \textit{Golden Rx}};
\node [block, below of=flashRX] (testflashRX) {Test Rx with \textit{Golden Tx}};
\node [decision, below of=recordvalue, node distance=10cm] (passfail) {Pass/Fail};
% Draw edges
\path [line] (dav) -- (install);
\path [line] (install) -- (voltage);
\path [line] (voltage) -- (recordvalue);
\path [line] (recordvalue) |- (flashTX);
\path [line] (recordvalue) |- (flashRX);
\path [line] (flashTX) -- (testflashTX);
\path [line] (flashRX) -- (testflashRX);
\end{document}
전류 출력 :

이상적인 출력 :

답변
1 Zarko Nov 24 2020 at 14:35
편집 : 편집 된 질문에서 필요에 따라 다이어그램에서 새 노드가 추가됩니다.
아래의 MWE (Minimal Working Example)에서 변경을 수행 한 코드 조각과 비교합니다.
- 노드는 3 개의 체인으로 구성되어 있습니다 (TikZ 라이브러리 사용
chains
). 여기서 사용 된 노드positioning
라이브러리와 구문의 위치를 지정 합니다 (이 노드 간의 거리는에 의해 결정됨node distance = <below> and <right>
). - 체인의 노드
join
는chains
패키지에 정의 된 명령에 의해 그려진 화살표로 연결됩니다. - 노드 간의 연결은 코드를 사용하여 네 곳에서 중단됩니다.
suspend join
- 에서 고려되지 않는 노드 간의 연결은
join
별도로 그려집니다.
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
chains,
positioning,
shapes.geometric}
\begin{document}
\begin{tikzpicture}
\makeatletter
\tikzset{
node distance = 4mm and 2mm,
start chain = A going below,
arr/.style = {-Stealth},
base/.style = {draw, fill=blue!30, font=\small,
text width=42mm, minimum height=8mm,
align=center},
block/.style = {base, rounded corners},
decision/.style = {base, diamond, aspect=1.6,
text width=21mm, inner xsep=0pt},
suspend join/.code={\def\tikz@after@path{}}
}
\makeatother
% Place nodes
% main branch
\begin{scope}[nodes={block, on chain=A, join=by arr}]
\node {Get Dante AV board from batch}; % name: A-1
\node {Install fan, heat sink,
thermal dough and 4 jumpers on the board};
\node {Complete Voltage Testing};
\node {Record serial number Voltage Testing
is a pass or fail to spreadsheet}; % name: A-4
\end{scope}
\coordinate[below=of A-4] (aux1);
\begin{scope}[nodes={block, on chain=A, join=by arr}]
% first left branch
% here had to be discontinued "join" instruction from main branch
\node [suspend join, % name: A-5
below left=of aux1 -| A-4.west] {Flash as Tx};
\node {Test Tx with \textit{Golden Rx}};
% first right branch
% here had to be discontinued "join" instruction from main branch again
\node [suspend join, % name; A-7
below right=of aux1 -| A-4.east] {Flash as Rx};
\node {Test Rx with \textit{Golden Tx}};
\end{scope}
% decision
\coordinate[below=of A-6.south -| aux1] (aux2);
\node [decision, below=of aux2] (decision) {Pass/Fail};
% end branches
\begin{scope}[nodes={block, on chain=A, join=by arr}]
% left end branch
% here had to be discontinued "join" instruction from main branch again
\node [suspend join,
below=of decision -| A-6] {Flash P}; % name A-9
\node {Test T};
\node {Record};
% right end branch
% here had to be discontinued "join" instruction from left end branch
\node [suspend join,
below=of decision -| A-8] {Flash F}; % name A-12
\node {Test T};
\end{scope}
% Draw edges which are not considered in join
% left
\draw[arr] (A-4) -- (aux1) -| (A-5);
\draw[arr] (A-6) |- (aux2) -- (decision);
\draw[arr] (decision) -| (A-9) node[pos=0.25,above] {Pass};
% right
\draw[arr] (aux1) -| (A-7);
\draw (A-8) |- (aux2);
\draw[arr] (decision) -| (A-12) node[pos=0.25,above] {Fail};
\end{tikzpicture}
\end{document}
생기게 하다:

이것이 당신이 추구하는 것입니까?