4

I have three boxes. They are located in nodes. I want to make a connection between them as follows:

enter image description here

\node[cubecontainer] (a) at (0,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=A, width=6, height=20, depth=15, units=mm}};
\node[cubecontainer] (b) at (4,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=B, width=6, height=20, depth=15, units=mm}};
\node[cubecontainer] (c) at (8,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=C, width=6, height=20, depth=15, units=mm}};

How can I make the blue arrow and red bracket connection between them. My full code to generate three boxes is

\documentclass[11pt]{article}
\usepackage{tikz}
  \usetikzlibrary{quotes,arrows.meta}
  \tikzset{
    annotated cuboid/.pic={
      \tikzset{%
        every edge quotes/.append style={midway, auto},
        /cuboid/.cd,
        #1
      }
      \draw [\cubeline,every edge/.append style={pic actions, \cubeback, opacity=.5}, pic actions]
      (0,0,0) coordinate (o-\cubelabel) -- ++(-\cubescale*\cubex,0,0) coordinate (a-\cubelabel) -- ++(0,-\cubescale*\cubey,0) coordinate (b-\cubelabel) edge coordinate [pos=1] (g-\cubelabel) ++(0,0,-\cubescale*\cubez)  -- ++(\cubescale*\cubex,0,0) coordinate (c-\cubelabel) -- cycle
      (o-\cubelabel) -- ++(0,0,-\cubescale*\cubez) coordinate (d-\cubelabel) -- ++(0,-\cubescale*\cubey,0) coordinate (e-\cubelabel) edge (g-\cubelabel) -- (c-\cubelabel) -- cycle
      (o-\cubelabel) -- (a-\cubelabel) -- ++(0,0,-\cubescale*\cubez) coordinate (f-\cubelabel) edge (g-\cubelabel) -- (d-\cubelabel) -- cycle;
      ;
    },
    /cuboid/.search also={/tikz},
    /cuboid/.cd,
    width/.store in=\cubex,
    height/.store in=\cubey,
    depth/.store in=\cubez,
    units/.store in=\cubeunits,
    scale/.store in=\cubescale,
    label/.store in=\cubelabel,
    line/.store in=\cubeline,
    backline/.store in=\cubeback,
    width=10,
    height=10,
    depth=10,
    units=cm,
    scale=.1,
    line=draw,
    backline=densely dashed,
  }
\newcommand{\cuboid}[2]{
    \begin{tikzpicture}
     \pic [#1] at (0,0) {annotated cuboid={#2}};
    \end{tikzpicture}
}

\tikzstyle{cubecontainer}=[outer sep = 0pt, inner sep= 0pt]
\tikzstyle{connectarrow}=[-{Triangle[angle=60:0pt 2]},
                          line width= 10pt, shorten >=3mm,shorten <=3mm, draw=gray!60]
\begin{document}
\begin{tikzpicture}

\node[cubecontainer] (a) at (0,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=A, width=6, height=20, depth=15, units=mm}};
\node[cubecontainer] (b) at (4,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=B, width=6, height=20, depth=15, units=mm}};
\node[cubecontainer] (c) at (8,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=C, width=6, height=20, depth=15, units=mm}};


\end{tikzpicture}
\end{document}
6

You can draw the arrow like any other path and the brace is done with decorations.pathreplacing library.

\documentclass[11pt]{article}
\usepackage{tikz}
  \usetikzlibrary{quotes,arrows.meta, decorations.pathreplacing}
  \tikzset{
    annotated cuboid/.pic={
      \tikzset{%
        every edge quotes/.append style={midway, auto},
        /cuboid/.cd,
        #1
      }
      \draw [\cubeline,every edge/.append style={pic actions, \cubeback, opacity=.5}, pic actions]
      (0,0,0) coordinate (o-\cubelabel) -- ++(-\cubescale*\cubex,0,0) coordinate (a-\cubelabel) -- ++(0,-\cubescale*\cubey,0) coordinate (b-\cubelabel) edge coordinate [pos=1] (g-\cubelabel) ++(0,0,-\cubescale*\cubez)  -- ++(\cubescale*\cubex,0,0) coordinate (c-\cubelabel) -- cycle
      (o-\cubelabel) -- ++(0,0,-\cubescale*\cubez) coordinate (d-\cubelabel) -- ++(0,-\cubescale*\cubey,0) coordinate (e-\cubelabel) edge (g-\cubelabel) -- (c-\cubelabel) -- cycle
      (o-\cubelabel) -- (a-\cubelabel) -- ++(0,0,-\cubescale*\cubez) coordinate (f-\cubelabel) edge (g-\cubelabel) -- (d-\cubelabel) -- cycle;
      ;
    },
    /cuboid/.search also={/tikz},
    /cuboid/.cd,
    width/.store in=\cubex,
    height/.store in=\cubey,
    depth/.store in=\cubez,
    units/.store in=\cubeunits,
    scale/.store in=\cubescale,
    label/.store in=\cubelabel,
    line/.store in=\cubeline,
    backline/.store in=\cubeback,
    width=10,
    height=10,
    depth=10,
    units=cm,
    scale=.1,
    line=draw,
    backline=densely dashed,
  }
\newcommand{\cuboid}[2]{
    \begin{tikzpicture}
     \pic [#1] at (0,0) {annotated cuboid={#2}};
    \end{tikzpicture}
}

\tikzstyle{cubecontainer}=[outer sep = 0pt, inner sep= 0pt]
\tikzstyle{connectarrow}=[-{Triangle[angle=60:0pt 2]},
                          line width= 10pt, shorten >=3mm,shorten <=3mm, draw=gray!60]
\begin{document}
\begin{tikzpicture}

\node[cubecontainer] (a) at (0,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=A, width=6, height=20, depth=15, units=mm}};
\node[cubecontainer] (b) at (4,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=B, width=6, height=20, depth=15, units=mm}};
\node[cubecontainer] (c) at (8,0) {\cuboid{fill=cyan!20, text=green!50!black, draw=black}
                                  {label=C, width=6, height=20, depth=15, units=mm}};

\draw[line width=2mm, green, -latex, shorten >=1mm, shorten <=1mm] (a.north) --++(90:1cm)-|(c.north);
\draw[ultra thick, red, decoration={brace, raise=5pt, mirror, amplitude=3mm}, decorate] (a.south west) -- (c.south east);
\draw[line width=2mm, green, -latex, shorten >=1mm, shorten <=1mm] ([yshift=-5mm]b.south)--++(-90:1.5cm);

\end{tikzpicture}
\end{document}

enter image description here

|improve this answer|||||
  • Nice solution. Thanks. Is it possible to locate an arrow bellow the bracket as my figure – John Apr 6 '17 at 6:52
  • 1
    @user8264: Done! – Ignasi Apr 6 '17 at 6:56
  • Nice once. I just want to ask about your using lib decorations.pathreplacing. Does it have any option to smooth the corner of connection?It is similar bent arrow – John Apr 6 '17 at 7:04
  • @user8264 What corner do you want to smooth? Your original figure doesn't show it. – Ignasi Apr 6 '17 at 7:33
  • Sorry. Your answer is enough for my original question. I just want to extend it. The bent arrow like this link (just 2D case) shutterstock.com/image-illustration/… – John Apr 6 '17 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.