# Python: module skeinforge_tools.raft

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

`Raft is a script to create a reusable raft, elevate the nozzle and set the temperature.
The default 'Activate Raft' checkbox is on. When it is on, the functions described below will work, when it is off, the
functions will not be called. The raft script sets the temperature. If the "Activate Raft, Elevate Nozzle, Orbit and Set
Altitude" checkbox is checked, the script will also create a raft, elevate the nozzle, orbit and set the altitude of the bottom
of the raft.
Raft is based on the Nophead's reusable raft, which has a base layer running one way, and a couple of perpendicular layers
above. Each set of layers can be set to a different temperature. There is the option of having the extruder orbit the raft for a
while, so the heater barrel has time to reach a different temperature, without ooze accumulating around the nozzle. To run
raft, in a shell type:
> python raft.py
The important values for the raft preferences are the temperatures of the raft, the first layer and the next layers. These will be
different for each material. The default preferences for ABS, HDPE, PCL & PLA are extrapolated from Nophead's
experiments. To change the material, in a shell type:
> python material.py
This brings up the material preferences dialog. In that dialog you can add or delete a material on the listbox and you change
the selected material. After you can change the selected material, run raft again. If there are preferences for the new material,
those will be in the raft dialog. If there are no preferences for the new material, the preferences will be set to defaults and you
will have to set new preferences for the new material.
The "Base Infill Density" preference is the infill density ratio of the base of the raft, the default ratio is half. The "Base Layer
Height over Layer Thickness" preference is the ratio of the height & width of the base layer compared to the height and width
of the shape infill, the default is two. The feedrate will be slower for raft layers which have thicker extrusions than the shape
infill. The "Base Layers" preference is the number of base layers, the default is one. The "Base Nozzle Lift over Half Base
Layer Thickness" is the amount the nozzle is above the center of the extrusion divided by half the base layer thickness.
The interface of the raft has equivalent preferences called "Interface Infill Density", "Interface Layer Thickness over Extrusion
Height", "Interface Layers" and "Interface Nozzle Lift over Half Base Layer Thickness". The shape has the equivalent
preference of called "Operating Nozzle Lift over Half Layer Thickness".
The altitude that the bottom of the raft will be set to the "Bottom Altitude" preference.
The raft fills a rectangle whose size is the rectangle around the bottom layer of the shape expanded on each side by the
"Raft Outset Radius over Extrusion Width" preference times the extrusion width, minus the "Infill Overhang" ratio times the
width of the extrusion of the raft.
In the "Support Material Choice" radio button group, if "No Support Material" is selected then raft will not add support
material, this is the default because the raft takes time to generate. If "Support Material Everywhere" is selected, support
material will be added wherever there are overhangs, even inside the object; because support material inside objects is hard
or impossible to remove, this option should only be chosen if the shape has a cavity that needs support and there is some
way to extract the support material. If "Support Material on Exterior Only" is selected, support material will be added only
the exterior of the object; this is the best option for most objects which require support material. The "Support Minimum
Angle" preference is the minimum angle that a surface overhangs before support material is added, the default is sixty
degrees. The "Support Inset over Perimeter Extrusion Width" is the amount that the support material is inset into the object
over the perimeter extrusion width, the default is zero.
The extruder will orbit for at least "Temperature Change Time Before Raft" seconds before extruding the raft. It will orbit for
at least "Temperature Change Time Before First Layer Outline" seconds before extruding the outline of the first layer of the
shape. It will orbit for at least "Temperature Change Time Before Next Threads" seconds before extruding within the outline
of the first layer of the shape and before extruding the next layers of the shape. It will orbit for at least "Temperature
Change Time Before Support Layers" seconds before extruding the support layers. It will orbit for at least "Temperature
Change Time Before Supported Layers" seconds before extruding the layer of the shape above the support layer. If a time
is zero, it will not orbit.
The "Temperature of Raft" preference sets the temperature of the raft. The "Temperature of Shape First Layer Outline"
preference sets the temperature of the outline of the first layer of the shape. The "Temperature of Shape First Layer Within"
preference sets the temperature within the outline of the first layer of the shape. The "Temperature of Shape Next Layers"
preference sets the temperature of the next layers of the shape. The "Temperature of Support Layers" preference sets the
temperature of the support layer. The "Temperature of Supported Layers" preference sets the temperature of the layer of the
shape above the support layer.
The following examples raft 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 raft.py. The raft function will raft if "Activate Raft, Elevate Nozzle,
Orbit and Set Altitude" is true, which can be set in the dialog or by changing the preferences file 'raft.csv' with a text editor or a
spreadsheet program set to separate tabs. The functions writeOutput and getRaftChainGcode check to see if the text has
been rafted, if not they call getSpeedChainGcode in speed.py to get speeded gcode; once they have the speeded text, then
they raft. Pictures of rafting in action are available from the Metalab blog at:
http://reprap.soup.io/?search=rafting
> python raft.py
This brings up the dialog, after clicking 'Raft', the following is printed:
File Screw Holder Bottom.stl is being chain rafted.
The rafted file is saved as Screw Holder Bottom_raft.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 raft
>>> raft.main()
This brings up the raft dialog.
>>> raft.writeOutput()
Screw Holder Bottom.stl
File Screw Holder Bottom.stl is being chain rafted.
The rafted file is saved as Screw Holder Bottom_raft.gcode
>>> raft.getRaftGcode("
( GCode generated by May 8, 2008 carve.py )
( Extruder Initialization )
..
many lines of gcode
..
")
>>> raft.getRaftChainGcode("
( 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 skeinforge_tools.material | math skeinforge_tools.polyfile skeinforge_tools.skeinforge_utilities.preferences skeinforge_tools.speed | sys time

Classes

``

RaftPreferences
RaftSkein

class RaftPreferences
`` | `A class to handle the raft preferences.`

Methods defined here:

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

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

class RaftSkein
`` | `A class to raft a skein of extrusions.`

Methods defined here:

__init__(self)

addBaseLayer(self, baseExtrusionWidth, baseStep, stepBegin, stepEnd)
  `Add a base layer.`

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

addGcodeFromFeedrateThreadZ(self, feedrateMinute, thread, z)
  `Add a thread to the output.`

addInterfaceLayer(self)
  `Add an interface layer.`

addLayerFromSegments(self, feedrateMinute, layerLayerThickness, segments, z)
  `Add a layer from segments and raise the extrusion top.`

addLayerLine(self, z)
  `Add the layer gcode line and close the last layer gcode block.`

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

addRaft(self)

addSupportLayerTemperature(self, supportSegments, z)
  `Add support layer and temperature before the object layer.`

addSupportSegmentTable(self, layerIndex)
  `Add support segments from the boundary layers.`

addTemperature(self, temperature)
  `Add a line of temperature.`

addTemperatureOrbits(self, segments, temperaturePreference, temperatureTimeChangePreference, z)
  `Add the temperature and orbits around the support layer.`

addToFillXIntersectionIndexTables(self, fillXIntersectionIndexTables, layerIndex)
  `Add fill segments from the boundary layers.`

extendSegments(self, supportSegmentTable)
  `Extend the support segments.`

getBoundaryLine(self, splitLine)
  `Get elevated boundary gcode line.`

getGcodeFromFeedrateMovementZ(self, feedrateMinute, point, z)
  `Get a gcode movement.`

getRaftedLine(self, splitLine)
  `Get elevated gcode line with operating feedrate.`

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

getStepsUntilEnd(self, begin, end, stepSize)
  `Get steps from the beginning until the end.`

getSupportSegments(self)
  `Get the support layer segments.`

joinSegments(self, supportSegmentTableIndex)
  `Join the support segments of this layer with those of the layer above.`

parseGcode(self, gcodeText, raftPreferences)
  `Parse gcode text and store the raft gcode.`

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

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

setBoundaryLayers(self)
  `Set the boundary layers.`

setCornersZ(self)
  `Set maximum and minimum corners and z.`

setInterfaceVariables(self, interfaceExtrusionWidth, stepBegin, stepEnd)
  `Set the interface variables.`

subtractJoinedFill(self, fillXIntersectionIndexTables, supportSegmentTableIndex)
  `Join the fill then subtract it from the support layer table.`

truncateSupportSegmentTables(self)
  `Truncate the support segments after the last support segment which contains elements.`

Functions

``

addXIntersectionsFromSegment(index, segment, xIntersectionIndexList)
  `Add the x intersections from the segment.`

addXIntersectionsFromSegments(index, segments, xIntersectionIndexList)
  `Add the x intersections from the segments.`

getEndpointsFromSegments(segments)
  `Get the endpoints from the segments.`

getExtendedLineSegment(extensionDistance, lineSegment)
  `Add shortened line segment.`

getFillXIntersectionIndexes(fillLoops, y)
  `Get fill x intersection indexes inside loops.`

getHorizontalSegments(fillLoops, alreadyFilledArounds, y)
  `Get horizontal segments inside loops.`

getJoinOfXIntersectionIndexes(xIntersectionIndexList)
  `Get x intersections from surrounding layers.`

getRaftChainGcode(fileName, gcodeText, raftPreferences=None)
  `Raft a gcode linear move text. Chain raft the gcode if it is not already rafted.`

getRaftGcode(gcodeText, raftPreferences=None)
  `Raft a gcode linear move text.`

getSquareLoop(beginComplex, endComplex)
  `Get a square loop from the beginning to the end and back.`

joinSegmentTables(fromTable, intoTable)
  `Join both segment tables and put the join into the intoTable.`

main()
  `Display the raft dialog.`

subtractFill(fillXIntersectionIndexTable, supportSegmentLayerTable)
  `Subtract fill from the support layer table.`

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