Message Boards Message Boards

0
|
8873 Views
|
7 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Generate a STL file including a cylinder, a ball and a prism?

Posted 6 years ago

I want to generate a STL file including a cylinder, a ball and a prism using

c = Cylinder[{{0, 0, 0}, {0, 0, 1}}, 1];

    b = Ball[{0, 0, 1}, 1];
    p = Prism[{{1, 0, 1}, {0, 0, 0}, {2, 0, 0}, {1, 2, 1}, {0, 2, 0}, {2, 
         2, 0}}];
    t = Graphics3D[{c, b, p}];
    Export["f:\\3.stl", t]”.

But I only find the cylinder when using "Import["f:\3.stl"] Where are the other two going? Thanks:)

POSTED BY: Nan Yang
7 Replies
POSTED BY: Mariusz Iwaniuk
Posted 6 years ago
POSTED BY: Nan Yang
Posted 6 years ago
POSTED BY: Nan Yang

Probably,the error occurs because the figures 3D penetrate each other.Yes the same error on my MMA 11.3 version.

Workaround is using RegionUnion function:

c = Cylinder[{{0, 0, 0}, {0, 0, 1}}, 1]; b = Ball[{0, 0, 1}, 1];
t = RegionUnion[c, b];
Export["f:\3.stl", t]

Visualize it:

 RegionUnion[c, b]//Region

enter image description here

POSTED BY: Mariusz Iwaniuk
Posted 6 years ago
POSTED BY: Nan Yang
POSTED BY: Mariusz Iwaniuk

Execute code:

 b = Ball[{0, 0, 1}, 1];
 p = Prism[{{1, 0, 1}, {0, 0, 0}, {2, 0, 0}, {1, 2, 1}, {0, 2, 0}, {2, 2, 0}}];
 t = Graphics3D[{b, p}]
 Export["f:\\3.stl", t]

And what Yours conclusions ?

POSTED BY: Mariusz Iwaniuk
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