# Python: module skeinforge_tools.inset

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

`Inset is a script to inset the carvings of an svg file.
Inset insets the svg slices into gcode extrusion layers. The 'Extrusion Perimeter Width over Thickness' ratio is the ratio of the
extrusion perimeter width over the layer thickness. The higher the value the more the perimeter will be inset, the default is 1.8.
The 'Infill Perimeter Overlap' ratio is the amount the infill overlaps the perimeter over the extrusion width. The higher the value the
more the infill will overlap the perimeter, and the thicker join between the infill and the perimeter. If the value is too high, the join will
be so thick that the nozzle will run plow through the join below making a mess, the default is 0.05. There are two choices for the
infill perimeter overlap method of calculation. If the 'Calculate Overlap from Perimeter and Infill' option is chosen, the overlap will be
calculated from the average of the perimeter width and the infill width, this is the default choice. If the 'Calculate Overlap from
Perimeter Only' option is chosen, the overlap will be calculated from the perimeter width only.
If the "Start at Home" preference is selected, the G28 gcode will be added at the beginning of the file, the default is off
When inset is generating the code, if there is a file start.txt, it will add that to the very beginning of the gcode. After it has added some
initialization code and just before it adds the extrusion gcode, it will add the file endofthebeginning.txt if it exists. At the very end, it will
add the file end.txt if it exists. Carve does not care if the text file names are capitalized, but some file systems do not handle file name
cases properly, so to be on the safe side you should give them lower case names. It will first look for the file in the same directory as
inset, if it does not find it it will look in ~/.skeinforge/gcode_scripts.
The following examples inset 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.stl and inset.py.
> python inset.py
This brings up the dialog, after clicking 'Inset', the following is printed:
File Screw Holder Bottom.stl is being chain insetted.
The insetted file is saved as Screw Holder Bottom_inset.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 inset
>>> inset.main()
File Screw Holder Bottom.stl is being insetted.
The insetted file is saved as Screw Holder Bottom_inset.gcode
It took 3 seconds to inset the file.
>>> inset.writeOutput()
File Screw Holder Bottom.stl is being insetted.
The insetted file is saved as Screw Holder Bottom_inset.gcode
It took 3 seconds to inset the file.`

Modules

``

__init__ skeinforge_tools.analyze cStringIO skeinforge_tools.carve | skeinforge_tools.skeinforge_utilities.euclidean skeinforge_tools.skeinforge_utilities.gcodec skeinforge_tools.skeinforge_utilities.intercircle skeinforge_tools.skeinforge_utilities.interpret | math os skeinforge_tools.polyfile skeinforge_tools.skeinforge_utilities.preferences | sys time

Classes

``

InsetPreferences
InsetSkein

class InsetPreferences
`` | `A class to handle the inset preferences.`

Methods defined here:

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

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

class InsetSkein
`` | `A class to inset a skein of extrusions.`

Methods defined here:

__init__(self)

addFromUpperLowerFile(self, fileName)
  `Add lines of text from the fileName or the lowercase fileName, if there is no file by the original fileName in the directory.`

addGcodeFromPerimeterPaths(self, isIntersectingSelf, loop, loopLists, radius, z)
  `Add the perimeter paths to the output.`

addGcodeFromRemainingLoop(self, loop, loopLists, radius, z)
  `Add the remainder of the loop which does not overlap the alreadyFilledArounds loops.`

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

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

addInitializationToOutput(self)
  `Add initialization gcode to the output.`

addInset(self, rotatedBoundaryLayer)
  `Add inset to the carve layer.`

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

addPathData(self, line)
  `Add the data from the path line.`

addRotatedLoopLayer(self, z)
  `Add rotated loop layer.`

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

addTextData(self, line)
  `Add the data from the text line.`

getExtrudateLoops(self, halfWidth, loop)
  `Get the inset extrudate loops from the loop.`

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

parseGcode(self, insetPreferences, gcodeText)
  `Parse gcode text and store the bevel gcode.`

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

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

Functions

``

addAlreadyFilledArounds(alreadyFilledArounds, loop, radius)
  `Add already filled loops around loop to alreadyFilledArounds.`

addSegmentOutline(isThick, outlines, pointBegin, pointEnd, width)
  `Add a diamond or hexagonal outline for a line segment.`

getInsetChainGcode(fileName, gcodeText, insetPreferences=None)
  `Inset the carves of a gcode text. Chain inset the gcode if it is not already carved.`

getInsetGcode(gcodeText, insetPreferences=None)
  `Inset the carves of a gcode text.`

getSegmentsFromPoints(aroundLists, loopLists, pointBegin, pointEnd)
  `Get endpoint segments from the beginning and end of a line segment.`

isCloseToLast(paths, point, radius)
  `Determine if the point is close to the last point of the last path.`

isIntersectingItself(loop, width)
  `Determine if the loop is intersecting itself.`

isIntersectingWithinList(loop, loopList)
  `Determine if the loop is intersecting or is within the loop list.`

isIntersectingWithinLists(loop, loopLists)
  `Determine if the loop is intersecting or is within the loop lists.`

isSegmentInsideAround(aroundLists, segment)
  `Determine if the segment is inside an around.`

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

writeOutput(fileName='')
  `Inset the carves of a gcode file. Chain carve the file if it is a GNU TriangulatedSurface file. If no fileName is specified, inset the first unmodified gcode file in this folder.`

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)