skeinforge_tools.craft_plugins.preface ($Date: 2008/28/04 $)
index
/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/craft_plugins/preface.py

Preface is a script to convert an svg file into a prefaced gcode file.
 
Preface converts the svg slices into gcode extrusion layers, optionally prefaced with some gcode commands.
 
If "Add M110 GCode for Compatibility with Nophead's Code" is chosen, then preface will add an M110 line for compatibility with
Nophead's parser, the default is off.  If "Set Positioning to Absolute" is chosen, preface will add the G90 command to set positioning to
absolute, the default is on.  If "Set Units to Millimeters" is chosen, preface will add the G21 command to set the units to millimeters, the
default is on.  If the "Start at Home" preference is selected, the G28 go to home gcode will be added at the beginning of the file, the
default is off.  If the "Turn Extruder Off at Shut Down" preference is selected, the M103 turn extruder off gcode will be added at the end
of the file, the default is on.  If the "Turn Extruder Off at Start Up" preference is selected, the M103 turn extruder off gcode will be added
at the beginning of the file, the default is on.
 
Preface also gives the option of using Adrian's extruder distance E value in the gcode lines, as described at:
http://blog.reprap.org/2009/05/4d-printing.html
 
and in Erik de Bruijn's conversion script page at:
http://objects.reprap.org/wiki/3D-to-5D-Gcode.php
 
The extrusion distance format is either "Do Not Add Extrusion Distance", which gives standard XYZ & Feed Rate gcode, this is the
default choice.  If "Extrusion Distance Absolute" is chosen, the extrusion distance output will be the total extrusion distance to that gcode
line.  If "Extrusion Distance Relative" is chosen, the extrusion distance output will be the extrusion distance from the last gcode line.
 
When preface is generating the code, if there is a file start.txt, it will add that to the very beginning of the gcode.  At the very end, it will
add the file end.txt if it exists. Preface does not care if the text file names are capitalized, but some file systems do not handle file name
cases properly, so to be on the safe side you should give them lower case names.  Preface looks for those files in the alterations folder
in the .skeinforge folder in the home directory. If it doesn't find the file it then looks in the alterations folder in the skeinforge_tools folder.
If it doesn't find anything there looks in the skeinforge_tools folder.
 
The following examples preface the files Screw Holder Bottom.gcode & Screw Holder Bottom.stl.  The examples are run in a terminal in
the folder which contains Screw Holder Bottom.stl and preface.py.
 
 
> python preface.py
This brings up the dialog, after clicking 'Preface', the following is printed:
File Screw Holder Bottom.stl is being chain prefaced.
The prefaced file is saved as Screw Holder Bottom_preface.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 preface
>>> preface.main()
File Screw Holder Bottom.stl is being prefaced.
The prefaced file is saved as Screw Holder Bottom_preface.gcode
It took 3 seconds to preface the file.
 
 
>>> preface.writeOutput()
File Screw Holder Bottom.stl is being prefaced.
The prefaced file is saved as Screw Holder Bottom_preface.gcode
It took 3 seconds to preface the file.

 
Modules
       
__init__
skeinforge_tools.analyze
skeinforge_tools.craft_plugins.carve
skeinforge_tools.skeinforge_utilities.euclidean
skeinforge_tools.skeinforge_utilities.gcodec
skeinforge_tools.skeinforge_utilities.intercircle
skeinforge_tools.skeinforge_utilities.interpret
os
skeinforge_tools.polyfile
skeinforge_tools.skeinforge_utilities.preferences
sys
time

 
Classes
       
PrefacePreferences
PrefaceSkein

 
class PrefacePreferences
    A class to handle the preface preferences.
 
  Methods defined here:
__init__(self)
Set the default preferences, execute title & preferences fileName.
execute(self)
Preface button has been clicked.

 
class PrefaceSkein
    A class to preface a skein of extrusions.
 
  Methods defined here:
__init__(self)
addFromUpperLowerFile(self, fileName)
Add lines of text from the fileName or the lowercase fileName, if there is no file by the original fileName in the directory.
addGcodeFromLoop(self, loop, z)
Add the remainder of the loop which does not overlap the alreadyFilledArounds loops.
addInitializationToOutput(self)
Add initialization gcode to the output.
addPathData(self, line)
Add the data from the path line.
addPreface(self, rotatedBoundaryLayer)
Add preface to the carve layer.
addRotatedLoopLayer(self, z)
Add rotated loop layer.
addShutdownToOutput(self)
Add shutdown gcode to the output.
addTextData(self, line)
Add the data from the text line.
parseGcode(self, prefacePreferences, gcodeText)
Parse gcode text and store the bevel gcode.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, lineIndex)
Parse a gcode line and add it to the preface skein.

 
Functions
       
getChainGcode(fileName, gcodeText, prefacePreferences=None)
Preface the carves of a gcode text.  Chain preface the gcode if it is not already carved.
getGcode(gcodeText, prefacePreferences=None)
Preface the carves of a gcode text.
main(hashtable=None)
Display the preface dialog.
writeOutput(fileName='')
Preface the carving of a gcode file.  If no fileName is specified, preface the first unmodified gcode file in this folder.

 
Data
        __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/28/04 $'
__license__ = 'GPL 3.0'
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)

 
Author
        Enrique Perez (perez_enrique@yahoo.com)