ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 20 Feb 2017 21:54:56 +0100Save a 3D in Sage as a '.stl' filehttps://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/ Hi Everyone,
I am trying to save a simple polyhedron, an icosahedron(center=(0,4,0)) as an STL file. I tried using
g= icosahedron(center=(0,4,0))
g.show()
g.save('icosahedron.stl')
but I get the following error message:
Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 904, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "sage/plot/plot3d/base.pyx", line 1530, in sage.plot.plot3d.base.Graphics3d.save (/projects/sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:17931)
outfile.write(self.stl_ascii_string())
File "sage/plot/plot3d/base.pyx", line 1591, in sage.plot.plot3d.base.Graphics3d.stl_ascii_string (/projects /sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:18510)
faces = self.face_list()
AttributeError: 'TransformGroup' object has no attribute 'face_list'
I also taugh of converting the '.wrl' extension to '.stl' but I am still having some problems with that.
Can someone please help me to solve this problem? I will also appreciate if another approach to saving the file could be proposed.
Thank you for your helpTue, 05 Apr 2016 17:55:28 +0200https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/Comment by FrédéricC for <p>Hi Everyone,</p>
<p>I am trying to save a simple polyhedron, an icosahedron(center=(0,4,0)) as an STL file. I tried using</p>
<pre><code>g= icosahedron(center=(0,4,0))
g.show()
g.save('icosahedron.stl')
</code></pre>
<p>but I get the following error message:</p>
<pre><code> Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 904, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "sage/plot/plot3d/base.pyx", line 1530, in sage.plot.plot3d.base.Graphics3d.save (/projects/sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:17931)
outfile.write(self.stl_ascii_string())
File "sage/plot/plot3d/base.pyx", line 1591, in sage.plot.plot3d.base.Graphics3d.stl_ascii_string (/projects /sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:18510)
faces = self.face_list()
AttributeError: 'TransformGroup' object has no attribute 'face_list'
</code></pre>
<p>I also taugh of converting the '.wrl' extension to '.stl' but I am still having some problems with that.
Can someone please help me to solve this problem? I will also appreciate if another approach to saving the file could be proposed. </p>
<p>Thank you for your help</p>
https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=36273#post-id-36273See [Trac #22144](https://trac.sagemath.org/ticket/22144) for an enhancement of the STL situation.Thu, 12 Jan 2017 22:01:40 +0100https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=36273#post-id-36273Comment by kcrisman for <p>Hi Everyone,</p>
<p>I am trying to save a simple polyhedron, an icosahedron(center=(0,4,0)) as an STL file. I tried using</p>
<pre><code>g= icosahedron(center=(0,4,0))
g.show()
g.save('icosahedron.stl')
</code></pre>
<p>but I get the following error message:</p>
<pre><code> Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 904, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "sage/plot/plot3d/base.pyx", line 1530, in sage.plot.plot3d.base.Graphics3d.save (/projects/sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:17931)
outfile.write(self.stl_ascii_string())
File "sage/plot/plot3d/base.pyx", line 1591, in sage.plot.plot3d.base.Graphics3d.stl_ascii_string (/projects /sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:18510)
faces = self.face_list()
AttributeError: 'TransformGroup' object has no attribute 'face_list'
</code></pre>
<p>I also taugh of converting the '.wrl' extension to '.stl' but I am still having some problems with that.
Can someone please help me to solve this problem? I will also appreciate if another approach to saving the file could be proposed. </p>
<p>Thank you for your help</p>
https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=33019#post-id-33019See http://trac.sagemath.org/ticket/7744#comment:42 - this is only supported for certain kinds of objects. I'm not sure if there is a ticket open for extending this.Wed, 06 Apr 2016 17:03:43 +0200https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=33019#post-id-33019Answer by FrédéricC for <p>Hi Everyone,</p>
<p>I am trying to save a simple polyhedron, an icosahedron(center=(0,4,0)) as an STL file. I tried using</p>
<pre><code>g= icosahedron(center=(0,4,0))
g.show()
g.save('icosahedron.stl')
</code></pre>
<p>but I get the following error message:</p>
<pre><code> Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 904, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "sage/plot/plot3d/base.pyx", line 1530, in sage.plot.plot3d.base.Graphics3d.save (/projects/sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:17931)
outfile.write(self.stl_ascii_string())
File "sage/plot/plot3d/base.pyx", line 1591, in sage.plot.plot3d.base.Graphics3d.stl_ascii_string (/projects /sage/sage-6.10/src/build/cythonized/sage/plot/plot3d/base.c:18510)
faces = self.face_list()
AttributeError: 'TransformGroup' object has no attribute 'face_list'
</code></pre>
<p>I also taugh of converting the '.wrl' extension to '.stl' but I am still having some problems with that.
Can someone please help me to solve this problem? I will also appreciate if another approach to saving the file could be proposed. </p>
<p>Thank you for your help</p>
https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?answer=34734#post-id-34734Currently STL output is not implemented for groups of objects.
In your case, you can do (just unwrapping the group):
sage: g= icosahedron(center=(0,4,0))
sage: h=[u for u in g.all][0]
sage: h.save('icosahedron.stl')
Mon, 05 Sep 2016 21:50:36 +0200https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?answer=34734#post-id-34734Comment by lb for <p>Currently STL output is not implemented for groups of objects.</p>
<p>In your case, you can do (just unwrapping the group):</p>
<pre><code>sage: g= icosahedron(center=(0,4,0))
sage: h=[u for u in g.all][0]
sage: h.save('icosahedron.stl')
</code></pre>
https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=36679#post-id-36679Starting from last beta (SageMath 7.6.beta3) you can also do :
sage: g= icosahedron(center=(0,4,0))
sage: g.all[-1].save('icosahedron.stl')Mon, 20 Feb 2017 21:54:56 +0100https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=36679#post-id-36679Comment by kcrisman for <p>Currently STL output is not implemented for groups of objects.</p>
<p>In your case, you can do (just unwrapping the group):</p>
<pre><code>sage: g= icosahedron(center=(0,4,0))
sage: h=[u for u in g.all][0]
sage: h.save('icosahedron.stl')
</code></pre>
https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=34748#post-id-34748Hey, we should add this to the documentation, because people do ask this fairly often.Tue, 06 Sep 2016 14:59:42 +0200https://ask.sagemath.org/question/33008/save-a-3d-in-sage-as-a-stl-file/?comment=34748#post-id-34748