# Python: module skeinforge_application.skeinforge_plugins.analyze_plugins.vectorwrite

skeinforge_application.skeinforge_plugins.analyze_plugins.vectorwrite ($Date: 2008/21/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/analyze_plugins/vectorwrite.py

Previous / Next / Contents

`
Vectorwrite is a very interesting analyze plugin that will create an SVG vector image for each layer that you can then use in some other printing system.
The Scalable Vector Graphics file can be opened by an SVG viewer or an SVG capable browser like Mozilla:
http://www.mozilla.com/firefox/
The vectorwrite manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Vectorwrite
Operation
Settings
Add Loops
Add Paths
Add Perimeters
Layers
Layers From
Layers To
SVG Viewer
Examples
`

## Operation

The default 'Activate Vectorwrite' checkbox is off. When it is on, the functions described below will work when called from the skeinforge toolchain, when it is off, the functions will not be called from the toolchain. The functions will still be called, whether or not the 'Activate Vectorwrite' checkbox is on, when vectorwrite is run directly.

## Settings

### Add Loops

Default is on.
If 'Add Loops' is selected, the loops will be added in yellow to the the scalable vector graphics output.

### Add Paths

Default is on.
If 'Add Paths' is selected, the paths will be added in pink to the the scalable vector graphics output.

### Add Perimeters

Default is on.
If 'Add Perimeters' is selected, the edges will be added to the the scalable vector graphics output. The outer edges will be red and the inner edges will be orange.

### Layers

#### Layers From

Default is zero.
The "Layers From" is the index of the bottom layer that will be displayed. If the layer from is the default zero, the display will start from the lowest layer. If the the layer from index is negative, then the display will start from the layer from index below the top layer.

#### Layers To

Default is a huge number, which will be limited to the highest index layer.
The "Layers To" is the index of the top layer that will be displayed. If the layer to index is a huge number like the default, the display will go to the top of the model, at least until we model habitats:) If the layer to index is negative, then the display will go to the layer to index below the top layer. The layer from until layer to index is a python slice.

### SVG Viewer

Default is webbrowser.
If the 'SVG Viewer' is set to the default 'webbrowser', the scalable vector graphics file will be sent to the default browser to be opened. If the 'SVG Viewer' is set to a program name, the scalable vector graphics file will be sent to that program to be opened.

## Examples

Below are examples of vectorwrite being used. These examples are run in a terminal in the folder which contains Screw Holder_penultimate.gcode and vectorwrite.py.
> python vectorwrite.py
This brings up the vectorwrite dialog.
> python vectorwrite.py Screw Holder_penultimate.gcode
The vectorwrite file is saved as Screw_Holder_penultimate_vectorwrite.svg

Previous / Next / Contents

Modules

``

__init__ fabmetheus_utilities.archive cStringIO | fabmetheus_utilities.euclidean fabmetheus_utilities.gcodec os | fabmetheus_utilities.settings skeinforge_application.skeinforge_utilities.skeinforge_polyfile skeinforge_application.skeinforge_utilities.skeinforge_profile | fabmetheus_utilities.svg_writer sys time

Classes

``

fabmetheus_utilities.svg_writer.SVGWriter
  SVGWriterVectorwrite
ThreadLayer
VectorwriteRepository
VectorwriteSkein

class SVGWriterVectorwrite(fabmetheus_utilities.svg_writer.SVGWriter)
`` | `A class to vectorwrite a carving.`

Methods defined here:

addLoopLayerToOutput(self, layerIndex, threadLayer)
  `Add rotated boundary layer to the output.`

addPaths(self, colorName, paths, transformString)
  `Add paths to the output.`

Methods inherited from fabmetheus_utilities.svg_writer.SVGWriter:

__init__(self, addLayerTemplateToSVG, cornerMaximum, cornerMinimum, decimalPlacesCarried, layerHeight, edgeWidth=None)
  `Initialize.`

addLayerBegin(self, layerIndex, loopLayer)
  `Add the start lines for the layer.`

addLoopLayersToOutput(self, loopLayers)
  `Add rotated boundary layers to the output.`

addOriginalAsComment(self, elementNode)
  `Add original elementNode as a comment.`

getReplacedSVGTemplate(self, fileName, loopLayers, procedureName, elementNode=None)
  `Get the lines of text from the layer_template.svg 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.`

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

getSVGStringForLoops(self, loops)
  `Get the svg loops string.`

getSVGStringForPath(self, path)
  `Get the svg path string.`

getTransformString(self)
  `Get the svg transform string.`

setDimensionTexts(self, key, valueString)
  `Set the texts to the valueString followed by mm.`

setMetadataNoscriptElement(self, key, prefix, value)
  `Set the metadata value and the text.`

setTexts(self, key, valueString)
  `Set the texts to the valueString.`

class ThreadLayer
`` | `Threads with a z.`

Methods defined here:

__init__(self, z)

__repr__(self)
  `Get the string representation of this loop layer.`

getTotalNumberOfThreads(self)
  `Get the total number of loops, paths and edges.`

maximize(self, vector3)
  `Maximize the vector3 over the loops, paths and edges.`

minimize(self, vector3)
  `Minimize the vector3 over the loops, paths and edges.`

class VectorwriteRepository
`` | `A class to handle the vectorwrite settings.`

Methods defined here:

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

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

class VectorwriteSkein
`` | `A class to vectorwrite a carving.`

Methods defined here:

__init__(self)
  `Initialize.`

addLoopLayer(self, z)
  `Add loop layer.`

addToLoops(self)
  `Add the thread to the loops.`

addToPerimeters(self)
  `Add the thread to the edges.`

getCarveLayerHeight(self)
  `Get the layer height.`

getCarvedSVG(self, fileName, gcodeText, repository)
  `Parse gnu triangulated surface text and store the vectorwrite gcode.`

linearMove(self, splitLine)
  `Get statistics for a linear move.`

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

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

removeEmptyLayers(self)
  `Remove empty layers.`

Functions

``

getNewRepository()
  `Get new repository.`

getWindowAnalyzeFile(fileName)
  `Write scalable vector graphics for a gcode file.`

getWindowAnalyzeFileGivenText(fileName, gcodeText, repository=None)
  `Write scalable vector graphics for a gcode file given the settings.`

main()
  `Display the vectorwrite dialog.`

writeOutput(fileName, fileNamePenultimate, fileNameSuffix, filePenultimateWritten, gcodeText='')
  `Write scalable vector graphics for a skeinforge gcode file, if activate vectorwrite is selected.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __credits__ = 'Nophead <http://hydraraptor.blogspot.com/>' __date__ = '$Date: 2008/21/04 $' __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)

Credits
`` |  | Nophead <http://hydraraptor.blogspot.com/>