I want to export a 3d tube model but I get two errors. I found that I won't get any error if I use a different model. So, how can I solve this problem in a simple way? Thanks.

model = 
             {{0, 0, 0}, {1, 0, 0}, {1, 1, 1}}
          {5, 0}

Export["MyTube.obj", model]

Export::type: Graphics3D cannot be exported to the OBJ format.

Export::type: RuleDelayed cannot be exported to the OBJ format.

enter image description hereenter image description here

  • $\begingroup$ I'm not sure Mathematica supports OBJ. Can you export it in other formats, such as STL? $\endgroup$ Apr 2, 2019 at 9:15
  • $\begingroup$ No,I can't export it in STL. But I get only one error this time, without the second error above. $\endgroup$
    – qg X
    Apr 2, 2019 at 9:20
  • 1
    $\begingroup$ I need it to do 3D printing. But I don't know why it can't be exported in 3D format, that's so weird. Is there any problem with my code? $\endgroup$
    – qg X
    Apr 2, 2019 at 10:10
  • 1
    $\begingroup$ Something that may be related: DiscretizeGraphics@Tube[{{0, 0, 0}, {5, 5, 5}}, {1, 2}] gives EmptyRegion[3], which is apparently incorrect. Seems that the function for discretization can't handle Tube with a List as 2nd argument properly. Looks like a bug to me. You'd better report this to WRI. $\endgroup$
    – xzczd
    Apr 2, 2019 at 12:30
  • 2
    $\begingroup$ You can report in Chinese, they have Chinese employees. Sadly I can't think out a workaround at the moment. ParametricPlot3D may help, but it's not immediately clear to me how to reproduce the ends of the tube. $\endgroup$
    – xzczd
    Apr 2, 2019 at 13:38

1 Answer 1


After some attempts, I found that problem is in BSplineCurve. The 3D-graphycs with Tube can be exported to "*.obj" without any problems. Therefore, all what you need is just an explicit definition of the point array inside the Tube.

bf = BSplineFunction[{{0, 0, 0}, {1, 0, 0}, {1, 1, 1}}, SplineClosed->True];
bfl = bf /@ Table[i, {i, 0, 1, 0.1}];
model = Graphics3D[Tube[bfl, {5, 0}]]

enter image description here

Now export to OBJ works well.

Export["MyTube.obj", model]

The step inside the Table after bf defines the detalization level for an image. Or you can set any amount of an arbitrary numbers between 0 and 1 to define your own surface quality.

  • 2
    $\begingroup$ Well, but this result is different from that of OP, isn't it? $\endgroup$
    – xzczd
    Apr 3, 2019 at 11:00
  • $\begingroup$ @xzczd, The difference is in choice of the points of BSpline used for drawing. I don't know the point selection algorithm used by defaults in MMA , but changing the list of points in the second string of my answer one can change the result (including to have the same as in OP). $\endgroup$
    – Rom38
    Apr 4, 2019 at 10:53
  • 1
    $\begingroup$ Can you add a result that's similar enough to that of OP? $\endgroup$
    – xzczd
    Apr 4, 2019 at 11: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.