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

Fill is a script to fill the slices of a gcode file.
 
To run fill, 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 turn an STL file into filled 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 Skeinforge and select the imported STL shape.  In the Fill radio button group,
choose Slice and click the 'Export Selected' checkbox.  Set the parameters and click OK.  Then type 'python fill.py' in a shell in the folder
which fill is in and when the dialog pops up, set the parameters.  The parameters from fill will override any parameters of the same name
from Slice.  Then click 'Fill', choose the file which you generated in Skeinforge and the filled file will be saved with the suffix '_fill'.
 
To write documentation for this program, open a shell in the fill.py directory, then type 'pydoc -w fill.py', then open 'fill.html' in a browser
or click on the '?' button in the dialog.  To use other functions of fill, type 'python' in a shell to run the python interpreter, then type 'import fill'
to import this program.
 
The following examples fill the gcode file Hollow Square.gcode.  The examples are run in a terminal in the folder which contains
Hollow Square.gcode and fill.py.  The preferences can be set in the dialog or by changing the preferences file 'fill.csv' with a text editor
or a spreadsheet program set to separate tabs.
 
 
> pydoc -w fill.py
wrote fill.html
 
 
> python fill.py
This brings up the dialog, after clicking 'Fill', the following is printed:
File Hollow Square.gcode is being chain filled.
The filled file is saved as Hollow Square_fill.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 fill
>>> fill.main()
File Hollow Square.gcode is being filled.
The filled file is saved as Hollow Square_fill.gcode
It took 3 seconds to fill the file.
 
 
>>> fill.fillChainFile()
File Hollow Square.gcode is being filled.
The filled file is saved as Hollow Square_fill.gcode
It took 3 seconds to fill the file.
 
 
>>> fill.fillFile()
File Hollow Square.gcode is being filled.
The filled file is saved as Hollow Square_fill.gcode
It took 3 seconds to fill the file.
 
 
>>> fill.getFillChainGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
 
 
>>> fill.getFillGcode("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")

 
Modules
       
cStringIO
euclidean
gcodec
intercircle
math
os
sys
time
_tkinter
webbrowser

 
Classes
       
Endpoint
FillPreferences
FillSkein
StretchedXSegment

 
class Endpoint
    The endpoint of a segment.
 
  Methods defined here:
__repr__(self)
Get the string representation of this Endpoint.
getFromOtherPoint(self, otherEndpoint, point)
Initialize from other endpoint.
getNearestEndpoint(self, endpoints)
Get nearest endpoint.
getNearestMiss(self, arounds, endpoints, extrusionWidth, stretchedXSegments)
Get the nearest endpoint which the segment to that enpoint misses the other extrusions.
isLoopListCrossingInsideXSegment(self, loopList, segmentFirstX, segmentSecondX, segmentYMirror, y)
Determine if the loop list is crossing inside the x segment.
isPointCrossingSegments(self, extrusionWidth, inputPoint, stretchedXSegments)
Determine if the segment to the point is crossing a stretched x segment.

 
class FillPreferences
    A class to handle the fill preferences.
 
  Methods defined here:
__init__(self)
Set the default preferences, execute title & preferences filename.
execute(self)
Fill button has been clicked.

 
class FillSkein
    A class to fill a skein of extrusions.
 
  Methods defined here:
__init__(self)
addFill(self, layerIndex)
Add fill to the slice layer.
addFilledLayerToOutput(self, layerIndex)
Add a filled layer to the output.
addGcodeFromThread(self, thread)
Add a thread to the output.
addGcodeMovement(self, point)
Add a movement to the output.
addLine(self, line)
Add a line of text and a newline to the output.
addLinearMovePoint(self, point)
Add a gcode linear move, feedrate and newline to the output.
addRotatedSlice(self, layerIndex, reverseRotationAroundZAngle, surroundingSlices)
Add a rotated slice to the surrounding slices.
addShutdownToOutput(self)
Add shutdown gcode to the output.
addToThread(self, location)
Add a location to thread.
getLayerRotationAngle(self, layerIndex)
Get the angle the layer is rotated by.
getLayerRotationAroundZAngle(self, layerIndex)
Get the around z angle of the amount the layer is rotated by.
linearMove(self, splitLine)
Add a linear move to the thread.
parseGcode(self, fillPreferences, gcodeText)
Parse gcode text and store the bevel gcode.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, line)
Parse a gcode line and add it to the fill skein.

 
class StretchedXSegment
    A stretched x segment.
 
  Methods defined here:
__repr__(self)
Get the string representation of this StretchedXSegment.
getFromXYStretch(self, firstX, y, secondX, stretch)
Initialize from x, y, and stretch.

 
Functions
       
addAroundClosest(paths, removedEndpointPoint)
Add the closest removed endpoint to the path, with minimal twisting.
addPath(extrusionWidth, fill, path, rotationPlaneAngle)
Add simplified path to fill.
addPathBetween(betweenFirst, betweenSecond, loopFirst, nextIndex, paths)
Add a path between the perimeter and the fill.
addSparseEndpoints(doubleExtrusionWidth, endpoints, fillDensity, fillLine, horizontalSegments, removedEndpoints, surroundingXIntersections)
Add sparse endpoints.
addSparseEndpointsFromSegment(doubleExtrusionWidth, endpoints, fillDensity, fillLine, horizontalSegments, removedEndpoints, segment, surroundingXIntersections)
Add sparse endpoints from a segment.
fillFile(filename='')
Fill the slices of a gcode file.  If no filename is specified, fill the first unmodified gcode file in this folder.
getFillChainGcode(gcodeText, fillPreferences=None)
Fill the slices of a gcode file.  Chain fill the gcode if it is not already sliced.
getFillGcode(gcodeText, fillPreferences=None)
Fill the slices of a gcode file.
getHorizontalSegments(fillLoops, alreadyFilledArounds, y)
Get horizontal segments inside loops.
getSegmentsFromIntersections(solidXIntersectionList, y, z)
Get endpoint segments from the intersections.
getSurroundingXIntersections(alreadyFilledSize, doubleSolidSurfaceLayers, surroundingSlices, y)
Get x intersections from surrounding layers.
insertPathsBetween(betweens, pathIndex, paths)
Insert paths between the perimeter and the fill.
isLoopNumberEqual(betweenX, betweenXIndex, loopNumber)
Determine if the loop number is equal.
isSegmentAround(aroundSegments, segment)
Determine if there is another segment around.
isSegmentInX(segment, xFirst, xSecond)
Determine if the segment overlaps within x.
main(hashtable=None)
Display the fill dialog.
toggleHashtable(hashtable, key, value)
Toggle a hashtable between having and not having a key.

 
Data
        ACTIVE = 'active'
ALL = 'all'
ANCHOR = 'anchor'
ARC = 'arc'
BASELINE = 'baseline'
BEVEL = 'bevel'
BOTH = 'both'
BOTTOM = 'bottom'
BROWSE = 'browse'
BUTT = 'butt'
CASCADE = 'cascade'
CENTER = 'center'
CHAR = 'char'
CHECKBUTTON = 'checkbutton'
CHORD = 'chord'
COMMAND = 'command'
CURRENT = 'current'
DISABLED = 'disabled'
DOTBOX = 'dotbox'
E = 'e'
END = 'end'
EW = 'ew'
EXCEPTION = 8
EXTENDED = 'extended'
FALSE = 0
FIRST = 'first'
FLAT = 'flat'
GROOVE = 'groove'
HIDDEN = 'hidden'
HORIZONTAL = 'horizontal'
INSERT = 'insert'
INSIDE = 'inside'
LAST = 'last'
LEFT = 'left'
MITER = 'miter'
MOVETO = 'moveto'
MULTIPLE = 'multiple'
N = 'n'
NE = 'ne'
NO = 0
NONE = 'none'
NORMAL = 'normal'
NS = 'ns'
NSEW = 'nsew'
NUMERIC = 'numeric'
NW = 'nw'
OFF = 0
ON = 1
OUTSIDE = 'outside'
PAGES = 'pages'
PIESLICE = 'pieslice'
PROJECTING = 'projecting'
RADIOBUTTON = 'radiobutton'
RAISED = 'raised'
READABLE = 2
RIDGE = 'ridge'
RIGHT = 'right'
ROUND = 'round'
S = 's'
SCROLL = 'scroll'
SE = 'se'
SEL = 'sel'
SEL_FIRST = 'sel.first'
SEL_LAST = 'sel.last'
SEPARATOR = 'separator'
SINGLE = 'single'
SOLID = 'solid'
SUNKEN = 'sunken'
SW = 'sw'
StringTypes = (<type 'str'>, <type 'unicode'>)
TOP = 'top'
TRUE = 1
TclVersion = 8.4000000000000004
TkVersion = 8.4000000000000004
UNDERLINE = 'underline'
UNITS = 'units'
VERTICAL = 'vertical'
W = 'w'
WORD = 'word'
WRITABLE = 4
X = 'x'
Y = 'y'
YES = 1
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/28/04 $'
__license__ = 'GPL 3.0'
wantobjects = 1

 
Author
        Enrique Perez (perez_enrique@yahoo.com)