1

I am trying to get to this : enter image description here

I have tried this:


%CONFIGURACIÓN DEL DOCUMENTO Y HOJA

\documentclass[tikz,border=3.14pt]{standalone} \usetikzlibrary{3d,decorations.text,shapes.arrows,positioning,fit,backgrounds} \tikzset{pics/fake box/.style args={% #1=color, #2=x dimension, #3=y dimension, #4=z dimension #1 with dimensions #2 and #3 and #4}{ code={ \draw[gray,ultra thin,fill=#1] (0,0,0) coordinate(-front-bottom-left) to ++ (0,#3,0) coordinate(-front-top-right) --++ (#2,0,0) coordinate(-front-top-right) --++ (0,-#3,0) coordinate(-front-bottom-right) -- cycle; \draw[gray,ultra thin,fill=#1] (0,#3,0) --++ (0,0,#4) coordinate(-back-top-left) --++ (#2,0,0) coordinate(-back-top-right) --++ (0,0,-#4) -- cycle; \draw[gray,ultra thin,fill=#1!80!black] (#2,0,0) --++ (0,0,#4) coordinate(-back-bottom-right) --++ (0,#3,0) --++ (0,0,-#4) -- cycle; \path[gray,decorate,decoration={text effects along path,text={texth}}] (#2/2,{2+(#3-2)/2},0) -- (#2/2,0,0); } }} % from https://tex.stackexchange.com/a/52856/121799 \tikzset{circle dotted/.style={dash pattern=on .05mm off 2mm, line cap=round}}

\begin{document}

%CONFIGURACIÓN DEL ENCABEZADO

%DESDE AQUÍ SE ESCRIBE TODO EL CONTENIDO

% \begin{abstract}

% Solution to Homework % \end{abstract}

\begin{tikzpicture}[x={(1,0)},y={(0,1)},z={({cos(60)},{sin(60)})}, font=\sffamily\small,scale=2,roundnode/.style={circle, draw=green!60, fill=green!5, very thick, minimum size=7mm}, squarednode/.style={rectangle, draw=gray!60, fill=white!5, very thick, minimum size=7mm}, roundnode/.style={circle, draw=green!60, fill=purple!10, very thick, minimum size=7mm}, ]

\node[roundnode ] at (0.1 ,0.2,0) (data) {$text $}; \node[squarednode ] at (0.1 ,0.9,0 ) (next4) {$text3$};

\node[squarednode ] at (0.4,0.65,0.7 ) (next2) {$text$}; \node[squarednode ] at (0.1 ,-0.5,0) (next) {$text$}; \draw[->,very thick] (next) -- (data) ; \draw[->,very thick] (next2) -- (next4) ; \draw[->,very thick] (next4) -- (data) ; %\node[draw,single arrow] at (0.7 ,0.5,0) {Text};

\foreach \X [count=\Y] in {1.6,1.4,1.2} { \draw pic (box1-\Y) at (\Y,-\X/2,0) {fake box=white!70!green with dimensions 0.2 and {2\X} and 1\X}; } \end{tikzpicture}

\end{document}

which gives this:

enter image description here

The shape of the rectangle in the latex is fine as is. But how could I get the whole diagram as in the first image.

Next:

  1. make text on rectangle different
  2. reduce spaces between rectangle
  3. add the big outer circle

Thanks

  • Welcome to TeX.SX! To simplify things, I would not use the 3D library for this diagram. Actually, these 3D-like shapes can easily be drawn by just shifting some coordinates in a 45-degrees angle to the upper right. Using three-dimensional coordinates for this, and especially for the rest of your diagram is just not needed and only makes the code hard to read. Do get the frame-like box, take a look at the fit library. – Jasper Habicht Apr 05 '23 at 20:32
  • @JasperHabicht thank you for the feedback. I also see that it would be super hard to continue along this example. I will check out the fit library. Does fit library allows 3D shapes. – koolaids Apr 05 '23 at 21:18
  • Actually, 3D coordinates are directly converted internally to 2D coordinates which are placed onto the canvas. These 2D coordinates are then used when referencing to them. So, the fit library has no problems to "find" a coordinate that you defined in 3D, because it just uses its 2D representation. – Jasper Habicht Apr 05 '23 at 21:25
  • @JasperHabicht thank you! – koolaids Apr 05 '23 at 21:38
  • @JasperHabicht could you kindly provide a reference to an example of the frame-like box? Thank you! – koolaids Apr 05 '23 at 23:52

1 Answers1

2

To place vertical text on some path using the decorations.text library inside a \foreach loop where the text is given as one of the loop's arguments is not trivial, because you first need to expand the argument that contains the text. So, you need to do something like:

\foreach \l [count=\i] in {Text, TEXt} {
    \edef\textpath{
        \noexpand%
        \path[decorate, decoration={
            text effects along path, text={\l}, text align=center
        }] (\i,2) -- (\i,-2);
    }\textpath
}

The following approach shows how you could use this inside your drawing. Also, it shows how to use the fit library in combination with pics:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, decorations.markings, fit, arrows.meta}

% definition of some colors \colorlet{mygreen1}{green!50!cyan!80!black} \colorlet{mygreen2}{yellow!80!green!80!black!50} \colorlet{myyellow}{yellow!50!black}

% definition of the cuboid pic \tikzset{ pics/regular cuboid/.style={ code={ \tikzset{regular cuboid/.cd, #1} \draw[regular cuboid/front] (0,0) coordinate (-south west) rectangle (\pgfkeysvalueof{/tikz/regular cuboid/width}, \pgfkeysvalueof{/tikz/regular cuboid/height}) coordinate (-north east) node[regular cuboid/label] {\pgfkeysvalueof{/tikz/regular cuboid/label text}}; \draw[regular cuboid/top] (0,\pgfkeysvalueof{/tikz/regular cuboid/height}) coordinate (-north west) -- ++(\pgfkeysvalueof{/tikz/regular cuboid/depth}, \pgfkeysvalueof{/tikz/regular cuboid/depth}) coordinate (-far north west) -- ++(\pgfkeysvalueof{/tikz/regular cuboid/width},0) coordinate (-far north east) -- (-north east) -- cycle; \draw[regular cuboid/side] (\pgfkeysvalueof{/tikz/regular cuboid/width},0) coordinate (-south east) -- ++(\pgfkeysvalueof{/tikz/regular cuboid/depth}, \pgfkeysvalueof{/tikz/regular cuboid/depth}) coordinate (-far south east) -- (-far north east) -- (-north east) -- cycle; \coordinate (-north) at ({0.5\pgfkeysvalueof{/tikz/regular cuboid/width}}, \pgfkeysvalueof{/tikz/regular cuboid/height}); \coordinate (-south) at ({0.5\pgfkeysvalueof{/tikz/regular cuboid/width}},0); \coordinate (-east) at (\pgfkeysvalueof{/tikz/regular cuboid/width}, {0.5\pgfkeysvalueof{/tikz/regular cuboid/height}}); \coordinate (-west) at (0,0.5\pgfkeysvalueof{/tikz/regular cuboid/height}); } }, regular cuboid/height/.initial={1}, regular cuboid/width/.initial={1}, regular cuboid/depth/.initial={0.5}, regular cuboid/label text/.initial={}, regular cuboid/front/.style={fill=black!10}, regular cuboid/top/.style={fill=black!10}, regular cuboid/side/.style={fill=black!20}, regular cuboid/label/.style={midway} }

\begin{document} \begin{tikzpicture}

% create the row of pics \coordinate (box 0-south west) at (0,0); \foreach \h/\f/\d/\l [count=\i] in { 3cm/yellow!20/mygreen1/Text, 3cm/yellow!20/mygreen1/TEXt, 2.9cm/blue!20/black/Text, 2.5cm/yellow!20/mygreen1/Text, 2.4cm/yellow!20/mygreen1/Text, 2.3cm/blue!10/black/Text, 2cm/yellow!20/mygreen1/Text } { % create the cuboid \pgfmathtruncatemacro{\lasti}{\i-1} \pic (box \i) at ([xshift=1.25cm]box \lasti-south west) { regular cuboid={ front/.style={draw=\d,fill=\f}, top/.style={draw=\d,fill=\f}, side/.style={draw=\d,fill=\f!black!20}, height={\h}, width={0.65cm}, depth={0.25cm} } }; % add the vertical label \edef\labelpath{ \noexpand% \path[decorate, decoration={ text effects along path, text={\l}, text align=center }] (box \i-north) -- (box \i-south); }\labelpath }

% add the last cuboid with horizontal label \pic (box 8) at ([xshift=1.25cm]box 7-south west) { regular cuboid={ front/.style={fill=mygreen2}, top/.style={fill=mygreen2}, side/.style={fill=mygreen2!80!black}, width={1.33cm}, depth={0.25cm}, label text={Text} } };

% add the surrounding frame with arrow heads \node[draw, thick, rounded corners=0.5cm, inner xsep=0.5cm, inner ysep=1cm, fit={(box 1-south west) ([yshift=0.5cm]box 1-far north west) (box 8-far north east)}, postaction={decorate, decoration={markings, mark={at position 7.5cm with {\arrow{Stealth[length=10pt]}}}, mark={at position 15.5cm with {\arrow{Stealth[length=10pt]}}}, mark={at position 32.5cm with {\arrow{Stealth[length=10pt]}}} }}] (frame) {};

% place some text inside the frame \node[myyellow, font=\bfseries, anchor=west] at ([yshift=1cm]box 1-north west) {Some text, some text};

% add the two orange nodes at the bottom of the frame \node[draw, fill=orange!10, rounded corners, inner sep=0.25cm, minimum width=4cm] at ([yshift=-1cm, xshift=4cm]box 1-south west) {Text};

\node[draw, fill=orange!10, rounded corners, inner sep=0.25cm, minimum width=4cm] at ([yshift=-1cm, xshift=8.5cm]box 1-south west) {Text};

% place another pic to the left \pic (box 9) at (-4,0) { regular cuboid={ front/.style={draw=mygreen1,fill=mygreen2}, top/.style={draw=mygreen1,fill=mygreen2}, side/.style={draw=mygreen1,fill=mygreen2!80!black}, width={1.33cm}, depth={0.25cm}, label text={Text} } };

% add the three nodes above and below the pic on the left \node[draw=mygreen1, rounded corners, inner sep=0.25cm, minimum width=2cm] (label 1) at ([yshift=-1cm]box 9-south) {text};

\node[draw=mygreen1, rounded corners, inner sep=0.25cm, minimum width=2cm] (label 2) at ([yshift=1.5cm]box 9-north) {text};

\node[draw=mygreen1, rounded corners, inner sep=0.25cm, minimum width=2cm] (label 3) at ([yshift=1cm]label 2.north) {text};

% add the arrows with labels \draw[-{Stealth[length=10pt]}, thick] (frame.90) -- ++(0,0.5cm) -| (label 3.north) node[pos=0.4, below, myyellow, font=\bfseries] {Some text};

\draw[-{Stealth[length=10pt]}, thick] (label 1.north) -- (box 9-south);

\draw[-{Stealth[length=10pt]}, thick] (label 3.south) -- (label 2.north);

\draw[-{Stealth[length=10pt]}, thick] (label 2.south) -- (box 9-north |- box 9-far north east);

\draw[-{Stealth[length=10pt]}, thick, myyellow] (box 9-west -| box 9-far north east) -- (box 9-west -| frame.west) node[midway, above, myyellow, font=\bfseries] {Text} node[midway, below, myyellow, font=\bfseries] {Text};

\end{tikzpicture} \end{document}

enter image description here

  • @Thanks! I made a new version based on your comments here. Could I post that as a separate question. or add it to this-- I wanted to play around with it – koolaids Apr 06 '23 at 05:49
  • @koolaids If you have a different question, better ask a new question. The old question might still be useful to somebody. If you have an own solution on your problem, post it as another answer to this question. It depends ... It would maybe not so nice to completely change your original question, now that you got an answer to it =) ... – Jasper Habicht Apr 06 '23 at 05:51
  • 1
    I appreciate the clarifications. It is an incomplete answer so I better ask it as a new question. – koolaids Apr 06 '23 at 05:56