Message Boards Message Boards

stl export problem

I am able to export an STL file of a combination of cuboids (Menger sponge).

But when I do

yyy = Graphics3D[Tetrahedron[{{0, 0, 0}, {1/2, Sqrt[3]/2, 0},
    {1, 0, 0}, {1/2, Sqrt[3]/4, 3/4}}], Axes -> True]
Export["yyy.stl", yyy]

I get

Export::nodta: Graphics3D contains no data that can be exported to the STL format. >>

Is there a way of exporting terahedrons to STL

POSTED BY: Erich Neuwirth

Different graphics formats store things in different ways. This isn't usually a major problem with 2D graphics, but it's more serious with 3D graphics.

For STL, the documentation notes:

[STL] Stores a solid 3D object as a surface formed by a collection of adjacent triangles.

So for some reason Tetrahedron doesn't convert over to a list of triangles. It's not a very commonly used graphics primitive. There's a lot of ways we could go construct this shape, but this is what I would do:

pts = {{0, 0, 0}, {1/2, Sqrt[3]/2, 0}, {1, 0, 0}, {1/2, Sqrt[3]/4, 3/4}} 

Polygon /@ Subsets[pts, {3}]

Graphics3D[Polygon /@ Subsets[pts, {3}]]

This does export to Stl since Polygons are relatively straightforward to export to STL

POSTED BY: Sean Clarke
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