# Graphics3D from Mathematica to stl

I made these two Regular skew apeirohedra using Graphics3D.

The flow of my code is like this :

(1) calculate all vertexcoordinates and faceindices

(in "mucube", but in "muoctahedron" I just used PolyhderonData and constructed parallel transport using for-loop)

(2) connect all coordinates and indices using Polyhedron

muoctahedron = {};
muoctahedronindex = 0;
For[x1 = 0, x1 < 3, x1++,
For[x2 = 0, x2 < 3, x2++,
For[x3 = 0, x3 < 3, x3++,
muoctahedronindex = muoctahedronindex + 1;
AppendTo[muoctahedron, 1]; basiccoordsmove1 = {};
For[i = 1, i < 25, i++,
ahah = basiccoords[[i]] + x1 {-2, 2, 0} + x2 {2, 2, 0} +
x3 {0, 0, 2 Sqrt[2]}; AppendTo[basiccoordsmove1, ahah]];
muoctahedron[[muoctahedronindex]] =
Polyhedron[basiccoordsmove1, basicindices]]]];
Graphics3D[muoctahedron]


(3) this code is working really well. It made the muoctahedron successfully (the pic is below there).

My question is how can I make these Graphics3D files to stl form??

I've already tried this, but didn't work on my one.

Edit * basiccoords and basicindices are below here *

Edit the code of mucube is like this

ycoordinate = {};
xcoordinate = {};
zcoordinate = {};
cubeminindex = {2, 4, 7, 9, 11, 14, 16, 19, 21, 23, 26, 28};
generalindex = {};
For[g = 1, g < 5, g++,
For[i = 0, i < 6, i++,
For[j = 0, j < 6, j++, AppendTo[ycoordinate, {j, g, i}]]]];
For[g = 1, g < 5, g++,
For[i = 0, i < 6, i++,
For[j = 0, j < 6, j++, AppendTo[zcoordinate, {j, i, g}]]]];
For[g = 1, g < 5, g++,
For[i = 0, i < 6, i++,
For[j = 0, j < 6, j++, AppendTo[xcoordinate, {g, j, i}]]]];
For[g = 0, g < 4, g++,
For[i = 1, i < 13, i++,
index1 = {cubeminindex[[i]], cubeminindex[[i]] + 1,
cubeminindex[[i]] + 7, cubeminindex[[i]] + 6} + 36*{g, g, g, g}; AppendTo[generalindex, index1]]];
tmpz = Polyhedron[zcoordinate, generalindex];
tmpx = Polyhedron[xcoordinate, generalindex];
tmpy = Polyhedron[ycoordinate, generalindex];
mucube = {tmpx, tmpy, tmpz};

• Maybe with DiscretizeGraphics to turn it into a MeshRegion and then simply with Export applied to the resulting MeshRegion. – Henrik Schumacher Apr 11 '20 at 6:08
• @HenrikSchumacher already tried it, but didn't work :( – dodo_nuna_2nd Apr 12 '20 at 11:40
• Unfortunately, I cannot hep you any further because you did not provide the definitions of basiccoords and basicindices. – Henrik Schumacher Apr 12 '20 at 11:43
• @HenrikSchumacher I just uploaded the definitions. Maybe thickness is the problem...? – dodo_nuna_2nd Apr 13 '20 at 3:29
• Export["test.stl",BoundaryDiscretizeGraphics/@muoctahedron//RegionUnion] – chyanog Apr 13 '20 at 3:56

A simple workaround, replace Polyhedron with Polygon in your code, then you can export it to STL format directly
Export["muoctahedron.stl", Graphics3D[muoctahedron]]