# Python: module skeinforge_tools.hop

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

`Hop is a script to raise the extruder when it is not extruding.
The default 'Activate Hop' checkbox is off. It is off because Vik and Nophead found better results without hopping. When it
is on, the functions described below will work, when it is off, the functions will not be called.
The important value for the hop preferences is "Hop Over Layer Thickness (ratio)" which is the ratio of the hop height over the
layer thickness, the default is 1.0. The 'Minimum Hop Angle (degrees)' is the minimum angle that the path of the extruder
will be raised. An angle of ninety means that the extruder will go straight up as soon as it is not extruding and a low angle
means the extruder path will gradually rise to the hop height, the default is 20 degrees.
To run hop, in a shell which hop is in type:
> python hop.py
The following examples hop 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 hop.py. The hop function will hop if the 'Activate Hop'
checkbox is on. The functions writeOutput and getHopChainGcode check to see if the text has been hopped, if not they
call the getStretchChainGcode in stretch.py to stretch the text; once they have the stretched text, then they hop.
> python hop.py
This brings up the dialog, after clicking 'Hop', the following is printed:
File Screw Holder Bottom.stl is being chain hopped.
The hopped file is saved as Screw Holder Bottom_hop.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 hop
>>> hop.main()
This brings up the hop dialog.
>>> hop.writeOutput()
Screw Holder Bottom.stl
File Screw Holder Bottom.stl is being chain hopped.
The hopped file is saved as Screw Holder Bottom_hop.gcode
>>> hop.getHopGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> hop.getHopChainGcode("
( 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.interpret | math skeinforge_tools.polyfile skeinforge_tools.skeinforge_utilities.preferences | skeinforge_tools.stretch sys time

Classes

``

HopPreferences
HopSkein

class HopPreferences
`` | `A class to handle the hop preferences.`

Methods defined here:

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

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

class HopSkein
`` | `A class to hop a skein of extrusions.`

Methods defined here:

__init__(self)

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

getHopLine(self, line)
  `Get hopped gcode line.`

getMovementLineWithHop(self, location, z)
  `Get linear movement line for a location.`

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

isNextTravel(self)
  `Determine if there is another linear travel before the thread ends.`

parseGcode(self, gcodeText, hopPreferences)
  `Parse gcode text and store the hop gcode.`

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

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

Functions

``

getHopChainGcode(fileName, gcodeText, hopPreferences=None)
  `Hop a gcode linear move text. Chain hop the gcode if it is not already hopped.`

getHopGcode(gcodeText, hopPreferences=None)
  `Hop a gcode linear move text.`

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

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