# Python: module skeinforge_tools.analyze_plugins.statistic

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

`Statistic is a script to generate statistics a gcode file.
The default 'Activate Statistic' 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 Statistic' checkbox is on, when statistic is run directly.
When the 'Print Statistics' checkbox is on, the statistics will be printed to the console, the default is on. When the 'Save
Statistics' checkbox is on, the statistics will be save as a .txt file, the default is off.
To run statistic, in a shell in the folder which statistic is in type:
> python statistic.py
An explanation of the gcodes is at:
http://reprap.org/bin/view/Main/Arduino_GCode_Interpreter
and at:
http://reprap.org/bin/view/Main/MCodeReference
A gode example is at:
http://forums.reprap.org/file.php?12,file=565
This example generates statistics the gcode file Screw Holder_comb.gcode. This example is run in a terminal in the folder which contains
Screw Holder_comb.gcode and statistic.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 statistic
>>> statistic.main()
This brings up the statistic dialog.
>>> statistic.statisticFile()
The statistics file is saved as Screw Holder_comb_statistic.gcode`

Modules

``

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

Classes

``

StatisticPreferences
StatisticSkein

class StatisticPreferences
`` | `A class to handle the statistics preferences.`

Methods defined here:

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

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

class StatisticSkein
`` | `A class to get statistics for a gcode skein.`

Methods defined here:

__init__(self)

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

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

extruderSet(self, active)
  `Maybe increment the number of times the extruder was toggled.`

getLocationSetFeedrateToSplitLine(self, splitLine)

helicalMove(self, isCounterclockwise, splitLine)
  `Get statistics for a helical move.`

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

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

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

Functions

``

getStatisticGcode(gcodeText)
  `Get statistics for a gcode text.`

main()
  `Display the statistics dialog.`

statisticFile(fileName='')
  `Write statistics for a gcode file. If no fileName is specified, write statistics for the first gcode file in this folder that is not modified.`

writeOutput(fileName, gcodeText='')
  `Write statistics for a skeinforge gcode file, if 'Write Statistics File for Skeinforge Chain' is selected.`

writeStatisticFileGivenText(fileName, gcodeText, statisticPreferences)
  `Write statistics for a gcode file.`

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)