I want to export hundreds of prisms to stl. And for this stl file to be 3D printable, its inner space must be filled.
I've tried two approaches to solve this problem. (just two prisms for a brief explanation)
- The first one is using "Prisms" (https://reference.wolfram.com/language/ref/Prism.html)
As I ultimately want to make several prisms, I can make them with Graphics3D but cannot export them to stl at once.
twoprisms = Graphics3D[{Prism[{{1, 0, 1}, {0, 0, 0}, {2, 0, 0}, {1, 2, 1}, {0, 2, 0}, {2, 2, 0}}], Prism[{{1, 2, 1}, {0, 2, 0}, {2, 2, 0}, {1, 4, 1}, {0, 4, 0}, {2, 4, 0}}]}]
Export["twoprisms.stl", twoprisms]
- The next approach is thickening polygons to prisms (Thick polygons in Graphics3D)
(This code is from @jVincent, not me)
normal[a_, b_, c_] := Normalize@Cross[a - b, c - b]
normal[a___] := Mean[normal @@@ Partition[{a}, 3, 1, 1]]
sides[bottom_, top_] := Polygon[Reverse@Join[#1, Reverse@#2]] & @@@ ({bottom, top} // Transpose // Partition[#, 2, 1, 1] &)
thicken[val_, t_: 0.1] := val /. Polygon[bottom_, ___] :> With[{top = (# + t normal @@ bottom) & /@ bottom}, {Polygon[Reverse@bottom], sides[bottom, top], Polygon[top]}]
initial = Graphics3D[{Polygon[{{1, 1, 0}, {1, 2, 0}, {2, 1, 0}}], Polygon[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}]}];
inital2 = thicken[initial, 0.3]
Export["inital.stl", initial]
This one can be exported to stl file. But it's hollow. (not 3D printable)
How can I make several filled prisms to stl file?