I want to do a loop until there is intersection points between two paths
edit
I oblic lines until they don't intersect the circle. When there is zero intersection points I have an error. Is there a way to deal with zero intersection points ?
\documentclass[tikz,margin=3pt]{standalone}
%\usepackage{}
\usetikzlibrary{calc,intersections}
\def\Dir{45}
\def\DirStep{1pt}
\def\Length{10}
\begin{document}
\begin{tikzpicture}
\coordinate (Depart) at (0,0) ;
\begin{scope}[shift=(Depart),rotate=\Dir]
\clip[name path=bob,draw] (0,0) circle (1) ;
\pgfmathtruncatemacro\i{0}
\loop
\draw[name path=trait,shift={(0,\i*\DirStep)}] (-5,0)--(5,0) ;
\path[name intersections={%
of=trait and bob,
name=\i,
sort by=trait,
total=\t}]
\pgfextra{\xdef\InterNb{\t}} ;
\pgfmathtruncatemacro\i{\i+1}
\ifnum\i<10
% I want :
%\ifnum\\InterNb>0
\repeat
\end{scope}
\node {\InterNb} ;
\end{tikzpicture}
\end{document}