I am facing a compilation error in a weird way. I have trimmed my code to the maximum but still my MWE is not too small, so I'll focus first on the weird part :
\foreach \j in {0,1,...,5}{
\pgfmathsetmacro{\AngleEntree}{-10*\j}
\coordinate (centreCardan) at (-20,{-18*\j},5);
% Circle
\begin{scope}[tdplot_screen_coords]
\draw[red,ultra thick,dashed] (centreCardan) circle (\r);
\end{scope}
%Tube
\coordinate (centrePivVR) at ($(centreCardan)+ ({-5*cos(\AngleEntree)},{-5*sin(\AngleEntree)},0)$);
%%
\Pivot{(centrePivVR)}{blue, ultra thick}{ }{cos(\AngleEntree)}{sin(\AngleEntree)}{0}
}
You can see the loop where it happens, (centreCardan) is a point used to place a figure, and I define it in each loop to offset every new figure under the previous one.
You can see the iterator is \j, and I multiply if by 18 to get the Y coordinate for (centreCardan) . If I stop \j at 4, it compiles, but with 5 it doesn't.
Up to this point nothing too surprising, but it gets weird if you use 10 instead of 18 as a multiplicator, then you can go up to 21 with \j ( 21 * 10 =210 > 5*18 = 90 ) so I don't quite understand what's happening.
If I remove the \Pivot line \j can go up to 38 with a 18 multiplicator
If you are able to dive in a 130 lines code, here is my MWE :
\documentclass[tikz,border=5pt]{standalone}
\usepackage{tikz,esvect,tikz-3dplot}
% Créer des canvas personnalisés pour toutes les orientations
\makeatletter
\tikzoption{canvas is plane}[]{\@setOxy#1}
\def\@setOxy O(#1,#2,#3)x(#4,#5,#6)y(#7,#8,#9)%
{\def\tikz@plane@origin{\pgfpointxyz{#1}{#2}{#3}}%
\def\tikz@plane@x{\pgfpointxyz{#4}{#5}{#6}}%
\def\tikz@plane@y{\pgfpointxyz{#7}{#8}{#9}}%
\tikz@canvas@is@plane
}
\makeatother
%%%%% Environnement scope dans un canvas personnalisé avec normalisation du vecteur directeur
\newenvironment{NouveauPlan}[3]
{
\pgfmathsetmacro{\DoublCondi}{0}
\ifdim\VaxecY pt=0 pt
\pgfmathsetmacro{\DoublCondi}{\DoublCondi+1}
\fi
\ifdim\VaxecZ pt=0 pt
\pgfmathsetmacro{\DoublCondi}{\DoublCondi+1}
\fi
\ifdim\DoublCondi pt=2 pt
\pgfmathsetmacro{\XcordY}{1}
\pgfmathsetmacro{\XcordZ}{0}
\pgfmathsetmacro{\YcordX}{0}
\pgfmathsetmacro{\YcordY}{0}
\pgfmathsetmacro{\YcordZ}{1}
\else
\pgfmathsetmacro{\NormX}{sqrt((#3)*(#3)+(#2)*(#2))}
\pgfmathsetmacro{\NormY}{sqrt( ((#2)*(#2)+(#3)*(#3))*((#2)*(#2)+(#3)*(#3)) + (#1)*(#2)*(#1)*(#2) + (#1)*(#3)*(#1)*(#3) )}
\pgfmathsetmacro{\XcordY}{#3/\NormX}
\pgfmathsetmacro{\XcordZ}{(-1)*(#2)/\NormX}
\pgfmathsetmacro{\YcordX}{(-1)*((#2)*(#2)+(#3)*(#3))/\NormY}
\pgfmathsetmacro{\YcordY}{(#1)*(#2)/\NormY}
\pgfmathsetmacro{\YcordZ}{(#1)*(#3)/\NormY}
\fi
%%%%%%%
\begin{scope}[canvas is plane={O(0,0,0)x(0,\XcordY,\XcordZ)y(\YcordX,\YcordY,\YcordZ)}]
}{\end{scope}}
%% Fonctions de Calcul %%
\newcommand*{\NormerVect}[3]{
\pgfmathsetmacro{\NormV}{sqrt((#1)*(#1)+(#2)*(#2)+(#3)*(#3))}
\pgfmathsetmacro{\VncX}{#1/\NormV}
\pgfmathsetmacro{\VncY}{#2/\NormV}
\pgfmathsetmacro{\VncZ}{#3/\NormV}
}
\newcommand*{\MultipliVect}[4]{
\pgfmathsetmacro{\VmcX}{#1*(#4)}
\pgfmathsetmacro{\VmcY}{#2*(#4)}
\pgfmathsetmacro{\VmcZ}{#3*(#4)}
}
\newcommand*{\CalculAxe}[3]{
\pgfmathsetmacro{\NormV}{sqrt((#1)*(#1)+(#2)*(#2)+(#3)*(#3))}
\pgfmathsetmacro{\VaxecX}{#1/\NormV}
\pgfmathsetmacro{\VaxecY}{#2/\NormV}
\pgfmathsetmacro{\VaxecZ}{#3/\NormV}
% Vecteur unitaire de l'axe
\coordinate (AxeUni) at (\VaxecX,\VaxecY,\VaxecZ);
\MultipliVect{\VaxecX}{\VaxecY}{\VaxecZ}{\l/2}
\coordinate (AxeMoitie) at(\VmcX,\VmcY,\VmcZ);
}
%% Liaisons Pivot %%
\newcommand*{\Pivot}[6]{
\CalculAxe{#4}{#5}{#6}
\coordinate (centre) at #1;
\coordinate (centrezp) at ($(centre)+(AxeMoitie)$) ;
\coordinate (centrezm) at ($(centre)-(AxeMoitie)$) ;
\begin{NouveauPlan}{#4}{#5}{#6}
\draw let \p1=($(centrezp)-(centrezm)$),\n1={atan2(\y1,\x1)} in ($(centrezp)+(\n1-90:\r)$)
arc[radius=\r,start angle=\n1+270,delta angle=-540];
\end{NouveauPlan}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}
[x={(0.710cm,-0.410cm)},y={(0cm,0.820cm)},z={(-0.710cm,-0.410cm)}]
% Vecteur Point de Vue
\pgfmathsetmacro{\VpvX}{1}
\pgfmathsetmacro{\VpvY}{1}
\pgfmathsetmacro{\VpvZ}{1}
% Dimensions
\pgfmathsetmacro{\r}{1} % Rayon du cylindre
\pgfmathsetmacro{\l}{4} % Longueur cylindre
\foreach \j in {0,1,...,38}{
\pgfmathsetmacro{\AngleEntree}{-10*\j}
\coordinate (centreCardan) at (-20,{-18*\j},5);
% Circle
\begin{scope}[tdplot_screen_coords]
\draw[red,ultra thick,dashed] (centreCardan) circle (\r);
\end{scope}
%Tube
\coordinate (centrePivVR) at ($(centreCardan)+ ({-5*cos(\AngleEntree)},{-5*sin(\AngleEntree)},0)$);
%%
\Pivot{(centrePivVR)}{blue, ultra thick}{ }{cos(\AngleEntree)}{sin(\AngleEntree)}{0}
}
\end{tikzpicture}
\end{document}
Thank you to the braves who will give me some time.


tikzuses invisible coordinates to construct paths which enlarge the actual bounding box, e.g. B-spline control points, so it is possible this is what is happenning here though it is difficult to be sure. – BambOo May 22 '20 at 16:07\jup to 38 ? Because on my system it compiles fine – BambOo May 22 '20 at 16:13centrePivVRis at y-position-15689ptwhich is pretty close to the internal computational limit of TeX and therefore TikZ. So I guess any computation based on this coordinate (especially involving square roots and others will overflow this limit). Have a look at this post https://tex.stackexchange.com/q/54702/141947 for possible alternatives – BambOo May 24 '20 at 08:54