Welcome! Log In Create A New Profile


stl to g-code source code

Posted by elwolv 
stl to g-code source code
March 02, 2008 11:00PM

I recently found your forum, (after long search) interesting developer discussions.

I am interested in a code snippet showing me how to convert stl code listing to g-code.

1- how do we use the solid name to define the operation and convert it to g-code?

2- any listing showing various stl code names and the equivelant translation to g-code?

thank you
Re: stl to g-code source code
March 02, 2008 11:30PM
STL is a 3D file format based on a series of triangles in 3D space making up a 3D object. G-code is a machine control language consisting of commands like 'more x axis to 1000 or 'extrude at rate 50`. There is no way to simply convert from one to the other as they are very defferent things. To produce g-code from an STL, the code must know know to build objects from plastic using a reprap machine. This is what the slice and dice part of the Java host software does.

Adrian has documented part of the process here
Re: stl to g-code source code
March 03, 2008 02:01AM
Another way to convert stl to GCode is using the Art of Illusions script Export Slices, at:

by downloading and saving it in your Tools folder in Scripts in your Art of Illusions folder;

Then save the test file Reprap Hollow Square, at:

Then open Art of Illusion, then in Art of Illusion open the file Reprap Hollow Square.aoi. On my Linux computer I have to do it in this order, because for some reason double clicking on the Reprap Hollow Square file open Art of Illusion to a new page.

Once you have loaded the test file, choose Export Slices from the Scripts submenu in the Tools menu. On opening Export Slices you have the choice of printing or saving the Triangle Mesh and GCode output.

Export Slices is not finished; but, it can output GCode for an object with well formed stl.
Re: stl to g-code source code
March 03, 2008 04:13PM
Is is possible to better the formation of an stl object? I mean, like can the computer re-render the object to greater accuracy?

Anonymous User
Re: stl to g-code source code
March 03, 2008 05:46PM
Depends on what you want. You can use tools to smooth the shape using bezier curves, but that won't help you if you are trying to make a higher resolution screw hole. You need the original shape file for that.

Re: stl to g-code source code
March 03, 2008 09:13PM
thank you all for the information.

my current interest is to try to write (program) a small utility to convert the stl file to its g-code equivalent. it is programming efforts i would like to do.
hence, the request for help

obviously, i do not know the basic idea of how this done.
stl file as described is a set of vertex coordinates, with face names.

what is the idea of taken the file to convert to machine operation.
any description of such concept available?
is there other information outsdide the stl file format that is available from the cad program inserted with the stl file to make such operation of translation to g-code operation possible?

thank you all for help
Re: stl to g-code source code
March 03, 2008 09:34PM
I did look at stl description by adrian.
I see the file translated by org.3d utility.
thank you

however, I am still interested in knowing how do we know the intention of the stl file as for a mechanical design. what is the idea behind to convert those vertexs to an object?
what is the rules to follow to construct constrained solid object from the vertex list in stl?

thank you again
Re: stl to g-code source code
March 04, 2008 01:19AM
Hi elwolv,

STL is a highly common object-format in rapid-prototyping, so you can output the same parts on comercial fabbers too or import in a CAM-software and output with a 3D-mill.

With any other 3D-format you have to source the CAD/CAM-software too what's sometimes more complicated then with STL - here you have more cross-platform-tools and such ...

Sorry, only registered users may post in this forum.

Click here to login