# (Updated) How do I fix a Discretization error?

I am attempting to model a cross section problem from Calculus II using the general slicing method. Below is the working code to generate the "slices" of the defined problem; however, I would like to export this to an STL file to 3D print it. I have created a working code for another problem that has squares as cross sections. I've attached the working code that will export the STL code as wanted.

n=10
a=-2
b=2
dx=(b-a)/n
f[x_]:=(4-x^2)^0.5
listOfCuboids=Table[Cuboid[{x+dx,0,0},{x,f[x],f[x]}],{x,Subdivide[a,b,n]} ]
solid=Graphics3D[listOfCuboids]
Printout3D[solid,"cuboids.stl"]


For the original problem that I'm trying to model, the code is as such.

n=10
a2=0
b2=4
dy=(b2-a2)/n
g[y_]:=y^(0.5)
listOfPrisms=Table[Prism[{{0,y,g[3*y]}, {-g[y],y,0}, {g[y],y,0}, {0,y+dy,g[3*y]}, {-g[y],y+dy,0}, {g[y],y+dy,0}}],{y,Subdivide[a2,b2,n]}]
solid2=Graphics3D[listOfPrisms]
Printout3D[solid2,"prisms.stl"]


However, this code does not export to an STL file and the report of the output says it could not discretize or export the file. Any help would be appreciated.

Thanks to the previous comments for helping me to improve the code.

Final Update Here is an image of the 3D print! Thanks again all who helped. • You never defined solids2. You only defined listOfPrisms. Even then, your list is not a well-defined Region; you may have some luck with RegionUnion. As an aside, please note that your AppendTo code is quite inefficient; try instead: listOfPrisms = Table[ Prism[{{0, y, g[3 y]}, {-g[y], y, 0}, {g[y], y, 0}, {0, y + dy, g[3 y]}, {-g[y], y + dy, 0}, {g[y], y + dy, 0}}], {y, Subdivide[0, 4, 10]} ], which will achieve the same, but faster. Feb 15, 2019 at 23:20
• Does Printout3D[ RegionUnion @@ BoundaryDiscretizeGraphics /@ First[solid2], "cuboids.stl"] work for you? If so I'll make this an answer. Feb 16, 2019 at 1:29
• That does not work. It says that "The cell Prism[{1, 2, 5, 4}] is degenerate. Feb 16, 2019 at 1:34
• It also says BoundaryDiscretizeGraphics: The graphics primative Prism[{etc.}] is not valid. Among a few other erros. Feb 16, 2019 at 1:34
• We must be running different versions. The first prism is degenerate. Does RegionUnion @@ BoundaryDiscretizeGraphics /@ Rest[First[solid2]] work? Feb 16, 2019 at 2:39

solid2 = RegionUnion @@ BoundaryDiscretizeGraphics /@ Rest[listOfPrisms] Printout3D[solid2, "prisms.stl"]["Status"]

"Successful"