1
$\begingroup$

I know for surfaces Mathematica 11 has thickening options for 3D printing. See here for example.

If I have an explicit parametrization of a spatial curve, like the twisted cubic, I can create a tube like this and export to stl:

Export["twistedcubictube.stl" , ParametricPlot3D[{Sin[t] + x, Cos[t] + x^2, x^3}, {x, -2, 2}, {t, 0, 2*Pi}]]

However, I do not see how to create such a tube if my curve(s) are obtained implicitly through ContourPlot (in the plane).

Anyone have any ideas?

As a test case, I would like to create small tubes around these curves:

ContourPlot[{-2 + y^2 - z, 1 - 2 y^2 + y^2 z + z - z^2}, {y, -5, 5}, {z, -5, 5}]

and 3D Print them.

UPDATE: I just did this which seems to be working (3D printer is trying to print as I type...might still need to play with the thicknesses to get it to actually print):

Export["test.stl", ContourPlot3D[{-2 + y^2 - z, 1 - 2 y^2 + y^2 z + z - z^2}, {x,  0, .1}, {y, -5, 5}, {z, -5, 5}, Extrusion -> 0.05]]

But that solves the problem by turning the curves into a thin surface and then thickening up that thin surface. That should work in general, but I would still like to know how to create a tubular neighborhood around an implicitly defined curve in Mathematica (in the plane or in space).

$\endgroup$
  • 1
    $\begingroup$ Cases[Normal@ ContourPlot[{-2 + y^2 - z, 1 - 2 y^2 + y^2 z + z - z^2}, {y, -5, 5}, {z, -5, 5}], Line[x_] :> Tube[x /. {a_?NumericQ, b_?NumericQ} :> {a, b, 0}, .2], Infinity] // Graphics3D[#, Boxed -> False] &? $\endgroup$ – kglr Mar 16 '18 at 23:47
  • $\begingroup$ That looks good! I am trying it now. $\endgroup$ – Sean Lawton Mar 17 '18 at 0:10
  • 1
    $\begingroup$ You could combine the methods of this answer with the methods of this answer to get your 3D-printable tubes. $\endgroup$ – J. M. will be back soon Mar 17 '18 at 0:13
2
$\begingroup$
Cases[Normal @ ContourPlot[{-2 + y^2 - z, 1 - 2 y^2 + y^2 z + z - z^2},
   {y, -5, 5}, {z, -5, 5}], Line[x_] :> 
  Tube[x /. {a_?NumericQ, b_?NumericQ} :> {a,0,b}, .05], Infinity] // 
 Graphics3D[#, Boxed -> False] & 

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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