ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 27 Mar 2015 10:04:03 -0500Get objects from a Graphics3dGrouphttp://ask.sagemath.org/question/26360/get-objects-from-a-graphics3dgroup/Dear all,
I would like to trasnform a 3d object into a set of faces (or triangles). For that, I take a 3d object and convert it to a STL file following [this procedure](http://trac.sagemath.org/ticket/7744).
The short questions is: how to get the 3d objects from a Graphics3dGroup?
The long question : I don't understand the nature of the 3d graphics.
For instance:
G1 = polygon3d([(0,0,0),(1,0,0),(2,1,1)])
print(type(G1))
G2 = polygon3d([(0,0,0),(1,0,0),(2,1,1)]) + polygon3d([(1,2,3),(1,0,0),(2,1,1)])
print(type(G2))
G3 = sphere((0,0,0),1)
print(type(G3))
1. In the first case it seems to be a set of faces and it's possible to convert it to a STL file.
2. In the second case it is a group of 3d object and -as a group- it has no face.
3. The sphere is a `TransformGroup` and has no face.
How to get the faces of the last two situations?
Thanks for yours answers.
Arnaud
Fri, 27 Mar 2015 09:31:57 -0500http://ask.sagemath.org/question/26360/get-objects-from-a-graphics3dgroup/Answer by kcrisman for <p>Dear all,</p>
<p>I would like to trasnform a 3d object into a set of faces (or triangles). For that, I take a 3d object and convert it to a STL file following <a href="http://trac.sagemath.org/ticket/7744">this procedure</a>.</p>
<p>The short questions is: how to get the 3d objects from a Graphics3dGroup?</p>
<p>The long question : I don't understand the nature of the 3d graphics.
For instance:</p>
<pre><code>G1 = polygon3d([(0,0,0),(1,0,0),(2,1,1)])
print(type(G1))
G2 = polygon3d([(0,0,0),(1,0,0),(2,1,1)]) + polygon3d([(1,2,3),(1,0,0),(2,1,1)])
print(type(G2))
G3 = sphere((0,0,0),1)
print(type(G3))
</code></pre>
<ol>
<li>In the first case it seems to be a set of faces and it's possible to convert it to a STL file. </li>
<li>In the second case it is a group of 3d object and -as a group- it has no face. </li>
<li>The sphere is a <code>TransformGroup</code> and has no face.</li>
</ol>
<p>How to get the faces of the last two situations?</p>
<p>Thanks for yours answers.</p>
<p>Arnaud</p>
http://ask.sagemath.org/question/26360/get-objects-from-a-graphics3dgroup/?answer=26361#post-id-26361In the second event, `G2.all` should return a list of the underlying objects, and in the third case `G3.all` should return something relevant as well.
sage: S = sphere()
sage: S.all
[Graphics3d Object]
sage: S.all[0]
Fri, 27 Mar 2015 10:04:03 -0500http://ask.sagemath.org/question/26360/get-objects-from-a-graphics3dgroup/?answer=26361#post-id-26361