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

Fill is a script to fill the perimeters of a gcode file.

Allan Ecker aka The Masked Retriever's has written the "Skeinforge Quicktip: Fill" at:
http://blog.thingiverse.com/2009/07/21/mysteries-of-skeinforge-fill/

The diaphragm is a solid group of layers, at regular intervals. It can be used with a sparse infill to give the object watertight, horizontal compartments and/or a higher shear strength. The "Diaphragm Period" is the number of layers between diaphrams. The "Diaphragm Thickness" is the number of layers the diaphram is composed of. The default diaphragm is zero, because the diaphragm feature is rarely used.

The "Extra Shells on Alternating Solid Layers" preference is the number of extra shells, which are interior perimeter loops, on the alternating solid layers. The "Extra Shells on Base" preference is the number of extra shells on the bottom, base layer and every even solid layer after that. Setting this to a different value than the "Extra Shells on Alternating Solid Layers" means the infill pattern will alternate, creating a strong interleaved bond even if the perimeter loop shrinks. The "Extra Shells on Sparse Layer" preference is the number of extra shells on the sparse layers. The solid layers are those at the top & bottom, and wherever the object has a plateau or overhang, the sparse layers are the layers in between. Adding extra shells makes the object stronger & heavier.

The "Infill Pattern" can be set to "Grid Hexagonal", "Grid Rectangular" or "Line". The grid rectangular option makes a funky octogon square honeycomb like pattern which gives the object extra strength. However, the grid pattern means extra turns for the extruder and therefore extra wear & tear, also it takes longer to generate, so the default is line. The grid has extra diagonal lines, so when choosing the grid option, set the infill solidity to 0.2 or less so that there is not too much plastic and the grid generation time, which increases with the fourth power of solidity, will be reasonable. The grid hexagonal option makes a hexagonal grid, but because it is made with threads rather than with molding or milling, only a partial hexagon is possible, so the rectangular grid pattern is generally better. The "Grid Extra Overlap" preference is the amount of extra overlap added when extruding the grid to compensate for the fact that when the first thread going through a grid point is extruded, since there is nothing there yet for it to connect to it will shrink extra. The "Grid Junction Separation over Octogon Radius At End" preference is the ratio of the amount the grid square is increased in each direction over the extrusion width at the end, the default is zero. With a value of one or so the grid pattern will have large squares to go with the octogons. The "Grid Junction Separation over Octogon Radius At Middle" preference is the increase at the middle, the default is zero. If this value is different than the value at the end, the grid would have an accordion pattern, which would give it a higher shear strength. The "Grid Junction Separation Band Height" is the height of the bands of the accordion pattern.

The "Infill Begin Rotation" preference is the amount the infill direction of the base and every second layer thereafter is rotated. The default value of forty five degrees gives a diagonal infill. The "Infill Odd Layer Extra Rotation" preference is the extra amount the infill direction of the odd layers is rotated compared to the base layer. With the default value of ninety degrees the odd layer infill will be perpendicular to the base layer. The "Infill Begin Rotation Repeat" preference is the number of layers that the infill begin rotation will repeat. With the default of one, the object will have alternating cross hatching. With a value higher than one, the infill will go in one direction more often, giving the object more strength in one direction and less in the other, this is useful for beams and cantilevers.

The most important preference in fill is the "Infill Solidity". A value of one means the infill lines will be right beside each other, resulting in a solid, strong, heavy shape which takes a long time to extrude. A low value means the infill will be sparse, the interior will be mosty empty space, the object will be weak, light and quick to build. The default is 0.2.

The "Interior Infill Density over Exterior Density" preference is the ratio of the infill density of the interior over the infill density of the exterior surfaces, the default is 0.9. The exterior should have a high infill density, so that the surface will be strong and watertight. With the interior infill density a bit lower than the exterior, the plastic will not fill up higher than the extruder nozzle. If the interior density is too high that could happen, as Nophead described in the Hydraraptor "Bearing Fruit" post at:
http://hydraraptor.blogspot.com/2008/08/bearing-fruit.html

The "Solid Surface Thickness" preference is the number of solid layers that are at the bottom, top, plateaus and overhang. With a value of zero, the entire object will be composed of a sparse infill, and water could flow right through it. With a value of one, water will leak slowly through the surface and with a value of three, the object could be watertight. The higher the solid surface thickness, the stronger and heavier the object will be. The default is three.

The 'Thread Sequence Choice' is the sequence in which the threads will be extruded. There are three kinds of thread, the perimeter threads on the outside of the object, the loop threads aka inner shell threads, and the interior infill threads. This gives the following six sequence combinations:
'Infill > Loops > Perimeter'
'Infill > Perimeter > Loops'
'Loops > Infill > Perimeter'
'Loops > Perimeter > Infill'
'Perimeter > Infill > Loops'
'Perimeter > Loops > Infill'

The default choice is 'Perimeter > Loops > Infill', which the default stretch parameters are based on. If you change from the default sequence choice preference of perimeter, then loops, then infill, the optimal stretch thread parameters would also be different. In general, if the infill is extruded first, the infill would have to be stretched more so that even after the filament shrinkage, it would still be long enough to connect to the loop or perimeter.

The following examples fill the file Screw Holder Bottom.stl. The examples are run in a terminal in the folder which contains Screw Holder Bottom.stl and fill.py.


> python fill.py
This brings up the fill dialog.


> python fill.py Screw Holder Bottom.stl
The fill tool is parsing the file:
Screw Holder Bottom.stl
..
The fill tool has created the file:
.. Screw Holder Bottom_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()
This brings up the fill dialog.


>>> fill.writeOutput()
The fill tool is parsing the file:
Screw Holder Bottom.stl
..
The fill tool has created the file:
.. Screw Holder Bottom_fill.gcode

 
Modules
       
__init__
skeinforge_tools.skeinforge_utilities.consecution
skeinforge_tools.skeinforge_utilities.euclidean
skeinforge_tools.skeinforge_utilities.gcodec
skeinforge_tools.skeinforge_utilities.intercircle
skeinforge_tools.skeinforge_utilities.interpret
math
skeinforge_tools.meta_plugins.polyfile
skeinforge_tools.skeinforge_utilities.preferences
sys

 
Classes
       
FillRepository
FillSkein
RotatedLayer
YIntersectionPath

 
class FillRepository
    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 carve layer.
addGcodeFromThreadZ(self, thread, z)
Add a gcode thread to the output.
addGrid(self, arounds, fillLoops, gridPointInsetX, layerIndex, paths, pixelTable, width, reverseZRotationAngle, surroundingCarves)
Add the grid to the infill layer.
addGridLinePoints(self, begin, end, gridPoints, gridRotationAngle, offset, y)
Add the segments of one line of a grid to the infill.
addRemainingGridPoints(self, arounds, gridPointInsetX, gridPointInsetY, gridPoints, isBothOrNone, paths, pixelTable, width)
Add the remaining grid points to the grid point list.
addRotatedCarve(self, layerIndex, reverseZRotationAngle, surroundingCarves)
Add a rotated carve to the surrounding carves.
addThreadsBridgeLayer(self, rotatedLayer, surroundingLoops)
Add the threads, add the bridge end & the layer end tag.
addToThread(self, location)
Add a location to thread.
getAreaChange(self, area, layerIndex)
Get the difference between the area of the carve at the layer index and the given area.
getCarveArea(self, layerIndex)
Get the area of the carve.
getCraftedGcode(self, fillRepository, gcodeText)
Parse gcode text and store the bevel gcode.
getGridPoints(self, fillLoops, reverseZRotationAngle)
Get the grid pointsl.
getLayerRoundZ(self, layerIndex)
Get the plane angle around z that the layer is rotated by.
getNextGripXStep(self, gridXStep)
Get the next grid x step, increment by an extra one every three if hexagonal grid is chosen.
isGridToBeExtruded(self)
Determine if the grid is to be extruded.
isPointInsideLineSegments(self, gridPoint)
Is the point inside the line segments of the loops.
linearMove(self, splitLine)
Add a linear move to the thread.
parseInitialization(self)
Parse gcode initialization and store the parameters.
parseLine(self, lineIndex)
Parse a gcode line and add it to the fill skein.
setGridVariables(self, fillRepository)
Set the grid variables.

 
class RotatedLayer
    A rotated layer.
 
  Methods defined here:
__init__(self, z)
__repr__(self)
Get the string representation of this RotatedLayer.

 
class YIntersectionPath
    A class to hold the y intersection position, the loop which it intersected and the point index of the loop which it intersected.
 
  Methods defined here:
__init__(self, pathIndex, pointIndex, y)
Initialize from the path, point index, and y.
__repr__(self)
Get the string representation of this y intersection.
getPath(self, paths)
Get the path from the paths and path index.
getPointIndexPlusOne(self)
Get the point index plus one.

 
Functions
       
addAroundGridPoint(arounds, gridPoint, gridPointInsetX, gridPointInsetY, gridPoints, gridSearchRadius, isBothOrNone, isDoubleJunction, isJunctionWide, paths, pixelTable, width)
Add the path around the grid point.
addPath(extrusionWidth, infillPaths, path, rotationPlaneAngle)
Add simplified path to fill.
addPointOnPath(path, pixelTable, point, pointIndex, width)
Add a point to a path and the pixel table.
addShortenedLineSegment(lineSegment, shortenDistance, shortenedSegments)
Add shortened line segment.
addSparseEndpoints(doubleExtrusionWidth, endpoints, fillLine, horizontalSegmentLists, infillSolidity, removedEndpoints, solidSurfaceThickness, surroundingXIntersections)
Add sparse endpoints.
addSparseEndpointsFromSegment(doubleExtrusionWidth, endpoints, fillLine, horizontalSegmentLists, infillSolidity, removedEndpoints, segment, solidSurfaceThickness, surroundingXIntersections)
Add sparse endpoints from a segment.
addYIntersectionPathToList(pathIndex, pointIndex, y, yIntersection, yIntersectionPaths)
Add the y intersection path to the y intersection paths.
compareDistanceFromCenter(self, other)
Get comparison in order to sort y intersections in ascending order of distance from the center.
comparePointIndexDescending(self, other)
Get comparison in order to sort y intersections in descending order of point index.
createExtraFillLoops(radius, surroundingLoop)
Create extra fill loops.
createFillForSurroundings(radius, surroundingLoops)
Create extra fill loops for surrounding loops.
getAdditionalLength(path, point, pointIndex)
Get the additional length added by inserting a point into a path.
getClosestOppositeIntersectionPaths(yIntersectionPaths)
Get the close to center paths, starting with the first and an additional opposite if it exists.
getCraftedText(fileName, text='', fillRepository=None)
Fill the inset file or text.
getCraftedTextFromText(gcodeText, fillRepository=None)
Fill the inset text.self.
getExtraFillLoops(insideLoops, outsideLoop, radius)
Get extra loops between inside and outside loops.
getIntersectionOfXIntersectionIndexes(totalSolidSurfaceThickness, xIntersectionIndexList)
Get x intersections from surrounding layers.
getNonIntersectingGridPointLine(gridPointInsetX, isJunctionWide, paths, pixelTable, yIntersectionPath, width)
Get the points around the grid point that is junction wide that do not intersect.
getPlusMinusSign(number)
Get one if the number is zero or positive else negative one.
getRepositoryConstructor()
Get the repository constructor.
getWithLeastLength(path, point)
Insert a point into a path, at the index at which the path would be shortest.
getYIntersection(firstPoint, secondPoint, x)
Get where the line crosses x.
getYIntersectionIfExists(complexFirst, complexSecond, x)
Get the y intersection if it exists.
getYIntersectionInsideYSegment(segmentFirstY, segmentSecondY, complexFirst, complexSecond, x)
Get the y intersection inside the y segment if it does, else none.
insertGridPointPair(gridPoint, gridPointInsetX, gridPoints, isJunctionWide, paths, pixelTable, yIntersectionPath, width)
Insert a pair of points around the grid point is is junction wide, otherwise inset one point.
insertGridPointPairWithLinePath(gridPoint, gridPointInsetX, gridPoints, isJunctionWide, linePath, paths, pixelTable, yIntersectionPath, width)
Insert a pair of points around the grid point is is junction wide, otherwise inset one point.
insertGridPointPairs(gridPoint, gridPointInsetX, gridPoints, intersectionPathFirst, intersectionPathSecond, isBothOrNone, isJunctionWide, paths, pixelTable, width)
Insert a pair of points around a pair of grid points.
isAddedPointOnPathFree(path, pixelTable, point, pointIndex, width)
Determine if the point added to a path is intersecting the pixel table.
isIntersectingLoopsPaths(loops, paths, pointBegin, pointEnd)
Determine if the segment between the first and second point is intersecting the loop list.
isPathAlwaysInsideLoop(loop, path)
Determine if all points of a path are inside another loop.
isPathAlwaysOutsideLoops(loops, path)
Determine if all points in a path are outside another loop in a list.
isPerimeterPathInSurroundLoops(surroundingLoops)
Determine if there is a perimeter path in the surrounding loops.
isPointAddedAroundClosest(aroundPixelTable, layerExtrusionWidth, paths, removedEndpointPoint, width)
Add the closest removed endpoint to the path, with minimal twisting.
isSegmentAround(aroundSegments, segment)
Determine if there is another segment around.
isSegmentCompletelyInAnIntersection(segment, xIntersections)
Add sparse endpoints from a segment.
isSegmentInX(segment, xFirst, xSecond)
Determine if the segment overlaps within x.
isSharpCorner(beginComplex, centerComplex, endComplex)
Determine if the three complex points form a sharp corner.
isSidePointAdded(aroundPixelTable, closestPath, closestPointIndex, layerExtrusionWidth, removedEndpointPoint, width)
Add side point along with the closest removed endpoint to the path, with minimal twisting.
main()
Display the fill dialog.
removeEndpoints(aroundPixelTable, layerExtrusionWidth, paths, removedEndpoints, aroundWidth)
Remove endpoints which are added to the path.
setIsOutside(yCloseToCenterPath, yIntersectionPaths)
Determine if the yCloseToCenterPath is outside.
writeOutput(fileName='')
Fill an inset gcode file.

 
Data
        __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/28/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)