TikZ how to temporarily discontinue line at intersection of two lines

intersectionslineshapestikz-pgf

I am working in TikZ and I am trying to make one line stop, then start again before and after the intersection with another line. I have attempted to put a node at the intersection point and filled it with white, but this has cut both lines. I only want the blue line to break and the black line to continue. Any help would be great!

Here's what the following code does:
enter image description here

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}%
\usetikzlibrary{arrows.meta,shapes.misc, positioning, shapes.geometric, intersections}%

\begin{document}
   \begin{tikzpicture}
    \draw [-Latex, RoyalBlue, name path = b1] (0,-1) -- (10,-1);
    \draw [-Latex, RoyalBlue, name path = b2] (0,-0.5) -- (10,-0.5);
    \draw [-Latex, RoyalBlue, name path = b3] (0,0) -- (10,0);
    \draw [-Latex, RoyalBlue, name path = b4] (0,0.5) -- (10,0.5);
    \draw [-Latex, RoyalBlue, name path = b5] (0,1) -- (10,1);

    \node[trapezium,
    draw = black,
    thick,
    rotate=90,
    minimum width = 2.5cm,
    minimum height= 1cm,
    trapezium left angle = 100,
    trapezium right angle = 80,
    trapezium stretches=true,
    trapezium stretches body =true,
    name path = trap1] (t) at (1,0) {};
    
    \draw[name intersections={of=b1 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b2 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b3 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b4 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b5 and trap1}] (intersection-1) node[fill=white] {};
    \end{tikzpicture}
\end{document}

Best Answer

I know it is only a workaround but you could use that node twice: first for intersections, and second to actually draw it.

To make things a bit easier you can also add a style for the node so you can reuse it any time you need. The same can be done with coordinates, such that such you can have named coordinates for multiple usage.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}%
\usetikzlibrary{arrows.meta,shapes.misc, positioning, shapes.geometric, intersections}%

\tikzset{
    tnode/.style = {
        trapezium,
        thick,
        rotate=90,
        minimum width = 2.5cm,
        minimum height= 1cm,
        trapezium left angle = 100,
        trapezium right angle = 80,
        trapezium stretches=true,
        trapezium stretches body =true,
        name path = trap1,
    },
 }


\begin{document}
   \begin{tikzpicture}
    \coordinate (ct) at (1,0);
    \node[tnode] (t) at (ct) {};
    
    \draw [-Latex, RoyalBlue, name path = b1] (0,-1) -- (10,-1);
    \draw [-Latex, RoyalBlue, name path = b2] (0,-0.5) -- (10,-0.5);
    \draw [-Latex, RoyalBlue, name path = b3] (0,0) -- (10,0);
    \draw [-Latex, RoyalBlue, name path = b4] (0,0.5) -- (10,0.5);
    \draw [-Latex, RoyalBlue, name path = b5] (0,1) -- (10,1);

    \draw[name intersections={of=b1 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b2 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b3 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b4 and trap1}] (intersection-1) node[fill=white] {};
    \draw[name intersections={of=b5 and trap1}] (intersection-1) node[fill=white] {};

    \node [tnode, draw] at (ct) {};
\end{tikzpicture}
\end{document}

enter image description here

EDIT. Example based on scope and the background layer.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}

\usetikzlibrary{
    arrows.meta,
    shapes.misc,
    positioning,
    shapes.geometric,
    intersections,
    backgrounds,        % For a background layer
}


\begin{document}
   \begin{tikzpicture}
    \node[
        trapezium,
        draw = black,
        thick,
        rotate=90,
        minimum width = 2.5cm,
        minimum height= 1cm,
        trapezium left angle = 100,
        trapezium right angle = 80,
        trapezium stretches=true,
        trapezium stretches body =true,
        name path = trap1,
    ] (t) at (1,0) {};

    \begin{scope}[on background layer]
        \foreach \c [evaluate=\c as \y using {\c/2}] \n in {-2,...,2} {
            \draw [-Latex, RoyalBlue, name path={b\c}] (0,\y) -- (10,\y);
            \path [name intersections={of={b\c} and trap1, name=i}] (i-1) node[fill=white] {};
        };
    \end{scope}
\end{tikzpicture}
\end{document}