4
$\begingroup$

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 = 
    Graphics3D[
       Tube[                                
          BSplineCurve[
             {{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

$\endgroup$
  • $\begingroup$ I'm not sure Mathematica supports OBJ. Can you export it in other formats, such as STL? $\endgroup$ – David G. Stork Apr 2 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 at 9:20
  • $\begingroup$ Why do you want to export into .obj? Will .eps or other format suffice? $\endgroup$ – David G. Stork Apr 2 at 10:03
  • 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 at 10:10
  • 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 at 13:38
0
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Well, but this result is different from that of OP, isn't it? $\endgroup$ – xzczd Apr 3 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 at 10:53
  • 1
    $\begingroup$ Can you add a result that's similar enough to that of OP? $\endgroup$ – xzczd Apr 4 at 11:12

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.