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

Tower is a script to tower islands in a gcode file.
 
To run tower, install python 2.x on your machine, which is avaliable from http://www.python.org/download/
 
To use the preferences dialog you'll also need Tkinter, which probably came with the python installation.  If it did not, look for it at:
www.tcl.tk/software/tcltk/
 
To export a GNU Triangulated Surface file from Art of Illusion, you can use the Export GNU Triangulated Surface script at:
http://members.axion.net/~enrique/Export%20GNU%20Triangulated%20Surface.bsh
 
To bring it into Art of Illusion, drop it into the folder ArtOfIllusion/Scripts/Tools/.
 
The GNU Triangulated Surface format is supported by Mesh Viewer, and it is described at:
http://gts.sourceforge.net/reference/gts-surfaces.html#GTS-SURFACE-WRITE
 
To turn an STL file into filled, towered gcode, first import the file using the STL import plugin in the import submenu of the file menu
of Art of Illusion.  Then from the Scripts submenu in the Tools menu, choose Export GNU Triangulated Surface and select the
imported STL shape.  Then type 'python slice.py' in a shell in the folder which slice & tower are in and when the dialog pops up, set
the parameters and click 'Save Preferences'.  Then type 'python fill.py' in a shell in the folder which fill is in and when the dialog
pops up, set the parameters and click 'Save Preferences'.  Then click 'Tower', choose the file which you exported in
Export GNU Triangulated Surface and the filled & towered file will be saved with the suffix '_tower'.
 
To write documentation for this program, open a shell in the tower.py directory, then type 'pydoc -w tower', then open 'tower.html' in
a browser or click on the '?' button in the dialog.  To write documentation for all the python scripts in the directory, type 'pydoc -w ./'.
To use other functions of tower, type 'python' in a shell to run the python interpreter, then type 'import tower' to import this program.
 
The computation intensive python modules will use psyco if it is available and run about twice as fast.  Psyco is described at:
http://psyco.sourceforge.net/index.html
 
The psyco download page is:
http://psyco.sourceforge.net/download.html
 
The following examples tower the files Hollow Square.gcode & Hollow Square.gts.  The examples are run in a terminal in the folder which contains
Hollow Square.gcode, Hollow Square.gts 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 towerChainFile and
getTowerChainGcode check to see if the text has been towered, if not they call the getFillChainGcode in fill.py to fill the text; once they
have the filled text, then they tower.
 
 
> pydoc -w tower
wrote tower.html
 
 
> python tower.py
This brings up the dialog, after clicking 'Tower', the following is printed:
File Hollow Square.gts is being chain towered.
The towered file is saved as Hollow Square_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.towerChainFile()
Hollow Square.gts
File Hollow Square.gts is being chain towered.
The towered file is saved as Hollow Square_tower.gcode
 
 
>>> tower.towerFile()
File Hollow Square.gcode is being towered.
The towered file is saved as Hollow Square_tower.gcode
 
 
>>> tower.getTowerGcode("
( GCode generated by May 8, 2008 slice.py )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> tower.getTowerChainGcode("
( GCode generated by May 8, 2008 slice.py )
( Extruder Initialization )
..
many lines of gcode
..
")

 
Modules
       
cStringIO
euclidean
fill
gcodec
intercircle
math
preferences
sys
time
vectorwrite

 
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.
addGcodeFromThread(self, thread)
Add a gcode thread to the output.
addGcodeMovement(self, point)
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.
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.

 
Functions
       
getTowerChainGcode(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.
towerChainFile(filename='')
Tower a gcode linear move file.  Chain tower the gcode if it is not already towered.
Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
If no filename is specified, tower the first unmodified gcode file in this folder.
towerFile(filename='')
Tower a gcode linear move file.  Depending on the preferences, either arcPoint, arcRadius, arcSegment, bevel or do nothing.
If no filename is specified, tower the first unmodified gcode file in this folder.
transferFillLoops(fillLoops, surroundingLoop)
Transfer fill loops.
transferFillLoopsToSurroundingLoops(fillLoops, surroundingLoops)
Transfer fill loops to surrounding loops.

 
Data
        __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/21/04 $'
__license__ = 'GPL 3.0'

 
Author
        Enrique Perez (perez_enrique@yahoo.com)