How to fill by dotted water below rounded corners?

As suggested in a comment, the key is to \clip the image. For that, you should create the area which has to be clipped in one command, instead of multiple commands. With cycle, you return to the point where the command was started (here: (2,1)).

\draw[clip] (2,1) -- (3.3,1) arc (90:0:1cm) --  (4.3,-0.2) arc (180:0:0.2) -- 
    (4.7,0) arc (180:90:1cm) -- (7,1) -- (7,-3) -- (2,-3) -- cycle;

This draws the path, and clips everything which follows to that area. So simply place your two \foreach loops after this.

As shown in the example below, you should place these commands inside \begin{scope} ... \end{scope}, which allows you to create not-clipped paths afterwards. Otherwise, the thin pipe would always be below the filling.

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{patterns}
\begin{document} 
\begin{tikzpicture}[thick]

% Glass
\draw (2,1.5) -- (2,-3) -- (7,-3) -- (7,1.5);

% Fill
\begin{scope}
    \clip (2,1) -- (3.3,1) arc (90:0:1cm) --  (4.3,-0.2) arc (180:0:0.2) -- (4.7,0) arc (180:90:1cm) -- (7,1) -- (7,-3) -- (2,-3) -- cycle;
    \foreach \x in {-2.9,-2.7,...,2}
        {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 2cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
    \foreach \x in {-3.0,-2.8,...,2}
        {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 1.9cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
    \draw (2,1) -- (3.3,1) arc (90:0:1cm) --  (4.3,-0.2) arc (180:0:0.2) -- (4.7,0) arc (180:90:1cm) -- (7,1) -- (7,-3) -- (2,-3) -- cycle;
\end{scope}

% Thin pipe
\draw (4.3,3) -- (4.3,-2);
\draw (4.7,3) -- (4.7,-2);

\end{tikzpicture}
\end{document}

result


As I suggested in a previous comment, you could use this code with the 'rounded corners' option (you can adjust the value of the radius) as an alternative to arc (you only need to split the filling in three parts):

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{patterns}
\begin{document} 
\begin{tikzpicture}[thick]

% Fill
\begin{scope}
\clip {[rounded corners=6](2,-3) -- (2,1) -- (4.3,1)  -- (4.3,-0.2)}  -- (4.3,-3) -- cycle;
\foreach \x in {-2.9,-2.7,...,2}
    {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 2cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
\foreach \x in {-3.0,-2.8,...,2}
    {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 1.9cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
\draw {[rounded corners=6](2,-2) -- (2,1) -- (4.3,1)  -- (4.3,-0.2)}  -- (4.3,-2);  
\end{scope}

\begin{scope}
\clip {[rounded corners=6](4.3,-3) -- (4.3,-0.2) -- (4.7,-0.2)}  -- (4.7,-3) -- cycle;
\foreach \x in {-2.9,-2.7,...,2}
    {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 2cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
\foreach \x in {-3.0,-2.8,...,2}
    {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 1.9cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
\draw {[rounded corners=6, pattern=north east lines](4.3,-2) -- (4.3,-0.2) -- (4.7,-0.2)}  -- (4.7,-2); 
\end{scope}

\begin{scope}
\clip {[rounded corners=6](4.7,-0.2) -- (4.7,1)   -- (7,1)} -- (7,-3) -- (4.7,-3) -- cycle;
\foreach \x in {-2.9,-2.7,...,2}
    {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 2cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
\foreach \x in {-3.0,-2.8,...,2}
    {\draw[gray!30, dash pattern = on 4pt off 4pt] ([xshift = 4pt] + 1.9cm, \x cm) -- ++([xshift = -4pt]5.0cm, 0);}
\draw {[rounded corners=6](4.7,-2) -- (4.7,-0.2) -- (4.7,1) -- (7,1)} -- (7,-2);
\end{scope}

% Glass
\draw (2,1.5) -- (2,-3) -- (7,-3) -- (7,1.5);

% Thin pipe
\draw (4.3,3) -- (4.3,-2);
\draw (4.7,3) -- (4.7,-2);

\end{tikzpicture}
\end{document}

which will give you this picture:

enter image description here

Tags:

Tikz Pgf