Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use surface_to_stl

https://trac.sagemath.org/ticket/7744 describes a function surface_to_stl to export 3D surfaces. It has the following example:

    sage: x,y,z = var('x,y,z')
    sage: a = implicit_plot3d(x^2+y^2+z^2-9, [x,-5,5], [y,-5,5],[z,-5,5])
    sage: a
    sage: f=file.open("foo.stl",'w')
    sage: f.write(surface_to_stl(a))
    sage: f.close()

When I run it, I get Name 'file' is not defined. When I remove 'file', I can print, but get "name 'surface_to_stl' is not defined.

So, what is the correct way to use surface_to_stl and what are the limitations of this function or of the method .save('foo.stl')?