如何在流程图周围绘制虚线框

如何在流程图周围绘制虚线框

您能帮我画一个虚线框并命名中间列节点周围的框吗?

提前致谢。

在此处输入图片描述

在此处输入图片描述

答案1

您尚未共享 MWE。如果您提供有关所依赖的软件包和库的更多详细信息,我可能会为您创建更好的解决方案:例如使用库fitlocal bounding box

因此,只需从您所呈现的内容中选取一个片段并对您的包裹做出一些假设,以下就是创建您想要的盒子的一种方法:

在此处输入图片描述

其代码如下:

% arara: pdflatex
% arara: open
\documentclass[tikz,border=6pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes}
\begin{document}

\begin{tikzpicture}[node distance=2cm]

  \node[draw,ellipse] (start)                 {Start SIMPACK};
  \node[draw]         (ini)  [below of=start] {Set a reference system};
  \node[draw]         (pro1) [below of=ini]   {Creating/importing the bodies};

  \draw (pro1.east) -- ++ (1,0) |- (ini.east);

  \draw[dotted,red] ($(current bounding box.south east)+(6pt,-6pt)$) rectangle ($(current bounding box.north west)+(-6pt,6pt)$);

\end{tikzpicture}

\end{document}

然后,您可以在使用后从此继续构建current bounding box

或者,您可以使用该fit库:

在此处输入图片描述

% arara: pdflatex
% arara: open
\documentclass[tikz,border=6pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{shapes}
\begin{document}

\begin{tikzpicture}[node distance=2cm]

  \node[draw,ellipse] (start)                 {Start SIMPACK};
  \node[draw]         (ini)  [below of=start] {Set a reference system};
  \node[draw]         (pro1) [below of=ini]   {Creating/importing the bodies};

  \draw (pro1.east) -- ++ (1,0) |- (ini.east);

  \node [fit=(ini) (pro1),draw,dotted,blue] {};

  \draw[dotted,red] ($(current bounding box.south east)+(6pt,-6pt)$) rectangle ($(current bounding box.north west)+(-6pt,6pt)$);

\end{tikzpicture}

\end{document}

在此处输入图片描述

代码:

% arara: pdflatex
% arara: open
\documentclass[tikz,border=6pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{shapes}
\begin{document}

\begin{tikzpicture}[node distance=2cm]

  \node[draw,ellipse] (start)                 {Start SIMPACK};
  \node[draw]         (ini)  [below of=start] {Set a reference system};
  \node[draw]         (pro1) [below of=ini]   {Creating/importing the bodies};

  \draw (pro1.east) -- ++ (1,0) |- (ini.east);

  \node [fit=(ini) (pro1),draw,dotted,blue] {};

  \draw[dotted,red] ($(current bounding box.south east)+(6pt,-6pt)$) rectangle ($(current bounding box.north west)+(-6pt,6pt)$);

  \node[draw] (pro2) [below of=pro1] {Outside previous bounding box calculations};

  \draw (pro2.north) -- (pro1.south);
\end{tikzpicture}

\end{document}

相关内容