Message Boards Message Boards

0
|
4158 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Build table of cylinders that rotate about center of sphere?

Posted 3 years ago
c = Cylinder[{{0, 0, 0}, {0, 0, .95}}, 1/8];
        b = Ball[{0, 0, 1}, 1];
        Show [ 
         Graphics3D[
          {Opacity[0.5], c, b}
          ], Axes -> True
         ]

Hi I'm new to Mathematica so pardon the newb questions. I am unsure how to build a table of cylinders that rotate about the center of the sphere? The object of this will ultimately be saved as an stl file for 3D printing.

The cylinder in Mathematica seem to have a cap, is there an option to turn that cap off or are the ends rendered?

POSTED BY: Brian OBrien
4 Replies

I have no experience of stl export. Try Sphere instead of Ball.

POSTED BY: Gianluca Gorni
Posted 3 years ago

I took the output from Show and Passed it to export... output = show[....] Export("MyFile.stl", output] However only the cylinders appear.. the ball seems to have vanished.

I'm curious if i was supposed to have unified this into a single object somehow before exporting to stl?

POSTED BY: Brian OBrien

You can use Table and Rotate:

c = Cylinder[{{0, 0, 0}, {0, 0, .95}}, 1/8];
b = Ball[{0, 0, 1}, 1];
Show[Graphics3D[{Opacity[0.5], b, 
   Table[Rotate[c, angle, {1, 0, 0}, {0, 0, 1}], {angle, 0, 2 Pi, 
     Pi/3}]}], Axes -> True]

To remove the caps you can parameterize the cylinder:

c = With[{r = 1/8}, 
    ParametricPlot3D[{r*Cos[t], r*Sin[t], z}, {t, 0, 2 Pi}, {z, 
      0, .95}, PlotPoints -> {20, 2}, Mesh -> None]][[1]];
b = Ball[{0, 0, 1}, 1];
Show[Graphics3D[{Opacity[0.5], b, 
   Table[Rotate[c, angle, {1, 0, 0}, {0, 0, 1}], {angle, 0, 2 Pi, 
     Pi/3}]}], Axes -> True]
POSTED BY: Gianluca Gorni
Posted 3 years ago

Thank you so much... Very elegant.

POSTED BY: Brian OBrien
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract