Ask Your Question
1

How to use surface_to_stl

asked 2020-09-08 14:24:49 +0100

Ingo gravatar image

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')?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-09-08 15:44:56 +0100

FrédéricC gravatar image

This is much simpler now, just do :

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.save("foo.stl")
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-09-08 14:24:49 +0100

Seen: 298 times

Last updated: Sep 08 '20