[Tex/LaTex] tikz foreach calculations

foreachtikz-pgf

I am trying to do a simple calculation with the tikz foreach, but it does something very suprising:

\documentclass{article} 
\usepackage{tikz} 
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{2pt}
\begin{document} 
\begin{preview}
\def\radius{10}
\def\step{6}

\begin{tikzpicture}
\def\stepsize{\number\numexpr180/\step\relax}

\foreach \Angle in {0.5\stepsize,1.5\stepsize,...,180} {\node [right] at (\Angle:10) {\Angle};}

\end{tikzpicture}
\end{preview}
\end{document}

From this I would expect on ouput going from 15,45,…,180, but the output is the following.
enter image description here

This is a very,very small stepsize. If I write 0.5*\stepsize it tells me it is an illegal unit. Of course I could solve it by defining a half and a 1.5 step-size. Any ideas why this is happening?

Best Answer

The problem comes from the concatenation of .5 and \stepsize, that make .530 then 1.530.

enter image description here

\documentclass{article} 
\usepackage{tikz} 
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{2pt}
\begin{document} 
\begin{preview}
\def\radius{10}
\def\step{6}


\def\stepsize{\number\numexpr180/\step\relax}

\pgfmathtruncatemacro{\first}{0.5*\stepsize}
\pgfmathtruncatemacro{\step}{1.5*\stepsize}

\stepsize

\begin{tikzpicture}

\foreach \Angle in {\first,\step,...,180} {\node [right] at (\Angle:10) {\Angle};}

\end{tikzpicture}
\end{preview}
\end{document}

With evaluate

enter image description here

\documentclass{article} 
\usepackage{tikz} 
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{2pt}
\begin{document} 
\begin{preview}
\def\radius{10}
\def\step{30}

\def\First{15}
\pgfmathtruncatemacro{\NbStep}{(180-\First)/\step}


\begin{tikzpicture}

\foreach \i [evaluate=\i as \Angle using int(\First+\step*\i)]
    in {0,1,...,\NbStep} {%
    \node [right] at (\Angle:\radius) {\Angle} ;
}

\end{tikzpicture}
\end{preview}
\end{document}