# Can I Adjust Thickness of Spheres and Cylinders to Make Objects Printable in 3D?

I have a design of a crystal structure using Sphere and Cylinder in Mathematica. I then exported the result as an STL file and tried to print it. I was told that the objects were "too thin," that Mathematica didn't produce a solid sphere or cylinder, but just a shell. This made the connections holding the structure together to be too fragile. At least, this is what the technician running the printer said...

I have seen how to make Plot3D surface thicker using the Thickness[] directive to PlotStyle but this doesn't work (I think) for Sphere and Cylinder.

Has anyone tried to print molecules or crystal structures using Mathematica? If so, was this an issue? Thanks for your help.

• i would suggest a different route for your application, starting from a PRB or CIF crystallography file, which you should be able to export from Mathematica, as described by this recent article (Scalfani, Vaid, Journal of Chemical Education). The authors propose viable choices for such problems as sphere size, bond thickness, etc. Jun 18, 2015 at 3:05
• For cylinders, I addressed STL export in this answer. In fact, it's many cylinders combined into something like a sphere...
– Jens
Jun 18, 2015 at 4:24

In case the 3D printer does indeed require triangles that are arranged more like tetrahedra to give the surface a thickness, you can achieve that using RegionDifference, where the construction of a spherical shell is described as an example:

shell = RegionDifference[Ball[{0, 0, 0}, 2], Ball[{0, 0, 0}, 1]];

dg = DiscretizeRegion[shell];
pts = MeshCoordinates[dg];
polys = MeshCells[dg, 2];
g = Graphics3D[{EdgeForm[Thick], GraphicsComplex[pts, polys]}]


This automatic triangulation of the shell certainly doesn't look very clean. But it now should have something you could call thickness because it's a shell.

• Can that be extended to shells with a given thickness? Jun 18, 2015 at 5:24
• @YvesKlett I think you can probably work something out using RegionDifference. But I actually don't know enough about 3D printing to pursue this approach further, until someone explains to me whether this answer is going in the right direction or not... Perhaps I took the reference to Thickness[] in the question too seriously. But according to this question, it does seem to matter.
– Jens
Jun 18, 2015 at 5:30
• @YvesKlett Oh, I think I understand now. Thickness[] in the question was in fact misleading, but I do need to use RegionDifference to get volumes of the required type. I'll see if I can update the answer...
– Jens
Jun 18, 2015 at 5:45
• Super, that should be most useful! Jun 18, 2015 at 6:06
• @YvesKlett And I shouldn't have said Thickness[] is misleading, because there's actually this Q&A where PlotStyle -> Thickness[.1] was used to turn contour surfaces into volumes. In principle, that could also be done here, but my goal was to not abandon Sphere and Cylinder outright.
– Jens
Jun 18, 2015 at 6:12