Increase 3D Graph thickness for 3D printing in Mathematica?
In version 10.0.0 the PlotStyle -> Thickness
method shown by cormullion does not appear to work. Instead we can use the undocumented Extrusion
option:
ContourPlot3D[x y z == 0.05, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, Extrusion -> 0.1]
You can take advantage of the VertexNormals
that Plot
computes to translate the surface a little to each side. I'm not sure just what is required for good STL output. I put a polygonal side all around the two surfaces. The VertexNormals
are wrong for the sides, so I commented them out for the image presented.
The thickness is controlled by the parameter thickness
.
With[{plot = Plot3D[{(2*x*y)/(x^2 + y^2)}, {x, -2, 2}, {y, -2, 2}, Mesh -> None]},
With[{n0 = VertexNormals /. Cases[plot, HoldPattern[VertexNormals -> _], Infinity],
thickness = 0.1},
With[{pts = First @
Cases[plot,
GraphicsComplex[p_, e__] :> Flatten[{p - thickness n0, p + thickness n0}, 1],
Infinity],
vn = First @ Cases[plot, HoldPattern[VertexNormals -> v_] :> Join[v, v], Infinity]},
Graphics3D[
GraphicsComplex[
pts,
{EdgeForm[],
Cases[plot, Polygon[p_] :> Polygon@Join[p, p + Length[pts]/2], Infinity],
Cases[plot,
Line[p_] :> Polygon[Join[#, Reverse@# + Length[pts]/2] & /@ Partition[p, 2, 1]],
Infinity]}
(*, VertexNormals -> vn *)
],
PlotRange -> All,
Options[plot]
]
]]]
Try this:
Plot3D[{(2*x*y)/(x^2 + y^2)}, {x, -2, 2}, {y, -2, 2},
PlotStyle -> Thickness[1]]
And remember to watch your units - if you print in millimetres, 1 is a bit small...
For Version 10
The above no longer works in Mathematica version 10. Instead of Plot3D
, use ParametricPlot3D
:
ParametricPlot3D[{x, y, (2 x y)/(x^2 + y^2)}, {x, -2, 2}, {y, -2, 2},
PlotStyle -> Thickness[1]]