I am using the following code. It compiles fine without the middle foreach statement, but fails with Undefined Control Sequence with it:
\documentclass[border=4pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz-3dplot}
\usepgfplotslibrary{colormaps,external}
\usetikzlibrary{calc,3d,arrows,shapes.geometric}
\pgfplotsset{compat=1.9}
\tdplotsetmaincoords{60}{150}%
\begin{document}
\begin{tikzpicture}[tdplot_main_coords]
\begin{axis}[
axis equal,
axis lines = center,
width = 16cm,
height = 16cm,
xmin=-30,
xmax=30,
ymin=-30,
ymax=30,
zmin=-30,
zmax=30,
view/h=25,
]
\foreach \t in {20}% generatrices
\draw[yellow,thin,dashed] (axis cs: {0.75+0.75*cos(\t)},0,
{0.75*sin(\t)})
--(axis cs: {0.75+0.75*cos(\t)},{-33.0},{0.75*sin(\t)});
\draw[yellow,thin,densely dotted] (axis cs: 1.5,-33,0)% lower circle
\foreach \t in {5,10,...,360}
{--(axis cs: {0.75+0.75*cos(\t)},-33,{0.75*sin(\t)})}--cycle;
\draw[yellow,thin,densely dotted] (axis cs: 1.5,0,0)% upper circle
\foreach \t in {5,10,...,360}
{--(axis cs: {0.75+0.75*cos(\t)},0,{0.75*sin(\t)})}--cycle;
\end{axis}
\end{tikzpicture}
\end{document}
I added the {} around the nested draw statement. It doesn't seem obvious to me what the problem is.
EDIT: MWE provided (bad practice for not doing so!) with \t limited to one value but still failing to compile.

;inside the brace, as the\drawis also inside. – Symbol 1 May 10 '17 at 16:56\foreach! I personally do not use a single semicolon to terminate both\foreachand\draw. Remember the goto fail bug made by Apple? – Symbol 1 May 10 '17 at 17:09\foreachand hard-coding a single angle compiles well. Do I need a\drawoutside the\foreach? – stars83clouds May 10 '17 at 17:12\documentcalss{xxx}and\end{document}. – Symbol 1 May 10 '17 at 17:14Package tikz Error: Unknown coordinate system 'axis'.– egreg May 10 '17 at 17:17axis cs:is pgfplots. And https://tex.stackexchange.com/questions/170664/foreach-not-behaving-in-axis-environment ... – Rmano May 10 '17 at 17:24\drawand\foreachdoes the trick. – Symbol 1 May 10 '17 at 17:43\draw, letting\drawbe outside is usually faster. – Symbol 1 May 10 '17 at 17:48\draw-statement outside then since only a single\draw-execution would be carried out. – stars83clouds May 10 '17 at 17:50\drawcan draw multiple subpaths. For example\draw(0,0)--(1,1)(2,2)--(3,3);. – Symbol 1 May 10 '17 at 17:53\foreachcould be utilized here? – stars83clouds May 10 '17 at 17:56\draw[yellow,thin,dashed]foreach\t in{20,40,...,360}{(axis cs: {0.75+0.75*cos(\t)},0,{0.75*sin(\t)})--(axis cs: {0.75+0.75*cos(\t)},{-33.0},{0.75*sin(\t)})};. – Symbol 1 May 10 '17 at 17:56\foreach. – stars83clouds May 10 '17 at 18:01