[Tex/LaTex] tikz-3dplot: Filling 3d-profile

tikz-3dplottikz-pgf

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz-3dplot}

\begin{document}

\tdplotsetmaincoords{70}{70} 
\begin{tikzpicture}[tdplot_main_coords, scale=2]

    %define coordinates 
    \coordinate (O) at (0,0,0);
    \coordinate (A) at (-0.15,0,-0.1);
    \coordinate (B) at (0.15,0,-0.1);
    \coordinate (C) at (0.15,0,0.1);
    \coordinate (D) at (-0.15,0,0.1);
    \coordinate (E) at (-0.15,0.6,-0.1);
    \coordinate (F) at (0.15,0.6,-0.1);
    \coordinate (G) at (0.15,0.6,0.1);
    \coordinate (H) at (-0.15,0.6,0.1);

    %draw straight-profile
    \draw (A) -- (B) -- (C) -- (D) -- cycle;
    \draw (E) -- (F) -- (G) -- (H) -- cycle;
    \draw (A) -- (E);
    \draw (B) -- (F);
    \draw (C) -- (G);
    \draw (D) -- (H);

    %fill the straight-profile
    \draw[fill=blue, opacity = 0.1] (A) -- (E) -- (H) -- (D);
    \draw[fill=blue, opacity = 0.1] (B) -- (F) -- (G) -- (C);
    \draw[fill=blue, opacity = 0.1] (C) -- (G) -- (H) -- (D);
    \draw[fill=blue, opacity = 0.1] (A) -- (B) -- (F) -- (E);

    %draw bend-profile 
    \tdplotsetrotatedcoords{90}{90}{90}
    \coordinate (bend) at (0,1.1,0.5);
    \tdplotsetrotatedcoordsorigin{(bend)}
    \draw[canvas is zy plane at x = 0.15](-0.1,0.6) arc (0:-90:-0.6);
    \draw[canvas is zy plane at x = -0.15](-0.1,0.6) arc (0:-90:-0.6);
    \draw[canvas is zy plane at x = 0.15](0.1,0.6) arc (0:-90:-0.4);
    \draw[canvas is zy plane at x = -0.15](0.1,0.6) arc (0:-90:-0.4);
    \draw[tdplot_rotated_coords] (-0.15,0,-0.1) -- (0.15,0,-0.1) -- (0.15,0,0.1) -- (-0.15,0,0.1) -- (-0.15,0,-0.1);

    %fill the bend-profile
    %...?

\end{tikzpicture}
\end{document}

enter image description here

Hello,

I have the following problem. I want the black bend-profile to be filled blue like the straight-one. Can anyone help me with that problem?

Thanks, Nico

Best Answer

Something like this? But it isn't as tidy as it might be....

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{70}
\begin{tikzpicture}
  [
    tdplot_main_coords,
    scale=2,
    my fill/.style={fill=blue, fill opacity=.1}
  ]
  %define coordinates
  \coordinate (O) at (0,0,0);
  \coordinate (A) at (-0.15,0,-0.1);
  \coordinate (B) at (0.15,0,-0.1);
  \coordinate (C) at (0.15,0,0.1);
  \coordinate (D) at (-0.15,0,0.1);
  \coordinate (E) at (-0.15,0.6,-0.1);
  \coordinate (F) at (0.15,0.6,-0.1);
  \coordinate (G) at (0.15,0.6,0.1);
  \coordinate (H) at (-0.15,0.6,0.1);
  % fill and draw the straight-profile
  \draw [my fill] (A) -- (B) -- (F) -- (E) -- cycle;
  \draw [my fill] (A) -- (E) -- (H) -- (D) -- cycle;
  \draw [my fill] (C) -- (G) -- (H) -- (D) -- cycle;
  \draw [my fill] (B) -- (F) -- (G) -- (C) -- cycle;
  % draw bend-profile
  \tdplotsetrotatedcoords{90}{90}{90}
  \coordinate (bend) at (0,1.1,0.5);
  \tdplotsetrotatedcoordsorigin{(bend)}
  % get first coordinate
  \path [canvas is zy plane at x = -0.15] (E) arc (0:-90:-0.6) coordinate (a);
  % draw and fill bend-profile
  \draw [canvas is zy plane at x = -0.15, my fill] (H) arc (0:-90:-0.4) coordinate (d) -- (a) arc (-90:0:-0.6) -- cycle;
  \draw [canvas is zy plane at x = 0.15, my fill] (F) arc (0:-90:-0.6) coordinate (b) -- (a) arc (-90:0:-0.6) -- cycle;
  \draw [canvas is zy plane at x = 0.15, my fill] (G) arc (0:-90:-0.4) coordinate (c) -- (d) arc (-90:0:-.4) -- cycle;
  \draw [canvas is zy plane at x = 0.15, my fill] (G) arc (0:-90:-0.4) coordinate (c) -- (b) arc (-90:0:-.6) -- cycle;
\end{tikzpicture}
\end{document}

3d filled

Related Question