# Problem with .stl and Graph

Hi everyone!

I have a problem with SageMath, and I need your help :).

I want to save my personal Graph from a list to a .stl file (.stl for 3d object representation, "stereolithography").

My code:

p = [[0,0,0],[1,2,3],[2,3,1],[2,1,0],[1,3,2],[3,2,1]]
points = PointConfiguration(p)
triang = points.triangulate()
triang.save('mygraph.stl')
triang.plot(axes=False)


When I try to save my file it's in the .sobj extension. (I research this extension and it's just an extension SageObject, so it's not useful for me). I want to draw a graph with a list of point and to convert them in a .stl file.

• save the plot:

triang.plot().save('mygraph.stl') # Fails as there is no attribute face_list

• save the all[-1]:

triang.all[-1].save('test.stl') # Fails as PointConfiguration don't have argument all.


I don't know what is the problem, so I ask for your help.

Thank you very much.

edit retag close merge delete

Thank you for the edits you made to the question, it is now easier to read.

( 2018-03-22 17:24:42 -0500 )edit

Sort by ยป oldest newest most voted

To reformulate:

• you have a number of points in 3D space, given by their three coordinates,
• you want to save the polyhedron with these points as vertices in STL format.

One way to do that is:

sage: p = [[0,0,0],[1,2,3],[2,3,1],[2,1,0],[1,3,2],[3,2,1]]
sage: P = Polyhedron(p)
sage: G = P.plot(aspect_ratio=1)
sage: G.all[-1].save('polyhedron.stl')


You need a recent enough version of Sage.

Basic export to STL was introduced around July 2015, and improved by allowing export to binary STL (faster for shapes with many faces) around February 2017. See the corresponding tickets:

more

Thank you very much, Sir !

That works !

( 2018-03-23 17:12:56 -0500 )edit

Happy 3D-printing, if that's the next step.

( 2018-03-24 12:19:04 -0500 )edit