5

I am using for the first time TikZ and I am creating a flowchart. I would like to insert some trapezia for LPC, HPC, HPT and LPT, as shown in the image below. The problem is that, if I simply substitute box with compr or turb,

\tikzset{turb/.style={draw, trapezium, thick, rotate=90, minimum height=1em, minimum width=6em}} %HPT and LPT
\tikzset{compr/.style={draw, trapezium, thick, rotate=-90, minimum height=1em, minimum width=6em}} %LPC and HPC

all boxes become overlapped. How can I solve that? Thank you.

\documentclass[a4paper,11pt]{article}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{caption}
  \usetikzlibrary{shapes,arrows,fit,calc,positioning}
  \tikzset{box/.style={draw, rectangle, rounded corners, thick, text width=6em, text centered, minimum height=3em}}
  \tikzset{line/.style={draw, thick, -latex'}}
  \tikzset{combustor/.style={draw, ellipse, thick, minimum height=30pt, minimum width=50pt}}
  \tikzset{turb/.style={draw, trapezium, thick, rotate=90, minimum height=1em, minimum width=6em}} %HPT and LPT
  \tikzset{compr/.style={draw, trapezium, thick, rotate=-90, minimum height=1em, minimum width=6em}} %LPC and HPC    



\begin{document}
  \begin{figure}
    \centering
      \begin{tikzpicture}[auto,scale=0.6, every node/.style={scale=0.6}]

        %place nodes
        \node [box] (dev2) {Deviatore 2};
        \node [box, below=0.5cm of dev2] (HPC)       {HPC};
        \node [combustor, right=0.5cm of HPC] (Comb) {Combustore};
        \node [box, right=0.5cm of Comb] (HPT)       {HPT};
        \node [box, right=0.5cm of HPT] (LPT)        {LPT};
        \node [box, right=0.5cm of LPT] (nozzle1)    {Nozzle 1};
        \node [box, left=0.5cm of HPC] (LPC)         {LPC};
        \node [box, below=0.5cm of LPC] (dev1)       {Deviatore 1};
        \node [box, right=0.5cm of dev1] (bypass)    {Bypass};
        \node [box, right=0.5cm of bypass] (nozzle2) {Nozzle 2};
        \node [box, below=0.5cm of dev1] (fan)       {Fan};
        \node [box, below=0.5cm of fan] (diffusore)  {Diffusore};
        %draw path
        \path [line] (diffusore) --       (fan);
        \path [line] (fan)       --       (dev1);
        \path [line] (dev1)      --       (bypass);
        \path [line] (bypass)    --       (nozzle2);
        \path [line] (dev1)      --       (LPC);
        \path [line] (LPC)       --       (HPC);
        \path [line] (HPC)       --       (dev2);
        \path [line] (dev2)      -|       (HPT);
        \path [line] (HPC)       --       (Comb);
        \path [line] (Comb)      --       (HPT);
        \path [line] (HPT)       --       (LPT);
        \path [line] (LPT)       --       (nozzle1);
        \path [line] (dev2)      -|       (LPT);

      \end{tikzpicture}
      \caption{My first flowchart}\label{fig:flowchart}
  \end{figure}
\end{document}

enter image description here

enter image description here

Torbjørn T.
  • 206,688
Marco
  • 1,373

2 Answers2

6

With help of your MWE I try to reproduce your sketch:

enter image description here

In it I use suggestion of Alenanno for rotating node shapes and some other measure to make code compact as possible:

  • for lines between nodes box I use option join. It spare me draw lines between those nodes
  • for eliminating line join line, where is not present, I add in preamble definition ofreset of join option in node. Used is node "Deviatore 2". The solution for this is taken from @user3188445 answer here.
  • in positioning of nodes the library chains is used. Consequently for the nodes in on line is not necessary to say left= of >node name>
  • for turbines and compressors is defined common style with parameter for their orientations
  • for distances between nodes is defined common distance node distance=7mm

Complete code is:

\documentclass{article}
%---------------------------------------------------------------%
    \usepackage{tikz}
\usetikzlibrary{arrows,calc,chains,positioning,shapes}
%    \usepackage{caption}
%    \usepackage[margin=25mm,showframe]{geometry}

\makeatletter
\tikzset{reset/.code={\def\tikz@after@path{}}}
\makeatother

    \begin{document}
%    \begin{figure}[htb]
    \centering
\begin{tikzpicture}[
           node distance = 7mm,
every path/.append style = {draw=teal!30!black, very thick},
                    font = \sffamily,
 start chain = going right,
 base/.style = {draw, align=center},
  box/.style = {rectangle, base,
                %rounded corners, on the sketch are not present
                text width=6em, minimum height=3em,
                join=by -latex',on chain},
 comb/.style = {ellipse, base,
                minimum height=30pt, minimum width=50pt,
                on chain},
 turb/.style = {trapezium, base,
                shape border rotate=#1,
                minimum width=4em,
                on chain}, %HPT and LPT
                    ]
%from below to top                    
\node [box] (diff)  {Diffusore};
\node [box, above=of diff] (fan)    {Fan};
%
\node [box,above=of fan] (dev1)     {Deviatore 1};
\node [box] (bypass)                {Bypass};
\node [box] (nozzle2)               {Nozzle 2};
%  
\node [turb=270,above=of dev1] (lpc)    {LPC};
\node [turb=270]    (hpc)               {HPC};
\node [comb]        (Comb)              {Combustore};
\node [turb=90]     (hpt)               {HPT};
\node [turb=90]     (lpt)               {LPT};
\node [box]         (nozzle1)           {Nozzle 1};
%
\node [box,reset, 
       above=of hpc.bottom left corner -| hpc.east]
                    (dev2)              {Deviatore 2};
%
\draw[-latex'] 
    (dev1)      edge (lpc)
    (lpc)       edge (hpc)
    (hpc)       edge (Comb)
    (Comb)      edge (hpt)
    (hpt)       edge (lpt);
\draw[-latex']  (hpc.top left corner) -- (dev2);
\draw[-latex']  (dev2) -| (lpt.bottom right corner);
\draw[-latex']  (dev2) -| (hpt.bottom right corner);
\end{tikzpicture}
%    \caption{My first flowchart}
%\label{fig:flowchart}
%    \end{figure}
    \end{document}
Zarko
  • 296,517
5

Instead of rotate=90, use the option shape border rotate=90 (or 270 for the inverse):

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
Alenanno
  • 37,338