流程图:更改箭头路径

流程图:更改箭头路径

我输入了一个流程图:

流程图

如您所见,“extrahiere Topologie”的箭头直接指向“Simulationsstart”节点。我希望箭头以矩形形式定位到节点,如下所示:

流程图2

代码如下:

\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage[autooneside=false,automark,markcase=ignoreuppercase,headsepline,plainheadsepline]{scrlayer-scrpage}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry}

\usepackage{mwe}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,decorations.markings,calc}
\usepackage{microtype}
\definecolor{tkblue}{rgb}{0,0.212,0.369}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{pst-pdf}
\usepackage{multirow}
\usepackage{array,cellspace}
\setlength\cellspacetoplimit{4pt} 
\setlength\cellspacebottomlimit{4pt}
\usepackage{float}
\usepackage{tikz}
\usepackage{pdflscape}
\usepackage{trees}

\begin{document}

\usetikzlibrary{arrows.meta}
\tikzset{%
  >={Latex[width=2mm,length=2mm]},
  % Specifications for style of nodes:
            base/.style = {rounded corners, draw=black,
                           minimum width=4cm, minimum height=1cm,
                           text centered, font=\sffamily},
  activityStarts/.style = {rectangle,base, fill=tkblue!50},
            test/.style = {base, diamond, aspect=2, fill=tkblue!40},
       startstop/.style = {base, fill=red!40},
    activityRuns/.style = {base, fill=green!30},
         process/.style = {base, minimum width=2.5cm, fill=tkblue!15,
                           font=\ttfamily},
        mark/.style     = {draw,circle,black,node distance=1.5cm,fill=black!15},
}

\newpage
    \begin{landscape}
    \begin{tikzpicture}[node distance=4cm,
        every node/.style={fill=white, font=\sffamily}, align=center]
      % Specification of nodes (position, etc.)
      \node (start)             [activityStarts]              {Simulationsstart mit\\Parametersatz:};
      \node (ausgang)     [process, below of=start]          {Kalkuliere Ausgangsgrößen $\vec{y}$};
      \node (wechsel)      [test, below of=ausgang]   {Schaltzustandswechsel?};
      \node (loop)    [test, right of=wechsel, xshift=4cm] {Loop detektiert?};
      \node (Stop)              [startstop, right of=loop,xshift=3cm] {Simulationsstop};
      \node (Toggle)            [process,right of=ausgang, xshift=4cm] {extrahiere Topologie};
      \node (next)     [process, below of=wechsel]   {Nächster Simulationsschritt};   
      % Specification of lines between nodes specified above
      % with aditional nodes for description 
      \draw[->]             (start) -- node[text width=7.5cm]{Beaufschlagung des Systems mit den aktuellen Eingangs- und Zustandsgrößen} (ausgang);
      \draw[->]     (ausgang) -- node[text width=7.5cm] {In Abhängigkeit der Blockanordnung wird das Zustandsraummodell gelöst} (wechsel);
      \draw[->]      (wechsel) -- node[text width=0.5cm]{Nein} (next);
      \draw[->]     (wechsel) -- node[text width=0.5cm]{Ja} (loop);
      \draw[->]     (loop) -- node[text width=0.5cm] {Ja} (Stop);
      \draw[->]     (loop) -- node[text width=0.5cm] {Nein} (Toggle);
      \draw[->]     (Toggle) -- (start);
    \end{tikzpicture}
    \end{landscape}
\end{document}

如果有人能帮助我那就太好了!

答案1

正如 3.1.4b 手册第 153 页所述:

\path … |- <坐标或循环> …;

此操作的意思是“先纵,后横”。

因此,只需先垂直画一条线,然后从节点水平画一条线(toggle)(start)

\draw[->]     (Toggle) |- (start);

截屏

\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage[autooneside=false,automark,markcase=ignoreuppercase,headsepline,plainheadsepline]{scrlayer-scrpage}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry}

\usepackage{mwe}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,decorations.markings,calc}
\usepackage{microtype}
\definecolor{tkblue}{rgb}{0,0.212,0.369}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{pst-pdf}
\usepackage{multirow}
\usepackage{array,cellspace}
\setlength\cellspacetoplimit{4pt} 
\setlength\cellspacebottomlimit{4pt}
\usepackage{float}
\usepackage{tikz}
\usepackage{pdflscape}
\usepackage{trees}

\begin{document}

\usetikzlibrary{arrows.meta}
\tikzset{%
  >={Latex[width=2mm,length=2mm]},
  % Specifications for style of nodes:
            base/.style = {rounded corners, draw=black,
                           minimum width=4cm, minimum height=1cm,
                           text centered, font=\sffamily},
  activityStarts/.style = {rectangle,base, fill=tkblue!50},
            test/.style = {base, diamond, aspect=2, fill=tkblue!40},
       startstop/.style = {base, fill=red!40},
    activityRuns/.style = {base, fill=green!30},
         process/.style = {base, minimum width=2.5cm, fill=tkblue!15,
                           font=\ttfamily},
        mark/.style     = {draw,circle,black,node distance=1.5cm,fill=black!15},
}

\newpage
    \begin{landscape}
    \begin{tikzpicture}[node distance=4cm,
        every node/.style={fill=white, font=\sffamily}, align=center]
      % Specification of nodes (position, etc.)
      \node (start)             [activityStarts]              {Simulationsstart mit\\Parametersatz:};
      \node (ausgang)     [process, below of=start]          {Kalkuliere Ausgangsgrößen $\vec{y}$};
      \node (wechsel)      [test, below of=ausgang]   {Schaltzustandswechsel?};
      \node (loop)    [test, right of=wechsel, xshift=4cm] {Loop detektiert?};
      \node (Stop)              [startstop, right of=loop,xshift=3cm] {Simulationsstop};
      \node (Toggle)            [process,right of=ausgang, xshift=4cm] {extrahiere Topologie};
      \node (next)     [process, below of=wechsel]   {Nächster Simulationsschritt};   
      % Specification of lines between nodes specified above
      % with aditional nodes for description 
      \draw[->]             (start) -- node[text width=7.5cm]{Beaufschlagung des Systems mit den aktuellen Eingangs- und Zustandsgrößen} (ausgang);
      \draw[->]     (ausgang) -- node[text width=7.5cm] {In Abhängigkeit der Blockanordnung wird das Zustandsraummodell gelöst} (wechsel);
      \draw[->]      (wechsel) -- node[text width=0.5cm]{Nein} (next);
      \draw[->]     (wechsel) -- node[text width=0.5cm]{Ja} (loop);
      \draw[->]     (loop) -- node[text width=0.5cm] {Ja} (Stop);
      \draw[->]     (loop) -- node[text width=0.5cm] {Nein} (Toggle);
      \draw[->]     (Toggle) |- (start);
    \end{tikzpicture}
    \end{landscape}
\end{document}

相关内容