fillet ($Date: 2008/21/04 $)
index
/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap_v0.1/fillet.py

Fillet is a script to fillet or bevel the corners on a gcode file.
 
To run fillet, 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 turn an STL file into filled, filleted 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 Skeinforge and select the imported STL shape.  In the
Fill radio button group, choose Slice and click the 'Export Selected' checkbox.  Set the parameters and click OK.  Then type
'python fill.py' in a shell in the folder which fill is in and when the dialog pops up, set the parameters and click 'Save Preferences'.
The parameters from fill will override any parameters of the same name from Slice.  Then type 'python fillet.py' in a shell and when
the dialog pops up, change the parameters if you wish but the default bevel is fine.  Then click 'Fillet', choose the file which you
generated in Skeinforge and the filled & filleted file will be saved with the suffix '_fillet'.
 
To write documentation for this program, open a shell in the fillet.py directory, then type 'pydoc -w fillet.py', then open 'fillet.html' in
a browser or click on the '?' button in the dialog.  To use other functions of fillet, type 'python' in a shell to run the python interpreter,
then type 'import fillet' to import this program.
 
The following examples fillet the gcode file Hollow Square.gcode.  The examples are run in a terminal in the folder which contains
Hollow Square.gcode and fillet.py.  The fillet function executes the preferred fillet type, which can be set in the dialog or by changing
the preferences file 'fillet.csv' with a text editor or a spreadsheet program set to separate tabs.  The functions filletChainFile and
getFilletChainGcode check to see if the text has been filled, if not they call the getFillChainGcode in fill.py to fill the text; once they
have the filled text, then they fillet.
 
 
> pydoc -w fillet.py
wrote fillet.html
 
 
> python fillet.py
This brings up the dialog, after clicking 'Fillet', the following is printed:
File Hollow Square.gcode is being chain filleted.
The filleted file is saved as Hollow Square_fillet.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 fillet
>>> fillet.main()
This brings up the fillet dialog.
 
 
>>> fillet.arcPointFile()
File Hollow Square.gcode is being filleted into arc points.
The arc point file is saved as Hollow Square_fillet.gcode
 
 
>>> fillet.arcRadiusFile()
File Hollow Square.gcode is being filleted into arc radiuses.
The arc radius file is saved as Hollow Square_fillet.gcode
 
 
>>> fillet.arcSegmentFile()
File Hollow Square.gcode is being arc segmented.
The arc segment file is saved as Hollow Square_fillet.gcode
 
 
>>> fillet.bevelFile()
File Hollow Square.gcode is being beveled.
The beveled file is saved as Hollow Square_fillet.gcode
 
 
>>> fillet.filletChainFile()
Hollow Square.gcode
File Hollow Square.gcode is being chain filleted.
The filleted file is saved as Hollow Square_fillet.gcode
 
 
>>> fillet.filletFile()
File Hollow Square.gcode is being filleted.
The filleted file is saved as Hollow Square_fillet.gcode
 
 
>>> fillet.getArcPointGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> fillet.getArcRadiusGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> fillet.getArcSegmentGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> fillet.getBevelGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> fillet.getFilletGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> fillet.getFilletChainGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")

 
Modules
       
cStringIO
fill
gcodec
math
os
sys
_tkinter
webbrowser

 
Classes
       
BevelSkein
ArcSegmentSkein
ArcPointSkein
ArcRadiusSkein
FilletPreferences

 
class ArcPointSkein(ArcSegmentSkein)
    A class to arc point a skein of extrusions.
 
 
Method resolution order:
ArcPointSkein
ArcSegmentSkein
BevelSkein

Methods defined here:
addArc(self, afterCenterDifferenceAngle, afterPoint, beforeCenterSegment, beforePoint, center)
Add an arc point to the filleted skein.
addRelativeCenter(self, centerMinusBefore)
Add the relative center to a line of the arc point filleted skein.

Methods inherited from ArcSegmentSkein:
splitPointGetAfter(self, location, nextActive, oldActiveLocation)
Fillet a point into arc segments and return the end of the last segment.

Methods inherited from BevelSkein:
__init__(self)
addFeedrateEnd(self)
Add the gcode feedrate and a newline to the output.
addLine(self, line)
Add a line of text and a newline to the output.
addLinearMovePoint(self, point)
Add a gcode linear move, feedrate and newline to the output.
addPoint(self, point)
Add a gcode point to the output.
getNextActive(self, location)
Get the next linear move where the extruder is still active.  Return none is none is found.
linearMove(self, splitLine)
Bevel a linear move.
parseGcode(self, gcodeText)
Parse gcode text and store the bevel gcode.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, line)
Parse a gcode line and add it to the bevel gcode.

 
class ArcRadiusSkein(ArcPointSkein)
    A class to arc radius a skein of extrusions.
 
 
Method resolution order:
ArcRadiusSkein
ArcPointSkein
ArcSegmentSkein
BevelSkein

Methods defined here:
addRelativeCenter(self, centerMinusBefore)
Add the relative center to a line of the arc radius filleted skein.

Methods inherited from ArcPointSkein:
addArc(self, afterCenterDifferenceAngle, afterPoint, beforeCenterSegment, beforePoint, center)
Add an arc point to the filleted skein.

Methods inherited from ArcSegmentSkein:
splitPointGetAfter(self, location, nextActive, oldActiveLocation)
Fillet a point into arc segments and return the end of the last segment.

Methods inherited from BevelSkein:
__init__(self)
addFeedrateEnd(self)
Add the gcode feedrate and a newline to the output.
addLine(self, line)
Add a line of text and a newline to the output.
addLinearMovePoint(self, point)
Add a gcode linear move, feedrate and newline to the output.
addPoint(self, point)
Add a gcode point to the output.
getNextActive(self, location)
Get the next linear move where the extruder is still active.  Return none is none is found.
linearMove(self, splitLine)
Bevel a linear move.
parseGcode(self, gcodeText)
Parse gcode text and store the bevel gcode.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, line)
Parse a gcode line and add it to the bevel gcode.

 
class ArcSegmentSkein(BevelSkein)
    A class to arc segment a skein of extrusions.
 
  Methods defined here:
addArc(self, afterCenterDifferenceAngle, afterPoint, beforeCenterSegment, beforePoint, center)
Add arc segments to the filleted skein.
splitPointGetAfter(self, location, nextActive, oldActiveLocation)
Fillet a point into arc segments and return the end of the last segment.

Methods inherited from BevelSkein:
__init__(self)
addFeedrateEnd(self)
Add the gcode feedrate and a newline to the output.
addLine(self, line)
Add a line of text and a newline to the output.
addLinearMovePoint(self, point)
Add a gcode linear move, feedrate and newline to the output.
addPoint(self, point)
Add a gcode point to the output.
getNextActive(self, location)
Get the next linear move where the extruder is still active.  Return none is none is found.
linearMove(self, splitLine)
Bevel a linear move.
parseGcode(self, gcodeText)
Parse gcode text and store the bevel gcode.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, line)
Parse a gcode line and add it to the bevel gcode.

 
class BevelSkein
    A class to bevel a skein of extrusions.
 
  Methods defined here:
__init__(self)
addFeedrateEnd(self)
Add the gcode feedrate and a newline to the output.
addLine(self, line)
Add a line of text and a newline to the output.
addLinearMovePoint(self, point)
Add a gcode linear move, feedrate and newline to the output.
addPoint(self, point)
Add a gcode point to the output.
getNextActive(self, location)
Get the next linear move where the extruder is still active.  Return none is none is found.
linearMove(self, splitLine)
Bevel a linear move.
parseGcode(self, gcodeText)
Parse gcode text and store the bevel gcode.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, line)
Parse a gcode line and add it to the bevel gcode.
splitPointGetAfter(self, location, nextActive, oldActiveLocation)
Bevel a point and return the end of the bevel.

 
class FilletPreferences
    A class to handle the fillet preferences.
 
  Methods defined here:
__init__(self)
Set the default preferences, execute title & preferences filename.
execute(self)
Fillet button has been clicked.

 
Functions
       
arcPointFile(filename='')
Fillet a gcode linear move file into a helical point move file.  If no filename is specified, arc point the first unmodified gcode file in this folder.
arcRadiusFile(filename='')
Fillet a gcode linear move file into a helical radius move file.  If no filename is specified, arc radius the first unmodified gcode file in this folder.
arcSegmentFile(filename='')
Fillet a gcode linear move file into an arc segment linear move file.  If no filename is specified, arc segment the first unmodified gcode file in this folder.
bevelFile(filename='')
Bevel a gcode linear move file.  If no filename is specified, bevel the first unmodified gcode file in this folder.
filletChainFile(filename='')
Fillet a gcode linear move file.  Chain fill the gcode if it is not already filled.
Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
If no filename is specified, fillet the first unmodified gcode file in this folder.
filletFile(filename='')
Fillet a gcode linear move file.  Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
If no filename is specified, fillet the first unmodified gcode file in this folder.
getArcPointGcode(gcodeText)
Arc point a gcode linear move text into a helical point move gcode text.
getArcRadiusGcode(gcodeText)
Arc radius a gcode linear move text into a helical radius move gcode text.
getArcSegmentGcode(gcodeText)
Arc segment a gcode linear move text into an arc segment linear move gcode text.
getBevelGcode(gcodeText)
Bevel a gcode linear move text.
getFilletChainGcode(gcodeText, filletPreferences=None)
Fillet a gcode linear move text.  Chain fill the gcode if it is not already filled.
getFilletGcode(gcodeText, filletPreferences=None)
Fillet a gcode linear move text.
main(hashtable=None)
Display the fillet dialog.

 
Data
        ACTIVE = 'active'
ALL = 'all'
ANCHOR = 'anchor'
ARC = 'arc'
BASELINE = 'baseline'
BEVEL = 'bevel'
BOTH = 'both'
BOTTOM = 'bottom'
BROWSE = 'browse'
BUTT = 'butt'
CASCADE = 'cascade'
CENTER = 'center'
CHAR = 'char'
CHECKBUTTON = 'checkbutton'
CHORD = 'chord'
COMMAND = 'command'
CURRENT = 'current'
DISABLED = 'disabled'
DOTBOX = 'dotbox'
E = 'e'
END = 'end'
EW = 'ew'
EXCEPTION = 8
EXTENDED = 'extended'
FALSE = 0
FIRST = 'first'
FLAT = 'flat'
GROOVE = 'groove'
HIDDEN = 'hidden'
HORIZONTAL = 'horizontal'
INSERT = 'insert'
INSIDE = 'inside'
LAST = 'last'
LEFT = 'left'
MITER = 'miter'
MOVETO = 'moveto'
MULTIPLE = 'multiple'
N = 'n'
NE = 'ne'
NO = 0
NONE = 'none'
NORMAL = 'normal'
NS = 'ns'
NSEW = 'nsew'
NUMERIC = 'numeric'
NW = 'nw'
OFF = 0
ON = 1
OUTSIDE = 'outside'
PAGES = 'pages'
PIESLICE = 'pieslice'
PROJECTING = 'projecting'
RADIOBUTTON = 'radiobutton'
RAISED = 'raised'
READABLE = 2
RIDGE = 'ridge'
RIGHT = 'right'
ROUND = 'round'
S = 's'
SCROLL = 'scroll'
SE = 'se'
SEL = 'sel'
SEL_FIRST = 'sel.first'
SEL_LAST = 'sel.last'
SEPARATOR = 'separator'
SINGLE = 'single'
SOLID = 'solid'
SUNKEN = 'sunken'
SW = 'sw'
StringTypes = (<type 'str'>, <type 'unicode'>)
TOP = 'top'
TRUE = 1
TclVersion = 8.4000000000000004
TkVersion = 8.4000000000000004
UNDERLINE = 'underline'
UNITS = 'units'
VERTICAL = 'vertical'
W = 'w'
WORD = 'word'
WRITABLE = 4
X = 'x'
Y = 'y'
YES = 1
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/21/04 $'
__license__ = 'GPL 3.0'
wantobjects = 1

 
Author
        Enrique Perez (perez_enrique@yahoo.com)