slice ($Date: 2008/02/05 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap_v0.1/slice.py |
Slice is a script to slice a GNU Triangulated Surface file.
Slice slices a GNU Triangulated Surface file into gcode extrusion layers. The 'Extrusion Diameter' is the diameter of the extrusion at the
default extruder speed, this is the most important slice preference. The 'Extrusion Density' is the density of the extruded shape over the
density of the filament. The 'Extrusion Width Over Thickness' ratio is the ratio of the extrusion width over the layer thickness. A ratio of
one means the extrusion is a circle, a typical ratio of 1.5 means the extrusion is a wide oval.
Rarely changed preferences are Import Coarseness, Mesh Type, Infill Bridge Width Over Thickness & Infill in Direction
of Bridges. When the triangle mesh has holes in it, slice switches over to a slow algorithm that spans gaps in the mesh. The higher the
import coarseness, the wider the gaps in the mesh it will span. An import coarseness of one means it will span gaps the width of the
extrusion. When the Mesh Type preference is correct, the mesh will be accurately sliced, and if a hole is found, slice will switch over to
the algorithm that spans gaps. If the Mesh Type preference is Unproven, slice will use the gap spanning algorithm from the start. The
problem with the gap spanning algothm is that it will span gaps, even if there actually is a gap in the model. Infill bridge width
over thickness ratio is the ratio of the extrusion width over the layer thickness on a bridge layer. If the infill in direction of bridges
preference is chosen, the infill will be in the direction of bridges across gaps, so that the fill will be able to span a bridge easier. To run
slice, in a shell type:
> python slice.py
To run slice, install python 2.x on your machine, which is avaliable from http://www.python.org/download/
To use the preferences dialog you'll also need Tkinter, which probably came with the python installation. If it did not, look for it at:
www.tcl.tk/software/tcltk/
To export a GNU Triangulated Surface file from Art of Illusion, you can use the Export GNU Triangulated Surface script at:
http://members.axion.net/~enrique/Export%20GNU%20Triangulated%20Surface.bsh
To bring it into Art of Illusion, drop it into the folder ArtOfIllusion/Scripts/Tools/.
The GNU Triangulated Surface format is supported by Mesh Viewer, and it is described at:
http://gts.sourceforge.net/reference/gts-surfaces.html#GTS-SURFACE-WRITE
To turn an STL file into sliced gcode, first import the file using the STL import plugin in the import submenu of the file menu of Art of Illusion.
Then from the Scripts submenu in the Tools menu, choose 'Export GNU Triangulated Surface' and select the imported STL shape. Click the
'Export Selected' checkbox and click OK. Then type 'python slice.py' in a shell in the folder which slice is in and when the dialog pops up, set
the parameters. Then click 'Slice', choose the file which you exported in 'Export GNU Triangulated Surface' and the sliced file will be saved
with the suffix '_slice'.
To write documentation for this program, open a shell in the slice.py directory, then type 'pydoc -w slice', then open 'slice.html' in a browser
or click on the '?' button in the dialog. To use other functions of slice, type 'python' in a shell to run the python interpreter, then type 'import slice'
to import this program.
The computation intensive python modules will use psyco if it is available and run about twice as fast. Psyco is described at:
http://psyco.sourceforge.net/index.html
The psyco download page is:
http://psyco.sourceforge.net/download.html
The following examples slice the GNU Triangulated Surface file Hollow Square.gts. The examples are run in a terminal in the folder which
contains Hollow Square.gts and slice.py. The preferences can be set in the dialog or by changing the preferences file 'slice.csv' with a text editor
or a spreadsheet program set to separate tabs.
> pydoc -w slice
wrote slice.html
> python slice.py
This brings up the dialog, after clicking 'Slice', the following is printed:
File Hollow Square.gcode is being sliced.
The sliced file is saved as Hollow Square_slice.gcode
>python
Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import slice
>>> slice.main()
File Hollow Square.gts is being sliced.
The sliced file is saved as Hollow Square_slice.gcode
It took 3 seconds to slice the file.
>>> slice.sliceFile()
File Hollow Square.gcode is being sliced.
The sliced file is saved as Hollow Square_slice.gcode
It took 3 seconds to slice the file.
>>> slice.getSliceGcode("
54 162 108 Number of Vertices,Number of Edges,Number of Faces
-5.800000000000001 5.341893939393939 4.017841892579603 Vertex Coordinates XYZ
5.800000000000001 5.341893939393939 4.017841892579603
..
many lines of GNU Triangulated Surface vertices, edges and faces
..
")
Modules | ||||||
|
Classes | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Functions | ||
|
Data | ||
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __date__ = '$Date: 2008/02/05 $' __license__ = 'GPL 3.0' |
Author | ||
Enrique Perez (perez_enrique@yahoo.com) |