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

Previous / Next / Contents


Behold is an analysis script to display a gcode file in an isometric view.

The behold manual page is at:
http://www.bitsfrombytes.com/wiki/index.php?title=Skeinforge_Behold


Operation
Settings
  Animation
    Animation Line Quickening
    Animation Slide Show Rate
  Axis Rulings
  Banding
    Band Height
    Bottom Band Brightness
    Bottom Layer Brightness
    Bright Band Start
      From the Bottom
      From the Top
  Draw Arrows
  Export Menu
  Go Around Extruder Off Travel
  Layers
    Layer
    Layer Extra Span
  Line
  Mouse Mode
    Display Line
    Viewpoint Move
    Viewpoint Rotate
  Number of Fill Bottom Layers
  Number of Fill Top Layers
  Scale
  Screen Inset
    Screen Horizontal Inset
    Screen Vertical Inset
  Viewpoint Latitude
  Viewpoint Longitude
  Width
    Width of Axis Negative Side
    Width of Axis Positive Side
    Width of Infill Thread
    Width of Fill Bottom Thread
    Width of Fill Top Thread
    Width of Loop Thread
    Width of Perimeter Inside Thread
    Width of Perimeter Outside Thread
    Width of Raft Thread
    Width of Selection Thread
    Width of Travel Thread
Icons
Gcodes
Examples

Operation


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 "Layers From" index up until the "Layers To" index. All of the settings can be set in the initial "Behold Settings" window and some can be changed after the viewer is running in the "Behold Dynamic Settings" window. In the viewer, dragging the mouse will change the viewpoint.

Settings


Animation

Animation Line Quickening

Default is one.

The quickness of the tool animation over the quickness of the actual tool.

Animation Slide Show Rate

Default is two layers per second.

The rate, in layers per second, at which the layer changes when the soar or dive button is pressed..

Axis Rulings

Default is on.

When selected, rulings will be drawn on the axis lines.

Banding

Band Height

Default is five layers.

Defines the height of the band in layers, a pair of bands is twice that height.

Bottom Band Brightness

Default is 0.7.

Defines the ratio of the brightness of the bottom band over the brightness of the top band. The higher it is the brighter the bottom band will be.

Bottom Layer Brightness

Default is one.

Defines the ratio of the brightness of the bottom layer over the brightness of the top layer. 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.

Bright Band Start

Default choice is 'From the Top'.

The button group that determines where the bright band starts from.

From the Bottom

When selected, the bright bands will start from the bottom.

From the Top

When selected, the bright bands will start from the top.

Draw Arrows

Default is on.

When selected, arrows will be drawn at the end of each line segment.

Export Menu


When the submenu in the export menu item in the file menu is clicked, an export canvas dialog will be displayed, which can export the canvas to a file.

Go Around Extruder Off Travel

Default is off.

When selected, the display will include the travel when the extruder is off, which means it will include the nozzle wipe path if any.

Layers

Layer

Default is zero.

On the display window, the Up button increases the 'Layer' by one, and the Down button decreases the layer by one. When the layer displayed in the layer spin box is changed then <Return> is hit, the layer shown will be set to the spin box, to a mimimum of zero and to a maximum of the highest index layer.The Soar button increases the layer at the 'Animation Slide Show Rate', and the Dive (double left arrow button beside the layer field) button decreases the layer at the slide show rate.

Layer Extra Span

Default is a huge number.

The viewer will draw the layers in the range including the 'Layer' index and the 'Layer' index plus the 'Layer Extra Span'. If the 'Layer Extra Span' is negative, the layers viewed will start at the 'Layer' index, plus the 'Layer Extra Span', and go up to and include the 'Layer' index. If the 'Layer Extra Span' is zero, only the 'Layer' index layer will be displayed. If the 'Layer Extra Span' is positive, the layers viewed will start at the 'Layer' index, and go up to and include the 'Layer' index plus the 'Layer Extra Span'.

Line

Default is zero.

The index of the selected line on the layer that is highlighted when the 'Display Line' mouse tool is chosen. The line spin box up button increases the 'Line' by one. If the line index of the layer goes over the index of the last line, the layer index will be increased by one and the new line index will be zero. The down button decreases the line index by one. If the line index goes below the index of the first line, the layer index will be decreased by one and the new line index will be at the last line. When the line displayed in the line field is changed then <Return> is hit, the line shown will be set to the line field, to a mimimum of zero and to a maximum of the highest index line. The Soar button increases the line at the speed at which the extruder would move, times the 'Animation Line Quickening' ratio, and the Dive (double left arrow button beside the line field) button decreases the line at the animation line quickening ratio.

Mouse Mode

Default is 'Display Line'.

The mouse tool can be changed from the 'Mouse Mode' menu button or picture button. The mouse tools listen to the arrow keys when the canvas has the focus. Clicking in the canvas gives the canvas the focus, and when the canvas has the focus a thick black border is drawn around the canvas.

Display Line

The 'Display Line' tool will display the highlight the selected line, and display the file line count, counting from one, and the gcode line itself. When the 'Display Line' tool is active, clicking the canvas will select the nearest line to the mouse click.

Viewpoint Move

The 'Viewpoint Move' tool will move the viewpoint in the xy plane when the mouse is clicked and dragged on the canvas.

Viewpoint Rotate

The 'Viewpoint Rotate' tool will rotate the viewpoint around the origin, when the mouse is clicked and dragged on the canvas, or the arrow keys have been used and <Return> is pressed. 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.

Number of Fill Bottom Layers

Default is one.

The "Number of Fill Bottom Layers" is the number of layers at the bottom which will be colored olive.

Number of Fill Top Layers

Default is one.

The "Number of Fill Top Layers" is the number of layers at the top which will be colored blue.

Scale

Default is ten.

The scale setting is the scale of the image in pixels per millimeter, the higher the number, the greater the size of the display.

The zoom in mouse tool will zoom in the display at the point where the mouse was clicked, increasing the scale by a factor of two. The zoom out tool will zoom out the display at the point where the mouse was clicked, decreasing the scale by a factor of two.

Screen Inset

Screen Horizontal Inset

Default is one hundred.

The "Screen Horizontal Inset" determines how much the canvas 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.

Screen Vertical Inset

Default is two hundred.

The "Screen Vertical Inset" determines how much the canvas will be inset in the vertical direction from the edge of screen, the higher the number the more it will be inset and the smaller it will be..

Viewpoint Latitude

Default is fifteen degrees.

The "Viewpoint Latitude" is the latitude of the viewpoint, a latitude of zero is the top pole giving a top view, a latitude of ninety gives a side view and a latitude of 180 gives a bottom view.

Viewpoint Longitude

Default is 210 degrees.

The "Viewpoint Longitude" is the longitude of the viewpoint.

Width

The width of each type of thread and of each axis can be changed. If the width is set to zero, the thread will not be visible.

Width of Axis Negative Side

Default is two.

Defines the width of the negative side of the axis.

Width of Axis Positive Side

Default is six.

Defines the width of the positive side of the axis.

Width of Infill Thread

Default is one.

The "Width of Infill Thread" sets the width of the green extrusion threads, those threads which are not loops and not part of the raft.

Width of Fill Bottom Thread

Default is three.

The "Width of Fill Bottom Thread" sets the width of the olive extrusion threads at the bottom of the model.

Width of Fill Top Thread

Default is three.

The "Width of Fill Top Thread" sets the width of the blue extrusion threads at the top of the model.

Width of Loop Thread

Default is three.

The "Width of Loop Thread" sets the width of the yellow loop threads, which are not perimeters.

Width of Perimeter Inside Thread

Default is eight.

The "Width of Perimeter Inside Thread" sets the width of the orange inside perimeter threads.

Width of Perimeter Outside Thread

Default is eight.

The "Width of Perimeter Outside Thread" sets the width of the red outside perimeter threads.

Width of Raft Thread

Default is one.

The "Width of Raft Thread" sets the width of the brown raft threads.

Width of Selection Thread

Default is six.

The "Width of Selection Thread" sets the width of the selected line.

Width of Travel Thread

Default is zero.

The "Width of Travel Thread" sets the width of the grey extruder off travel threads.

Icons


The dive, soar and zoom icons are from Mark James' soarSilk icon set 1.3 at:
http://www.famfamfam.com/lab/icons/silk/

Gcodes


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

Examples


Below are examples of behold being used. These examples are run in a terminal in the folder which contains Screw Holder_penultimate.gcode and behold.py.


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


> python behold.py Screw Holder_penultimate.gcode
This brings up the behold viewer 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.analyzeFile( 'Screw Holder_penultimate.gcode' )
This brings up the behold viewer to view the gcode file.


Previous / Next / Contents


 
Modules
       
__init__
skeinforge_tools.analyze_plugins.analyze_utilities.display_line
skeinforge_tools.skeinforge_utilities.euclidean
skeinforge_tools.skeinforge_utilities.gcodec
math
skeinforge_tools.meta_plugins.polyfile
skeinforge_tools.skeinforge_utilities.settings
sys
skeinforge_tools.analyze_plugins.analyze_utilities.tableau
skeinforge_tools.analyze_plugins.analyze_utilities.view_move
skeinforge_tools.analyze_plugins.analyze_utilities.view_rotate

 
Classes
       
skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauRepository
BeholdRepository
skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauWindow
SkeinWindow
BeholdSkein
Ruling
SkeinPane

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

Methods inherited from skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauRepository:
addAnimation(self)
Add the animation settings.
addScaleScreenSlide(self)
Add the scale, screen and slide show settings.
setToDisplaySave(self, event=None)
Set the setting values to the display, save the new values.

 
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, location)
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, fileName, gcodeText, repository)
Parse gcode text and store the vector output.
parseInitialization(self)
Parse gcode initialization and store the parameters.
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 Ruling
     Methods defined here:
__init__(self, modelDistance, roundedRulingText)
Initialize the ruling.

 
class SkeinPane
    A class to hold the colored lines for a layer.
 
  Methods defined here:
__init__(self, sequenceIndex)
Create empty line lists.

 
class SkeinWindow(skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauWindow)
     Methods defined here:
__init__(self, repository, skein)
Initialize the skein window.
drawRuling(self, relativeRulingEnd, ruling, tags, viewBegin, viewEnd, viewVectors)
Draw ruling.
drawRulings(self, axisLine, rulings, viewVectors)
Draw rulings for the axis line.
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.
getCanvasRadius(self)
Get half of the minimum of the canvas height and width.
getCentered(self, coordinate)
Get the centered coordinate.
getCenteredScreened(self, coordinate)
Get the normalized centered coordinate.
getColoredLines(self)
Get the colored lines from the skein pane.
getCopy(self)
Get a copy of this window.
getCopyWithNewSkein(self)
Get a copy of this window with a new skein.
getDrawnColoredLine(self, arrowType, coloredLine, tags, viewVectors, width)
Draw colored line.
getDrawnColoredLineMotion(self, coloredLine, viewVectors, width)
Draw colored line with motion stipple and tag.
getDrawnColoredLineWithoutArrow(self, coloredLine, tags, viewVectors, width)
Draw colored line without an arrow.
getDrawnColoredLines(self, coloredLines, viewVectors, width)
Draw colored lines.
getDrawnSelectedColoredLine(self, coloredLine)
Get the drawn selected colored line.
getScreenComplex(self, pointComplex)
Get the point in screen perspective.
getViewComplex(self, point, viewVectors)
Get the point in view perspective.
printHexadecimalColorName(self, name)
Print the color name in hexadecimal.
update(self)
Update the screen.

Methods inherited from skeinforge_tools.analyze_plugins.analyze_utilities.tableau.TableauWindow:
activateMouseModeTool(self)
Activate the mouse mode tool.
addCanvasMenuRootScrollSkein(self, repository, skein, suffix, title)
Add the canvas, menu bar, scroll bar, skein panes, tableau repository, root and skein.
addLayer(self, gridPosition)
Add the layer frame items.
addLine(self, gridPosition)
Add the line frame items.
addMouseInstantTool(self, fileName, gridPosition, mouseInstantTool)
Add the mouse instant tool and derived photo button.
addMouseToolsBind(self)
Add the mouse tool and bind button one clicked, button one released and motion.
addPhotoImage(self, fileName, gridPosition)
Get a PhotoImage button, grid the button and increment the grid position.
addScale(self, gridPosition)
Add the line frame items.
addSettingsMenuSetWindowGeometry(self, center)
Add the settings menu, center the scroll region, update, and set the window geometry.
button1(self, event)
The button was clicked.
buttonRelease1(self, event)
The button was released.
cancelTimer(self, event=None)
Cancel the timer and set it to none.
cancelTimerResetButtons(self)
Cancel the timer and set it to none.
close(self, event=None)
The dialog was closed.
createMouseModeTool(self)
Create the mouse mode tool.
destroyAllDialogWindows(self)
Destroy all the dialog windows.
destroyMouseToolRaiseMouseButtons(self)
Destroy the mouse tool and raise the mouse buttons.
dive(self)
Dive, go down periodically.
diveCycle(self)
Start the dive cycle.
getAnimationLineDelay(self, coloredLine)
Get the animation line delay in milliseconds.
getDrawnLineText(self, location, tags, text)
Get the line text drawn on the canvas.
getEntityFromName(self, name)
Get the entity of the given name.
getPhotoButtonGridIncrement(self, commandFunction, fileName, gridPosition)
Get a PhotoImage button, grid the button and increment the grid position.
getRoundedRulingText(self, extraDecimalPlaces, number)
Get the rounded ruling text.
getRulingSeparationWidthPixels(self, rank)
Get the separation width in pixels.
getScrollPaneCenter(self)
Get the center of the scroll pane.
getScrollPaneFraction(self)
Get the center of the scroll pane.
getSlideShowDelay(self)
Get the slide show delay in milliseconds.
getUpdateSkeinPanes(self)
Get the update skein panes.
isLineBelowZeroSetLayer(self)
Determine if the line index is below zero, and if so set the layer index.
isLineBeyondListSetLayer(self)
Determine if the line index is beyond the end of the list, and if so set the layer index.
keyPressDown(self, event)
The down arrow was pressed.
keyPressLeft(self, event)
The left arrow was pressed.
keyPressReturn(self, event)
The return key was pressed.
keyPressRight(self, event)
The right arrow was pressed.
keyPressUp(self, event)
The up arrow was pressed.
layerEntryReturnPressed(self, event=None)
The layer index entry return was pressed.
limitIndex(self)
Limit the index so it is not below zero or above the top.
limitIndexSetArrowMouseDeleteCanvas(self)
Limit the index, set the arrow type, and delete all the canvas items.
lineDive(self)
Line dive, go down periodically.
lineDiveCycle(self)
Start the line dive cycle.
lineEntryReturnPressed(self, event=None)
The line index entry return was pressed.
lineSoar(self)
Line soar, go up periodically.
lineSoarCycle(self)
Start the line soar cycle.
motion(self, event)
The mouse moved.
phoenixUpdate(self)
Update the skein, and deiconify a new window and destroy the old.
redisplayWindowUpdate(self, event=None)
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.
save(self)
Set the setting values to the display, save the new values.
scaleEntryReturnPressed(self, event=None)
The scale entry return was pressed.
setButtonImageText(self, button, text)
Set the text of the e periodic buttons.
setDisplayLayerIndex(self)
Set the display of the layer index entry field and buttons.
setInsetToDisplay(self)
Set the archive to the display.
setLayerIndex(self, layerIndex)
Set the layer index.
setLineButtonsState(self)
Set the state of the line buttons.
setWindowNewMouseTool(self, getNewMouseToolFunction, mouseTool)
Set the getNewMouseTool function and the update function.
setWindowToDisplaySavePhoenixUpdate(self, event=None)
Set the setting values to the display, save the new values, then call the update function.
setWindowToDisplaySaveUpdate(self, event=None)
Set the setting values to the display, save the new values, then call the update function.
shiftButtonRelease1(self, event)
The button was released while the shift key was pressed.
shiftMotion(self, event)
The mouse moved.
soar(self)
Soar, go up periodically.
soarCycle(self)
Start the soar cycle.
updateDeiconify(self, center=(0.5+0.5j))
Update and deiconify the window.
updateMouseToolIfSelection(self)
Update the mouse tool if it is a selection tool.
updateNewDestroyOld(self, scrollPaneCenter)
Update and deiconify a window and destroy the old.

 
Functions
       
analyzeFile(fileName)
Behold a gcode file.
analyzeFileGivenText(fileName, gcodeText, repository=None)
Display a beholded gcode file for a gcode file.
compareLayerSequence(first, second)
Get comparison in order to sort skein panes in ascending order of layer zone index then sequence index.
getNewRepository()
Get the repository constructor.
getWindowGivenTextRepository(fileName, gcodeText, repository)
Display the gcode text in a behold viewer.
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)