# Python: module skeinforge_tools.analyze_plugins.vectorwrite

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

`Vectorwrite is a script to write Scalable Vector Graphics for a gcode file.
The default 'Activate Vectorwrite' checkbox is on. 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.
The 'Pixels over Extrusion Width' preference is the scale of the graphic in pixels per extrusion width. If the number of layers is
equal or greater to the 'Minimum Number of Layers for Multiple Files' preference, then vectorwrite will write a directory with a
file for each layer, rather than just a single large scalable vector graphic.
To run vectorwrite, in a shell in the folder which vectorwrite is in type:
> python vectorwrite.py
The Scalable Vector Graphics file can be opened by an SVG viewer or an SVG capable browser like Mozilla:
http://www.mozilla.com/firefox/
This example writes vector graphics for the gcode file Screw Holder.gcode. This example is run in a terminal in the folder which
contains Screw Holder.gcode and vectorwrite.py.
> 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 vectorwrite
>>> vectorwrite.main()
This brings up the vectorwrite dialog.
>>> vectorwrite.vectorwriteFile()
The vector file is saved as Screw Holder.svg`

Modules

``

__init__ cStringIO skeinforge_tools.skeinforge_utilities.euclidean | skeinforge_tools.skeinforge_utilities.gcodec math os | skeinforge_tools.polyfile skeinforge_tools.skeinforge_utilities.preferences sys |

Classes

``

VectorWindow
VectorwritePreferences
VectorwriteSkein

class VectorWindow
`` | `A class to accumulate a scalable vector graphics text.`

Methods defined here:

__init__(self)

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

addColoredLine(self, pointFirst, pointSecond, colorName)
  `Add a colored line to the text.`

addFontHeight(self, fontSize)
  `Add quadruple the font size to the height.`

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

addPane(self)
  `Add a new window pane for drawing lines.`

addText(self, fontSize, line)
  `Add a colored line to the text.`

getHeightWidthString(self)
  `Get the height and width string.`

getVectorFormattedText(self)
  `Get the text in scalable vector graphics format.`

setPaneCorners(self, bottomLeftCorner, topRightCorner)
  `Set the corners for the window pane.`

class VectorwritePreferences
`` | `A class to handle the vectorwrite preferences.`

Methods defined here:

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

class VectorwriteSkein
`` | `A class to write a get a scalable vector graphics text for a gcode skein.`

Methods defined here:

__init__(self)

addToPath(self, location, nextLine)
  `Add a point to travel and maybe extrusion.`

addVectorWindow(self)
  `Add a new vector window to vector windows.`

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

getFilenameWriteFiles(self, fileName)
  `Write one or multiple files for the fileName.`

getHypertextLinkBasename(self, baseUnderscoredPrefix, vectorWindowIndex)
  `Get hypertext link basename for a numbered vector window.`

getLinkBasename(self, baseUnderscoredPrefix, vectorWindowIndex)
  `Get link basename for a numbered vector window.`

getSuffixFilename(self, baseUnderscoredPrefix, multipleDirectoryName, vectorWindowIndex)
  `Get suffix fileName for a numbered vector window.`

initializeActiveLocation(self)
  `Set variables to default.`

linearCorner(self, splitLine)
  `Update the bounding corners.`

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

parseCorner(self, line)
  `Parse a gcode line and use the location to update the bounding corners.`

parseGcode(self, gcodeText, vectorwritePreferences)
  `Parse gcode text and store the vector output.`

parseLine(self, line, nextLine)
  `Parse a gcode line and add it to the vector output.`

writeIndexText(self, baseUnderscoredPrefix, indexFilename, indexName, multipleDirectoryName, suffixFilenames)
  `Write the text for the index page.`

writeVectorWindowText(self, baseUnderscoredPrefix, multipleDirectoryName, suffixFilenames, vectorWindowIndex)
  `Write the text for a vector window page.`

Functions

``

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

writeOutput(fileName, gcodeText='')
  `Write scalable vector graphics for a skeinforge gcode file, if 'Write Scalable Vector Graphics for Skeinforge Chain' is selected.`

writeVectorFile(fileName='')
  `Write scalable vector graphics for a gcode file. If no fileName is specified, write scalable vector graphics for the first gcode file in this folder.`

writeVectorFileGivenText(fileName, gcodeText, vectorwritePreferences)
  `Write scalable vector graphics for a gcode file.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __credits__ = 'Nophead <http://hydraraptor.blogspot.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)

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