# Python: module skeinforge_tools.comb

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

`Comb is a script to comb the extrusion hair of a gcode file.
The default 'Activate Comb' checkbox is on. When it is on, the functions described below will work, when it is off, the functions
will not be called.
Comb bends the extruder travel paths around holes in the carve, to avoid stringers. It moves the extruder to the inside of outer
perimeters before turning the extruder on so any start up ooze will be inside the shape. It jitters the loop end position to a
different place on each layer to prevent the a ridge from forming. The 'Arrival Inset Follow Distance over Extrusion Width' is the
ratio of the amount before the start of the outer perimeter the extruder will be moved to. A high value means the extruder will
move way before the beginning of the perimeter and a low value means the extruder will be moved just before the beginning.
The "Jitter Over Extrusion Width (ratio)" is the ratio of the amount the loop ends will be jittered. A high value means the loops
will start all over the place and a low value means loops will start at roughly the same place on each layer. The 'Minimum
Perimeter Departure Distance over Extrusion Width' is the ratio of the minimum distance that the extruder will travel and loop
before leaving an outer perimeter. A high value means the extruder will loop many times before leaving, so that the ooze will
finish within the perimeter, a low value means the extruder will not loop and a stringer might be created from the outer
perimeter. To run comb, in a shell type:
> python comb.py
The following examples comb 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 comb.py. The comb function will comb if 'Activate Comb' is true, which
can be set in the dialog or by changing the preferences file 'comb.csv' in the '.skeinforge' folder in your home directory with a text
editor or a spreadsheet program set to separate tabs. The functions writeOutput and getCombChainGcode check to see if the
text has been combed, if not they call getTowerChainGcode in tower.py to tower the text; once they have the towered text, then
they comb. Pictures of combing in action are available from the Metalab blog at:
http://reprap.soup.io/?search=combing
> python comb.py
This brings up the dialog, after clicking 'Comb', the following is printed:
File Screw Holder Bottom.stl is being chain combed.
The combed file is saved as Screw Holder Bottom_comb.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 comb
>>> comb.main()
This brings up the comb dialog.
>>> comb.writeOutput()
Screw Holder Bottom.stl
File Screw Holder Bottom.stl is being chain combed.
The combed file is saved as Screw Holder Bottom_comb.gcode
>>> comb.getCombGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> comb.getCombChainGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")`

Modules

``

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

Classes

``

CombPreferences
CombSkein

class CombPreferences
`` | `A class to handle the comb preferences.`

Methods defined here:

__init__(self)
  `Set the default preferences, execute title & preferences fileName.`

execute(self)
  `Comb button has been clicked.`

class CombSkein
`` | `A class to comb a skein of extrusions.`

Methods defined here:

__init__(self)

addGcodeFromThreadZ(self, thread, z)
  `Add a gcode thread to the output.`

addGcodeMovementZ(self, point, z)
  `Add a movement to the output.`

addGcodePathZ(self, path, z)
  `Add a gcode path, without modifying the extruder, to the output.`

addIfTravel(self, splitLine)
  `Add travel move around loops if the extruder is off.`

addLine(self, line)
  `Add a line of text and a newline to the output.`

addPathBeforeEnd(self, aroundBetweenPath, location, loop)
  `Add the path before the end of the loop.`

addPathBetween(self, aroundBetweenPath, betweenFirst, betweenSecond, isLeavingPerimeter, loopFirst)
  `Add a path between the perimeter and the fill.`

addTailoredLoopPath(self)
  `Add a clipped and jittered loop path.`

addToLoop(self, location)
  `Add a location to loop.`

getAroundBetweenPath(self, location)
  `Insert paths around and between the perimeter and the fill.`

getBetweens(self)
  `Set betweens for the layer.`

getJitteredLoop(self, jitterDistance, jitterLoop)
  `Get a jittered loop path.`

getOutloopLocation(self, point)
  `Get location outside of loop.`

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

getStartIndex(self, xIntersections)
  `Get the start index of the intersections.`

initializeMoreParameters(self)
  `Add a movement to the output.`

insertPathsBetween(self, aroundBetweenPath, nextBeginning, pathEnd)
  `Insert paths between the perimeter and the fill.`

isNextExtruderOn(self)
  `Determine if there is an extruder on command before a move command.`

linearMove(self, splitLine)
  `Add to loop path if this is a loop or path.`

parseAddJitter(self, line)
  `Parse a gcode line, jitter it and add it to the comb skein.`

parseAddTravel(self, line)
  `Parse a gcode line and add it to the comb skein.`

parseGcode(self, combPreferences, gcodeText)
  `Parse gcode text and store the comb gcode.`

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

parseLine(self, combPreferences, line)
  `Parse a gcode line.`

Functions

``

getCombChainGcode(fileName, gcodeText, combPreferences=None)
  `Comb a gcode linear move text. Chain comb the gcode if it is not already combed.`

getCombGcode(gcodeText, combPreferences=None)
  `Comb a gcode linear move text.`

isLoopNumberEqual(betweenX, betweenXIndex, loopNumber)
  `Determine if the loop number is equal.`

main(hashtable=None)
  `Display the comb dialog.`

writeOutput(fileName='')
  `Comb a gcode linear move file. Chain comb the gcode if it is not already combed. If no fileName is specified, comb 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)