(*This Mathematica code was written by John Zweck (zweck@utdallas.edu) and generates a mathematical curve/surface that can be printed using a 3D printer. This model can (probably) be printed by Shapeways.*)

(*If you evaluate this Mathematica notebook,the curve/surface will be rendered using computer graphics.*)

(*If you uncomment the export line at the end of the code and set the directory path appropriately for your system you will obtain an STL file that can be sent to a 3D printer.*)

(*The STL file can also be viewed using the open source software Meshlab.*)

(*You may modify this code in any way you like.*)

(*This project was supported by the National Science Foundation through a Supplement to the UTeach Dallas Robert Noyce Scholarship Program (DUE 1544159).*)

xyscale=21;
zscale=21;
radius = 2;

helix[r_,theta_]={xyscale*r*Cos[theta],xyscale*r*Sin[theta],zscale*theta};


rmin=0;
rmax=1.5;
NumRays=12;

numPoints=200;

thetamin=0;
thetamax=2*Pi;

zAxis=ParametricPlot3D[helix[0,i],{i,thetamin,thetamax},PlotStyle->Tube[radius],PlotPoints->numPoints,PlotStyle->CapForm["Round"],PlotStyle->JoinForm["Round"],PlotRange->All];

OuterHandRail=ParametricPlot3D[helix[rmax,i],{i,thetamin,thetamax},PlotStyle->Tube[radius],PlotPoints->numPoints,PlotRange->All,PlotStyle->CapForm["Round"],PlotStyle->JoinForm["Round"]];

RaysTable=Table[helix[r,j],{j,thetamin,thetamax,(thetamax-thetamin)/NumRays}];

Rays=ParametricPlot3D[RaysTable,{r,rmin,rmax},PlotStyle->Tube[radius],PlotPoints->numPoints,PlotRange->All,PlotStyle->CapForm["Round"],PlotStyle->JoinForm["Round"]];

Vertices =Graphics3D[Table[Sphere[helix[i,j],radius],{i,rmin,rmax,rmax-rmin},{j,thetamin,thetamax,(thetamax-thetamin)/NumRays}]];

output=Show[zAxis, Rays,OuterHandRail,Vertices]

(*Export["SpiralStaircase.stl",output]*)