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.

  • 2
    $\begingroup$ 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. $\endgroup$
    – MarcoB
    Jun 18, 2015 at 3:05
  • 1
    $\begingroup$ For cylinders, I addressed STL export in this answer. In fact, it's many cylinders combined into something like a sphere... $\endgroup$
    – Jens
    Jun 18, 2015 at 4:24

1 Answer 1


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.

  • $\begingroup$ Can that be extended to shells with a given thickness? $\endgroup$
    – Yves Klett
    Jun 18, 2015 at 5:24
  • $\begingroup$ @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. $\endgroup$
    – Jens
    Jun 18, 2015 at 5:30
  • 1
    $\begingroup$ @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... $\endgroup$
    – Jens
    Jun 18, 2015 at 5:45
  • $\begingroup$ Super, that should be most useful! $\endgroup$
    – Yves Klett
    Jun 18, 2015 at 6:06
  • $\begingroup$ @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. $\endgroup$
    – Jens
    Jun 18, 2015 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.