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

Skeinview is a script to display each layer of a gcode file.

Skeinview is derived from Nophead's preview script. The extruded lines are in the resistor colors red, orange, yellow, green, blue, purple & brown. When the extruder is off, the travel line is grey. Skeinview is useful for a detailed view of the extrusion, behold is better to see the orientation of the shape. To get an initial overview of the skein, when the skeinview display window appears, click the Soar button.

The default 'Activate Skeinview' 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 Skeinview' checkbox is on, when skeinview is run directly. Skeinview has trouble separating the layers when it reads gcode without comments.

If "Draw Arrows" is selected, arrows will be drawn at the end of each line segment, the default is on. If "Go Around Extruder Off Travel" is selected, the display will include the travel when the extruder is off, which means it will include the nozzle wipe path if any. The "Pixels over Extrusion Width" preference is the scale of the image, the higher the number, the greater the size of the display. The "Screen Horizontal Inset" determines how much the display will be inset in the horizontal direction from the edge of screen, the higher the number the more it will be inset and the smaller it will be, the default is one hundred. The "Screen Vertical Inset" determines how much the display will be inset in the vertical direction from the edge of screen, the default is fifty. The "Slide Show Rate" determines how fast the layer index changes when soar or dive is operating.

When the export menu item in the file menu is clicked, the canvas will be saved as a postscript file. If the 'Export Postscript Program' is set to a program name, the postscript file will be sent to that program to be opened. The default is gimp, the Gnu Image Manipulation Program (Gimp), which is open source, can open postscript and save in a variety of formats. It is available at:
http://www.gimp.org/

If the 'Export File Extension' is set to a file extension, the postscript file will be sent to the program, along with the file extension for the converted output. The default is blank because some systems do not have an image conversion program; if you have or will install an image conversion program, a common 'Export File Extension' is png. A good open source conversion program is Image Magick, which is available at:
http://www.imagemagick.org/script/index.php

On the skeinview display window, the Up button increases the layer index shown by one, and the Down button decreases the layer index by one. When the index displayed in the index field is changed then "<return>" is hit, the layer index shown will be set to the index field, to a mimimum of zero and to a maximum of the highest index layer. The Soar button increases the layer index at the "Slide Show Rate", and the Dive button decreases the layer index at the slide show rate. When the mouse is clicked, the line closest to the mouse pointer will be printed in the console. If 'Display Line Text when Mouse Moves' is selected, then the line closest to the mouse pointer will be displayed above the mouse pointer.

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 displays a skein view for the gcode file Screw Holder.gcode. This example is run in a terminal in the folder which contains Screw Holder.gcode and skeinview.py.


> python skeinview.py
This brings up the skeinview dialog.


> python skeinview.py Screw Holder.gcode
This brings up a skein window to view each layer of a gcode file.


> 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 skeinview
>>> skeinview.main()
This brings up the skeinview dialog.


>>> skeinview.displayFile()
This brings up a skein window to view each layer of a gcode file.

 
Modules
       
__init__
skeinforge_tools.analyze_plugins.analyze_utilities.display_line
skeinforge_tools.skeinforge_utilities.euclidean
skeinforge_tools.skeinforge_utilities.gcodec
math
os
skeinforge_tools.meta_plugins.polyfile
skeinforge_tools.skeinforge_utilities.preferences
sys
skeinforge_tools.analyze_plugins.analyze_utilities.tableau
skeinforge_tools.analyze_plugins.analyze_utilities.viewpoint_move

 
Classes
       
skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauRepository
SkeinviewPreferences
skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauWindow
SkeinWindow
ColoredIndexLine
SkeinviewSkein

 
class ColoredIndexLine
    A colored index line.
 
  Methods defined here:
__init__(self, colorName, complexBegin, complexEnd, line, lineIndex, width)
Set the color name and corners.
__repr__(self)
Get the string representation of this colored index line.

 
class SkeinWindow(skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauWindow)
     Methods defined here:
__init__(self, skein, tableauRepository)
addHorizontalRulerRuling(self, xMillimeters)
Add a ruling to the horizontal ruler.
addVerticalRulerRuling(self, yMillimeters)
Add a ruling to the vertical ruler.
cancelTimer(self)
Cancel the timer and set it to none.
cancelTimerResetButtons(self)
Cancel the timer and set it to none.
createRulers(self)
Create the rulers..
dive(self)
Dive, go up periodically.
diveCycle(self)
Start the dive cycle.
down(self)
Go down a layer.
getRoundedRulingText(self, number)
Get the rounded ruling text.
getRulingSeparationWidthPixels(self, rank)
Get the separation width in pixels.
getSlideShowDelay(self)
Get the slide show delay in milliseconds.
indexEntryReturnPressed(self, event)
The index entry return was pressed.
limitIndex(self)
Limit the index so it is not below zero or above the top.
phoenixUpdate(self)
Update, and deiconify a new window and destroy the old.
relayXview(self, *args)
Relay xview changes.
relayYview(self, *args)
Relay yview changes.
resetPeriodicButtonsText(self)
Reset the text of the periodic buttons.
soar(self)
Soar, go up periodically.
soarCycle(self)
Start the soar cycle.
up(self)
Go up a layer.
update(self)
Update the window.
zoomIn(self)
Zoom in.

Methods inherited from skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauWindow:
button1(self, event)
The button was clicked.
buttonRelease1(self, event)
The button was released.
centerUpdateSetWindowGeometryShowPreferences(self, center)
Center the scroll region, update, set the window geometry, and show the preferences.
destroyAllDialogWindows(self)
Destroy all the dialog windows.
export(self)
Export the canvas as a postscript file.
getScrollPaneCenter(self)
Get the center of the scroll pane.
motion(self, event)
The mouse moved.
save(self)
Set the preference values to the display, save the new values.
saveUpdate(self)
Save and update.
setMenuPanesPreferencesRootSkein(self, skein, suffix, tableauRepository)
Set the menu bar, skein panes, tableau preferences, root and skein.
setMouseTool(self)
Set the mouse tool.
setMouseToolBindButtonMotion(self)
Set the mouse tool and bind button one clicked, button one released and motion.
shiftButtonRelease1(self, event)
The button was released while the shift key was pressed.
shiftMotion(self, event)
The mouse moved.
updateDeiconify(self, center=(0.5+0.5j))
Update and deiconify the window.

 
class SkeinviewPreferences(skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauRepository)
    A class to handle the skeinview preferences.
 
  Methods defined here:
__init__(self)
Set the default preferences, execute title & preferences fileName.
execute(self)
Write button has been clicked.

Methods inherited from skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauRepository:
setToDisplaySave(self, event=None)
Set the preference values to the display, save the new values.
setToDisplaySavePhoenixUpdate(self, event=None)
Set the preference values to the display, save the new values, then call the update function.
setToDisplaySaveUpdate(self, event=None)
Set the preference values to the display, save the new values, then call the update function.

 
class SkeinviewSkein
    A class to write a get a scalable vector graphics text for a gcode skein.
 
  Methods defined here:
__init__(self)
addToPath(self, line, location)
Add a point to travel and maybe extrusion.
getScreenCoordinates(self, pointComplex)
Get the screen coordinates.self.cornerImaginaryTotal - self.marginCornerLow
initializeActiveLocation(self)
Set variables to default.
isLayerStart(self, firstWord, splitLine)
Parse a gcode line and add it to the vector output.
linearCorner(self, splitLine)
Update the bounding corners.
linearMove(self, line, splitLine)
Get statistics for a linear move.
parseCorner(self, line)
Parse a gcode line and use the location to update the bounding corners.
parseGcode(self, fileName, gcodeText, skeinviewPreferences)
Parse gcode text and store the vector output.
parseLine(self, line)
Parse a gcode line and add it to the vector output.

 
Functions
       
displayFile(fileName)
Display a gcode file in a skeinview window.
displayFileGivenText(fileName, gcodeText, skeinviewPreferences=None)
Display a gcode file in a skeinview window given the text.
getGeometricDifference(first, second)
Get the geometric difference of the two numbers.
getRankIndex(rulingSeparationWidthMillimeters, screenOrdinate)
Get rank index.
getRepositoryConstructor()
Get the repository constructor.
getRulingSeparationWidthMillimeters(rank)
Get the separation width in millimeters.
getWindowGivenTextPreferences(fileName, gcodeText, skeinviewPreferences)
Display a gcode file in a skeinview window given the text and preferences.
main()
Display the skeinview dialog.
writeOutput(fileName, gcodeText='')
Display a skeinviewed gcode file for a skeinforge gcode file, if 'Activate Skeinview' is selected.

 
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)