1
|
7417 Views
|
3 Replies
|
1 Total Likes
View groups...
Share

# 3D GeometricTransformation to primitives and export to STL?

Posted 11 years ago
 If you draw a simple cuboid and translate/scale/rotate it:p3 = Graphics3D[{   Translate[    Scale[     Rotate[Cuboid[], Pi/3, {1, 0, 0}],     0.7],    {.2, .7, .3}]},  PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}}]it can't be exported to any 3D format. For example:Export["p3.stl", p3]Export::nodta: Graphics3D contains no data that can be exported to the STL format. >>So is there a way of finding the 3D vertices that Mathematica has used to draw the 3D graphic? FullForm shows only the transformation functions: Graphics3D[List[Translate[Scale[Rotate[Cuboid[List[0,0,0]],Times[Rational[1,3],Pi],List[1,0,0]],0.7],List[0.2,0.7,0.3]]],Rule[PlotRange,List[List[-2,2],List[-2,2],List[-2,2]]]]
3 Replies
Sort By:
Posted 11 years ago
 I also don't know how it works, that was just a wild guess, but it won't really enable us to solve the problem.The only useful thing I discovered is that using the third option in Scale allows Export to work.
Posted 11 years ago
 Is this like saying the Front End is doing the actual 3D projections of the objects then, so Export wouldn't always be able to extract the coordinates used? I don't understand Mathematica at all, but it sounds plausible...
Posted 11 years ago
 To make a long story (and a lot of experimentation) short, if you provide the third argument of Scale (the point to keep fixed), then it works.Some observations:Scale[] will by default scale an object keeping its centre fixed.  If you have to manually specify its centre, that can be a pain.It appears that exporting to STL works in the same cases when Normal is able to expand geometric tranformations on a Polygon (it won't do this on a Cuboid[] because a Cuboid[] can't represent a rotated cube).  I might be wrong about this.This is my guess for why Scale[] causes problems both for Normal[] and for exporting (I might be completely wrong though!):  Scale[object, s] will scale object around its centre.  I think that there's no functionality in the kernel that is actually able to find the centre of the object.  Only the front end is able to compute the centre, during rendering.  Finding the centre is essential for expanding the geometric transformations and exporting the object ...This situation would be similar to how AbsoluteOptions can't reliably figure out the numerical value of many Graphics options (when set to Automatic), such as ImagePadding, because only the Front End knows them after taking into account things such as the particular font used for used for tick labels ...This is of course all stale speculation and won't make your life easier when you try to export for 3D printing ...