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

`Behold is an analysis script to display a gcode file in an isometric view.
The default 'Activate Behold' 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 Behold' checkbox is on, when behold is run directly. Behold can not separate the layers when it reads
gcode without comments.
The viewer is simple, the viewpoint can only be moved in a sphere around the center of the model by changing the viewpoint
latitude and longitude. Different regions of the model can be hidden by setting the width of the thread to zero. The alternating
bands act as contour bands and their brightness and width can be changed. The layers will be displayed starting at the "Layer
From" index up until the "Layer To" index. All of the preferences can be set in the initial "Behold Preferences" window and
some can be changed after the viewer is running in the "Behold Dynamic Preferences" window. In the viewer, dragging the
mouse will change the viewpoint.
The "Band Height" is height of the band in layers, with the default of five, a pair of bands is ten layers high. The "Bottom Band
Brightness" is the ratio of the brightness of the bottom band over the brightness of the top band, the default is 0.7. The "Bottom
Layer Brightness" is the ratio of the brightness of the bottom layer over the brightness of the top layer, the default is 1.0. With a
low bottom layer brightness ratio the bottom of the model will be darker than the top of the model, as if it was being illuminated
by a light just above the top. The "Bright Band Start" button group determines where the bright band starts from. If the "From
the Bottom" choice is selected, the bright bands will start from the bottom. If the default "From the Top" choice is selected, the
bright bands will start from the top.
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 "Layer 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. The "Layer To" is the index of the top layer that will be displayed. If the layer to index is a huge number like the
default 999999999, 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.
The "Number of Fill Bottom Layers" is the number of layers at the bottom which will be colored olive. The "Number of Fill Bottom
Layers" is the number of layers at the top which will be colored blue.
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 "Viewpoint Latitude" is the latitude of the viewpoint, the default is 15 degrees. The "Viewpoint Longitude" is the longitude of
the viewpoint, the default is 210 degrees. The viewpoint can also be moved by dragging the mouse. The viewpoint latitude will
be increased when the mouse is dragged from the center towards the edge. The viewpoint longitude will be changed by the
amount around the center the mouse is dragged. This is not very intuitive, but I don't know how to do this the intuitive way and
I have other stuff to develop. If the shift key is pressed; if the latitude is changed more than the longitude, only the latitude will
be changed, if the longitude is changed more only the longitude will be changed.
The "Width of Extrusion Thread" sets the width of the green extrusion threads, those threads which are not loops and not part of
the raft. The default is one, if the width is zero the extrusion threads will be invisible. The "Width of Fill Bottom Thread" sets
the width of the olive extrusion threads at the bottom of the model, the default is three. The "Width of Fill Top Thread" sets the
width of the blue extrusion threads at the top of the model, the default is three. The "Width of Loop Thread" sets the width of the
yellow loop threads, which are not perimeters, the default is three. The "Width of Perimeter Inside Thread" sets the width of the
orange inside perimeter threads, the default is three. The "Width of Perimeter Outside Thread" sets the width of the red outside
perimeter threads, the default is three. The "Width of Raft Thread" sets the width of the brown raft threads, the default is one.
The "Width of Travel Thread" sets the width of the gray extruder off travel threads, the default is zero.
The "Width of X Axis" preference sets the width of the dark orange X Axis, the default is five pixels. The "Width of Y Axis" sets
the width of the gold Y Axis, the default is five. The "Width of Z Axis" sets the width of the sky blue Z Axis, the default is five.
To run behold, in a shell in the folder which behold is in type:
> python behold.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 lets the viewer behold the gcode file Screw Holder.gcode. This example is run in a terminal in the folder which
contains Screw Holder.gcode and behold.py.
> python behold.py
This brings up the behold dialog.
> python behold.py Screw Holder.gcode
This brings up the behold dialog to view the 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 behold
>>> behold.main()
This brings up the behold dialog.
>>> behold.beholdFile()
This brings up the behold window to view the gcode file.`

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

Classes
`` |  | BeholdPreferences BeholdSkein ColoredLine LatitudeLongitude SkeinPane SkeinWindow ViewVectors
class BeholdPreferences
`` | `A class to handle the behold preferences.`
| Methods defined here: __init__(self) `Set the default preferences, execute title & preferences fileName.` displayImmediateUpdateDialog(self) `Display the immediate update dialog.` execute(self) `Write button has been clicked.` setToDisplaySaveUpdate(self, event=None) `Set the preference values to the display, save the new values, then call the update function.` setUpdateFunction(self, updateFunction) `Set the update function of the update preferences.`
class BeholdSkein
`` | `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.` getLayerTop(self) `Get the layer top.` getLayerZoneIndex(self, z) `Get the layer zone index.` 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.` moveColoredThreadToSkeinPane(self) `Move a colored thread to the skein pane.` parseCorner(self, line) `Parse a gcode line and use the location to update the bounding corners.` parseGcode(self, gcodeText, beholdPreferences) `Parse gcode text and store the vector output.` parseLine(self, line) `Parse a gcode line and add it to the vector output.` setColoredLineColor(self, coloredLine, colorTuple) `Set the color and stipple of the colored line.` setColoredThread(self, colorTuple, lineList) `Set the colored thread, then move it to the line list and stipple of the colored line.`
class ColoredLine
`` | `A colored line.`
| Methods defined here: __init__(self, begin, colorName, end, tagString) `Set the color name and corners.` __repr__(self) `Get the string representation of this colored line.`
class LatitudeLongitude
`` | `A latitude and longitude.`
| Methods defined here: __init__(self, newCoordinate, skeinWindow, shift) `Set the latitude and longitude.`
class SkeinPane
`` | `A class to hold the colored lines for a layer.`
| Methods defined here: __init__(self, sequenceIndex) `Create empty line lists.`
class SkeinWindow
`` |  | Methods defined here: __init__(self, beholdPreferences, size, skeinPanes) `Initialize the skein window.` buttonOneClicked(self, event) `Print the line that was clicked on by the left button.` buttonOneReleased(self, event, shift=False) `Move the viewpoint if the mouse was released.` buttonOneReleasedShift(self, event) `Move the viewpoint if the mouse was released and the shift key was pressed.` drawColoredLine(self, coloredLine, viewVectors, width) `Draw colored line.` drawColoredLineMotion(self, coloredLine, viewVectors, width) `Draw colored line with motion stipple and tag.` drawColoredLines(self, coloredLines, viewVectors, width) `Draw colored lines.` drawSkeinPane(self, skeinPane, viewVectors) `Draw colored lines.` drawXYAxisLines(self, viewVectors) `Draw the x and y axis lines.` drawZAxisLine(self, viewVectors) `Draw the z axis line.` getCentered(self, coordinate) `Get the centered coordinate.` getCenteredScreened(self, coordinate) `Get the normalized centered coordinate.` getScreenComplex(self, pointComplex) `Get the point in screen perspective.` getViewComplex(self, point, viewVectors) `Get the point in view perspective.` leave(self, event) `Null the button one pressed coordinate because the mouse has left the canvas.` motion(self, event, shift=False) `Move the viewpoint if the mouse was moved.` motionShift(self, event) `Move the viewpoint if the mouse was moved and the shift key was pressed.` printHexadecimalColorName(self, name) `Print the color name in hexadecimal.` update(self) `Update the screen.`
class ViewVectors
`` |  | Methods defined here: __init__(self, viewpointLatitude, viewpointLongitude) `Initialize the view vectors.`

Functions
`` |  | beholdFile(fileName='') `Behold a gcode file. If no fileName is specified, behold the first gcode file in this folder that is not modified.` compareLayerSequence(first, second) `Get comparison in order to sort skein panes in ascending order of layer zone index then sequence index.` displayBeholdFileGivenText(gcodeText, beholdPreferences=None) `Display a beholded gcode file for a gcode file.` getBoundedLatitude(latitude) `Get the bounded latitude.later get rounded` getPolygonComplexFromColoredLines(coloredLines) `Get a complex polygon from the colored lines.` getTwoHex(number) `Get the first two hexadecimal digits.` main() `Display the behold dialog.` writeOutput(fileName, gcodeText='') `Write a beholded gcode file for a skeinforge gcode file, if 'Activate Behold' 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)