# Python: module skeinforge_tools.tower

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

`Tower is a script to extrude a few layers up, then go across to other regions.
The default 'Activate Tower' checkbox is off. The default is off because tower could result in the extruder collidiing with an
already extruded part of the shape and because extruding in one region for more than one layer could result in the shape
melting. When it is on, the functions described below will work, when it is off, the functions will not be called.
This script commands the fabricator to extrude a disconnected region for a few layers, then go to another disconnected region
and extrude there. Its purpose is to reduce the number of stringers between a shape and reduce extruder travel. The important
value for the tower preferences is "Maximum Tower Height (layers)" which is the maximum number of layers that the extruder
will extrude in one region before going to another.
Tower works by looking for islands in each layer and if it finds another island in the layer above, it goes to the next layer above
instead of going across to other regions on the original layer. It checks for collision with shapes already extruded within a cone
from the nozzle tip. The "Extruder Possible Collision Cone Angle (degrees)" preference is the angle of that cone. Realistic
values for the cone angle range between zero and ninety. The higher the angle, the less likely a collision with the rest of the
shape is, generally the extruder will stay in the region for only a few layers before a collision is detected with the wide cone.
The default angle is sixty degrees.
The "Tower Start Layer" is the layer which the script starts extruding towers, after the last raft layer which does not have
support material. It is best to not tower at least the first layer because the temperature of the first layer should sometimes be
different than that of the other layers. The default preference is one. To run tower, in a shell type:
> python tower.py
The following examples tower 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 tower.py. The tower function will tower if 'Maximum Tower Layers' is
greater than zero, which can be set in the dialog or by changing the preferences file 'tower.csv' with a text editor or a spreadsheet
program set to separate tabs. The functions writeOutput and getTowerChainGcode check to see if the text has been towered,
if not they call the getRaftChainGcode in raft.py to raft the text; once they have the rafted text, then they tower. Pictures of
towering in action are available from the Metalab blog at:
http://reprap.soup.io/?search=towering
> python tower.py
This brings up the dialog, after clicking 'Tower', the following is printed:
File Screw Holder Bottom.stl is being chain towered.
The towered file is saved as Screw Holder Bottom_tower.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 tower
>>> tower.main()
This brings up the tower dialog.
>>> tower.writeOutput()
Screw Holder Bottom.stl
File Screw Holder Bottom.stl is being chain towered.
The towered file is saved as Screw Holder Bottom_tower.gcode
>>> tower.getTowerGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> tower.getTowerChainGcode("
( 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 skeinforge_tools.raft sys | time

Classes

``

ThreadLayer
TowerPreferences
TowerSkein

class ThreadLayer
`` | `A layer of loops and paths.`

Methods defined here:

__init__(self)
  `Thread layer constructor.`

__repr__(self)
  `Get the string representation of this thread layer.`

class TowerPreferences
`` | `A class to handle the tower preferences.`

Methods defined here:

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

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

class TowerSkein
`` | `A class to tower a skein of extrusions.`

Methods defined here:

__init__(self)

addEntireLayer(self, layerIndex)
  `Add entire thread layer.`

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

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

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

addIslandLayer(self, threadLayer)
  `Add a layer of surrounding islands.`

addLayerLinesIfDifferent(self, layerIndex)
  `Add gcode lines for the layer if it is different than the old bottom layer index.`

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

addShutdownToOutput(self)
  `Add shutdown gcode to the output.`

addToExtrusion(self, location)
  `Add a location to the thread.`

addTowers(self)
  `Add towers.`

climbTower(self, removedIsland)
  `Climb up the island to any islands directly above.`

getBottomLayerIndex(self)
  `Get the index of the first island layer which has islands.`

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

isInsideRemovedOutsideCone(self, island, removedBoundingLoop, untilLayerIndex)
  `Determine if the island is entirely inside the removed bounding loop and outside the collision cone of the remaining islands.`

linearMove(self, splitLine)
  `Add a linear move to the loop.`

parseGcode(self, gcodeText, towerPreferences)
  `Parse gcode text and store the tower gcode.`

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

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

parseUntilOperatingLayer(self)
  `Parse gcode until the operating layer if there is one.`

Functions

``

getTowerChainGcode(fileName, gcodeText, towerPreferences=None)
  `Tower a gcode linear move text. Chain tower the gcode if it is not already towered.`

getTowerGcode(gcodeText, towerPreferences=None)
  `Tower a gcode linear move text.`

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

transferFillLoops(fillLoops, surroundingLoop)
  `Transfer fill loops.`

transferFillLoopsToSurroundingLoops(fillLoops, surroundingLoops)
  `Transfer fill loops to surrounding loops.`

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