3

I'm trying to draw a simple hydraulic brake system. I've already managed to make a simple hydraulic system.

\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}   
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.pathmorphing} 
\usepackage{tkz-euclide}
\usetikzlibrary{calc,intersections,through,backgrounds,snakes}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
        \begin{center}
        \begin{tikzpicture}
        \tkzInit[ymin=0,ymax=6.5, xmin=0,xmax=10]
        \tkzClip
        %\tkzGrid
        \tkzDefPoints{1/6/A, 1/1/B, 9/1/C, 9/6/D, 6/6/E, 6/2/F, 2/2/G, 2/6/H};
        \tkzDefPoints{1/5/K, 6/3/L}; 
        \tkzDefPoints{1.5/5/M} 
        \filldraw[black] (K) --+ (1,0) --+ (1,0.5) --+ (0,0.5);
        \filldraw[black] (L) --+ (3,0) --+ (3,0.5) --+ (0,0.5);
        \filldraw[black!40] (K) --+ (1,0) -- (G) -- (F) --(L) --+ (3,0) -- (C) -- (B);
        \draw [thick] (A) -- (B) -- (C) -- (D);
        \draw [thick] (E) -- (F) -- (G) -- (H);
        \draw[->, very thick,red] (K) ++ (0.5,0.5) --+ (0,1); 
        \draw[->, very thick, red] (L) ++ (1.5,0.5) --+ (0,2);
        \node[white, above right] at (K) {$A_1$};
        \node[white, above right] at (L) {$A_2$};
        \end{tikzpicture}
        \end{center}
\end{document}

enter image description here

But I want it to make de tubes curved to make it something like this: enter image description here

So instead of the rectangular oil tubes, I want them curved and filled. Is Tikz the way to go, or should I look for something else?

5

Yes, I'd say you can go with TikZ; a double with appropriate out=, in= values can do the job; I also used some layers to place some of the elements:

enter image description here

The code:

\documentclass[border=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{fit,arrows.meta}

\definecolor{myorange}{RGB}{206,103,44}
\definecolor{myred}{RGB}{176,24,43}
\definecolor{mybg}{RGB}{166,161,121}

\pgfdeclarelayer{background}
\pgfdeclarelayer{backgroundii}
\pgfsetlayers{backgroundii,background,main}

\begin{document}

\begin{tikzpicture}[
  arr/.style={
    line width=1.5pt,
    Circle-Stealth
  }
]
\begin{scope}[rotate=-30,transform shape]
\node[fill=myorange,text width=3cm,minimum height=40pt] 
  (tube1l)
  {};
\node[fill=myred,text width=1cm,minimum height=40pt,anchor=east,outer sep=0pt] 
  (tube2l)
  at (tube1l.west)
  {};
\begin{pgfonlayer}{background}
\filldraw[white,draw=black]
  ([shift={(0pt,5pt)}]tube2l.center|-tube1l.north west) 
  rectangle
  ([shift={(5pt,-5pt)}]tube1l.south east); 
\end{pgfonlayer}
\end{scope}

\node[fill=myorange,text width=1cm,minimum height=60pt] 
  (tube1r)
  at (20,4) 
  {};
\node[fill=myred,text width=1.5cm,minimum height=60pt,anchor=west,outer sep=0pt] 
  (tube2r)
  at (tube1r.east)
  {};
\begin{pgfonlayer}{background}
\filldraw[white,draw=black]
  ([shift={(0pt,5pt)}]tube2r.center|-tube1r.north east) 
  rectangle
  ([shift={(-5pt,-5pt)}]tube1r.south west); 
\end{pgfonlayer}

\draw[double,double distance=10pt,black,double=myorange]
  (tube1l.east) to[out=-30,in=180] (tube1r.west);  

\draw[arr]
  (tube1l.west) -- (-30:2.3cm);
\draw[arr]
  (tube1r.east) -- ++(2.5cm,0);

\begin{pgfonlayer}{backgroundii}
\fill[mybg]
  (current bounding box.north west)
  rectangle
  (current bounding box.south east);
\end{pgfonlayer}
\end{tikzpicture}

\end{document}
|improve this answer|||||
  • 1
    even the colors are reproduced perfect ;-) – Arne Timperman Sep 21 '15 at 17:41
4

You can use double and friends. For drawing a bent line, you may use plot (as I did) or ..controls or the hobby package.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \draw[thick,double=red!40!brown,double distance=3pt,draw=black]  plot[smooth, tension=.7] coordinates {(-3.5,-1) (-1,-2) (1.5,0) (3,0.9) (4.5,1)};
\end{tikzpicture}

\end{document}

enter image description here

|improve this answer|||||

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.