# Python: module skeinforge_tools.fillet

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

`Fillet is a script to fillet or bevel the corners on a gcode file.
The default 'Activate Fillet' checkbox is on. When it is on, the functions described below will work, when it is off, the functions
will not be called.
Fillet rounds the corners slightly in a variety of ways. This is to reduce corner blobbing and sudden extruder acceleration.
The 'Arc Point' method fillets the corners with an arc using the gcode point form. The 'Arc Radius' method fillets with an arc
using the gcode radius form. The 'Arc Segment' method fillets corners with an arc composed of several segments. The
'Bevel' method bevels each corner. The default radio button choice is 'Bevel'.
The 'Corner Feedrate over Operating Feedrate' is the ratio of the feedrate in corners over the operating feedrate. With a high
value the extruder will move quickly in corners, accelerating quickly and leaving a thin extrusion. With a low value, the
extruder will move slowly in corners, accelerating gently and leaving a thick extrusion. The default value is 1.0. The 'Fillet
Radius over Extrusion Width' ratio determines how much wide the fillet will be, the default is 0.35. The 'Reversal Slowdown
over Extrusion Width' ratio determines how far before a path reversal the extruder will slow down. Some tools, like nozzle
wipe, double back the path of the extruder and this option will add a slowdown point in that path so there won't be a sudden
jerk at the end of the path. The default value is 0.5 and if the value is less than 0.1 a slowdown will not be added. If
'Use Intermediate Feedrate in Corners' is chosen, the feedrate entering the corner will be the average of the old feedrate and
the new feedrate, the default is true. To run fillet, in a shell in the folder which fillet is in type:
> python fillet.py
The following examples fillet 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.gcode, Screw Holder Bottom.stl 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 writeOutput and getFilletChainGcode check to see if the text has been combed, if not they call the
getOozebaneChainGcode in oozebane.py to fill the text; once they have the oozebaned text, then they fillet.
> python fillet.py
This brings up the dialog, after clicking 'Fillet', the following is printed:
File Screw Holder Bottom.stl is being chain filleted.
The filleted file is saved as Screw Holder Bottom_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 Screw Holder Bottom.gcode is being filleted into arc points.
The arc point file is saved as Screw Holder Bottom_fillet.gcode
>>> fillet.arcRadiusFile()
File Screw Holder Bottom.gcode is being filleted into arc radiuses.
The arc radius file is saved as Screw Holder Bottom_fillet.gcode
>>> fillet.arcSegmentFile()
File Screw Holder Bottom.gcode is being arc segmented.
The arc segment file is saved as Screw Holder Bottom_fillet.gcode
>>> fillet.bevelFile()
File Screw Holder Bottom.gcode is being beveled.
The beveled file is saved as Screw Holder Bottom_fillet.gcode
>>> fillet.getArcPointGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> fillet.getArcRadiusGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> fillet.getArcSegmentGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> fillet.getBevelGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> fillet.getFilletGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> fillet.getFilletChainGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> fillet.writeOutput()
Screw Holder Bottom.stl
File Screw Holder Bottom.gcode is being chain filleted.
The filleted file is saved as Screw Holder Bottom_fillet.gcode`

Modules

``

__init__ skeinforge_tools.analyze cStringIO | skeinforge_tools.skeinforge_utilities.euclidean skeinforge_tools.skeinforge_utilities.gcodec skeinforge_tools.skeinforge_utilities.interpret | math skeinforge_tools.oozebane skeinforge_tools.polyfile | skeinforge_tools.skeinforge_utilities.preferences sys time

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, nextLocation)
  `Fillet a point into arc segments and return the end of the last segment.`

Methods inherited from BevelSkein:

__init__(self)

addFeedrateEnd(self, feedrate)
  `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, feedrate, point)
  `Add a gcode linear move, feedrate and newline to the output.`

addPoint(self, point)
  `Add a gcode point to the output.`

getCornerFeedrate(self)
  `Get the corner feedrate, which may be based on the intermediate feedrate.`

getExtruderOffReversalPoint(self, afterSegment, beforeSegment, location)
  `If the extruder is off and the path is reversing, add intermediate slow points.`

getNextLocation(self)
  `Get the next linear move. Return none is none is found.`

getRounded(self, number)
  `Get number rounded to the number of carried decimal places as a string.`

linearMove(self, splitLine)
  `Bevel a linear move.`

parseGcode(self, filletPreferences, gcodeText)
  `Parse gcode text and store the bevel gcode.`

parseInitialization(self, filletPreferences)
  `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, nextLocation)
  `Fillet a point into arc segments and return the end of the last segment.`

Methods inherited from BevelSkein:

__init__(self)

addFeedrateEnd(self, feedrate)
  `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, feedrate, point)
  `Add a gcode linear move, feedrate and newline to the output.`

addPoint(self, point)
  `Add a gcode point to the output.`

getCornerFeedrate(self)
  `Get the corner feedrate, which may be based on the intermediate feedrate.`

getExtruderOffReversalPoint(self, afterSegment, beforeSegment, location)
  `If the extruder is off and the path is reversing, add intermediate slow points.`

getNextLocation(self)
  `Get the next linear move. Return none is none is found.`

getRounded(self, number)
  `Get number rounded to the number of carried decimal places as a string.`

linearMove(self, splitLine)
  `Bevel a linear move.`

parseGcode(self, filletPreferences, gcodeText)
  `Parse gcode text and store the bevel gcode.`

parseInitialization(self, filletPreferences)
  `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, nextLocation)
  `Fillet a point into arc segments and return the end of the last segment.`

Methods inherited from BevelSkein:

__init__(self)

addFeedrateEnd(self, feedrate)
  `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, feedrate, point)
  `Add a gcode linear move, feedrate and newline to the output.`

addPoint(self, point)
  `Add a gcode point to the output.`

getCornerFeedrate(self)
  `Get the corner feedrate, which may be based on the intermediate feedrate.`

getExtruderOffReversalPoint(self, afterSegment, beforeSegment, location)
  `If the extruder is off and the path is reversing, add intermediate slow points.`

getNextLocation(self)
  `Get the next linear move. Return none is none is found.`

getRounded(self, number)
  `Get number rounded to the number of carried decimal places as a string.`

linearMove(self, splitLine)
  `Bevel a linear move.`

parseGcode(self, filletPreferences, gcodeText)
  `Parse gcode text and store the bevel gcode.`

parseInitialization(self, filletPreferences)
  `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, feedrate)
  `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, feedrate, point)
  `Add a gcode linear move, feedrate and newline to the output.`

addPoint(self, point)
  `Add a gcode point to the output.`

getCornerFeedrate(self)
  `Get the corner feedrate, which may be based on the intermediate feedrate.`

getExtruderOffReversalPoint(self, afterSegment, beforeSegment, location)
  `If the extruder is off and the path is reversing, add intermediate slow points.`

getNextLocation(self)
  `Get the next linear move. Return none is none is found.`

getRounded(self, number)
  `Get number rounded to the number of carried decimal places as a string.`

linearMove(self, splitLine)
  `Bevel a linear move.`

parseGcode(self, filletPreferences, gcodeText)
  `Parse gcode text and store the bevel gcode.`

parseInitialization(self, filletPreferences)
  `Parse gcode initialization and store the parameters.`

parseLine(self, line)
  `Parse a gcode line and add it to the bevel gcode.`

splitPointGetAfter(self, location, nextLocation)
  `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.`

getArcPointGcode(filletPreferences, gcodeText)
  `Arc point a gcode linear move text into a helical point move gcode text.`

getArcRadiusGcode(filletPreferences, gcodeText)
  `Arc radius a gcode linear move text into a helical radius move gcode text.`

getArcSegmentGcode(filletPreferences, gcodeText)
  `Arc segment a gcode linear move text into an arc segment linear move gcode text.`

getBevelGcode(filletPreferences, gcodeText)
  `Bevel a gcode linear move text.`

getFilletChainGcode(fileName, gcodeText, filletPreferences=None)
  `Fillet a gcode linear move text. Chain oozebane the gcode if it is not already oozebaned.`

getFilletGcode(gcodeText, filletPreferences=None)
  `Fillet a gcode linear move text.`

main()
  `Display the fillet dialog.`

writeOutput(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.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __date__ = '$Date: 2008/21/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)