# Python: module skeinforge_tools.carve

skeinforge_tools.carve ($Date: 2008/02/05 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/carve.py

`Carve shape is a script to carve a list of slice layers.
Carve carves a list of slices into svg slice layers. The 'Layer Thickness' is the thickness the extrusion layer at default extruder speed,
this is the most important carve preference. The 'Extrusion Width over Thickness' is the ratio of the extrusion width over the layer
thickness, the default is 1.5. A ratio of one means the extrusion is a circle, a typical ratio of 1.5 means the extrusion is a wide oval.
These values should be measured from a test extrusion line.
Rarely changed preferences are 'Import Coarseness', 'Mesh Type', 'Infill Bridge Width Over Thickness', 'Infill in Direction of Bridges' &
'Layer Thickness over Precision'. When a triangle mesh has holes in it, the triangle mesh slicer switches over to a slow algorithm that
spans gaps in the mesh. The higher the import coarseness, the wider the gaps in the mesh it will span. An import coarseness of one
means it will span gaps the width of the extrusion. When the Mesh Type preference is Correct Mesh, the mesh will be accurately
carved, and if a hole is found, carve will switch over to the algorithm that spans gaps. If the Mesh Type preference is Unproven
Mesh, carve will use the gap spanning algorithm from the start. The problem with the gap spanning algothm is that it will span gaps,
even if there actually is a gap in the model. Infill bridge width over thickness ratio is the ratio of the extrusion width over the layer
thickness on a bridge layer. If the infill in direction of bridges preference is chosen, the infill will be in the direction of bridges across
gaps, so that the fill will be able to span a bridge easier. The 'Layer Thickness over Precision' is the ratio of the layer thickness over
the smallest change in value. The higher the layer thickness over precision, the more significant figures the output numbers will have,
the default is ten.
To run carve, in a shell type:
> python carve.py
The following examples carve the GNU Triangulated Surface file Screw Holder Bottom.stl. The examples are run in a terminal in the
folder which contains Screw Holder Bottom.stl and carve.py. The preferences can be set in the dialog or by changing the preferences file
'carve.csv' with a text editor or a spreadsheet program set to separate tabs.
> python carve.py
This brings up the dialog, after clicking 'Carve', the following is printed:
File Screw Holder Bottom.stl is being carved.
The carved file is saved as Screw Holder Bottom_carve.svg
>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 carve
>>> carve.main()
File Screw Holder Bottom.stl is being carved.
The carved file is saved as Screw Holder Bottom_carve.svg
It took 3 seconds to carve the file.
>>> carve.writeOutput()
File Screw Holder Bottom.gcode is being carved.
The carved file is saved as Screw Holder Bottom_carve.svg
It took 3 seconds to carve the file.
>>> carve.getCarveGcode("
54 162 108 Number of Vertices,Number of Edges,Number of Faces
-5.800000000000001 5.341893939393939 4.017841892579603 Vertex Coordinates XYZ
5.800000000000001 5.341893939393939 4.017841892579603
..
many lines of GNU Triangulated Surface vertices, edges and faces
..
")`

Modules

``

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

Classes

``

CarvePreferences
CarveSkein

class CarvePreferences
`` | `A class to handle the carve preferences.`

Methods defined here:

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

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

class CarveSkein
`` | `A class to carve a GNU Triangulated Surface.`

Methods defined here:

__init__(self)

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

addLayerStart(self, layerIndex, z)
  `Add the start lines for the layer.`

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

addLines(self, lines)
  `Add lines of text to the output.`

addRotatedLoopLayerToOutput(self, layerIndex, rotatedBoundaryLayer)
  `Add rotated boundary layer to the output.`

addRotatedLoopLayersToOutput(self, rotatedBoundaryLayers)
  `Add rotated boundary layers to the output.`

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

getReplacedSVGTemplateLines(self, fileName, rotatedBoundaryLayers)
  `Get the lines of text from the svg_template.txt file.`

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

getRoundedComplexString(self, point)
  `Get the rounded complex string.`

getSVGLoopString(self, loop)
  `Get the svg loop string.`

parseCarving(self, carvePreferences, carving, fileName)
  `Parse gnu triangulated surface text and store the carved gcode.`

setExtrusionDiameterWidth(self, carvePreferences)
  `Set the extrusion diameter & width and the bridge thickness & width.`

Functions

``

getCarveGcode(fileName, carvePreferences=None)
  `Carve a shape file.`

getCarving(fileName)
  `Get a carving for the file using an import plugin.`

getParameterFromJavascript(lines, parameterName, parameterValue)
  `Get a paramater from lines of javascript.`

getReplacedInQuotes(original, replacement, text)
  `Replace what follows in quotes after the word.`

getReplacedTagString(replacementTagString, tagID, text)
  `Get text with the tag string replaced.`

getReplacedWordAndInQuotes(original, replacement, text)
  `Replace the word in the text and replace what follows in quotes after the word.`

main()
  `Display the carve dialog.`

writeOutput(fileName='')
  `Carve a GNU Triangulated Surface file. If no fileName is specified, carve the first GNU Triangulated Surface file in this folder.`

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