# Python: module skeinforge_tools.clip

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

`Clip is a script to clip loop ends.
The default 'Activate Clip' checkbox is on. When it is on, the functions described below will work, when it is off, the functions
will not be called.
Clip clips the ends of loops to prevent bumps from forming. The "Clip Over Extrusion Width (ratio)" is the ratio of the amount
each end of the loop is clipped over the extrusion width. The total gap will therefore be twice the clip. If the ratio is too high
loops will have a gap, if the ratio is too low there will be a bulge at the loop ends. To run clip, in a shell type:
> python clip.py
The following examples clip 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 clip.py. The clip function will clip if 'Activate Clip' is true,
which can be set in the dialog or by changing the preferences file 'clip.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 getClipChainGcode check
to see if the text has been clipped, if not they call getCombChainGcode in comb.py to comb the text; once they have the
combed text, then they clip.
> python clip.py
This brings up the dialog, after clicking 'Clip', the following is printed:
File Screw Holder Bottom.stl is being chain clipped.
The clipped file is saved as Screw Holder Bottom_clip.gcode
> python clip.py Screw Holder Bottom.stl
File Screw Holder Bottom.stl is being chain clipped.
The clipped file is saved as Screw Holder Bottom_clip.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 clip
>>> clip.main()
This brings up the clip dialog.
>>> clip.writeOutput()
Screw Holder Bottom.stl
File Screw Holder Bottom.stl is being chain clipped.
The clipped file is saved as Screw Holder Bottom_clip.gcode
>>> clip.getClipGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> clip.getClipChainGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")`

Modules

``

__init__ skeinforge_tools.analyze cStringIO skeinforge_tools.comb | 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

Classes

``

ClipPreferences
ClipSkein

class ClipPreferences
`` | `A class to handle the clip preferences.`

Methods defined here:

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

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

class ClipSkein
`` | `A class to clip 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.`

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

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

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

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

parseGcode(self, gcodeText, loopTailorPreferences)
  `Parse gcode text and store the clip gcode.`

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

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

Functions

``

getClipChainGcode(fileName, gcodeText, loopTailorPreferences=None)
  `Clip a gcode linear move text. Chain clip the gcode if it is not already clipped.`

getClipGcode(gcodeText, loopTailorPreferences=None)
  `Clip a gcode linear move text.`

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

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