# Python: module skeinforge_application.skeinforge_plugins.analyze_plugins.skeinlayer

skeinforge_application.skeinforge_plugins.analyze_plugins.skeinlayer ($Date: 2008/21/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/skeinforge_application/skeinforge_plugins/analyze_plugins/skeinlayer.py

Previous / Next / Contents

`
Skeinlayer is an analyze viewer to display each layer of a gcode file.
The skeinlayer manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Skeinlayer
Skeinlayer 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. Skeinlayer is useful for a detailed view of the extrusion, skeiniso is better to see the orientation of the shape. To get an initial overview of the skein, when the skeinlayer display window appears, click the Soar button (double right arrow button beside the layer field).
Operation
Settings
Animation
Animation Line Quickening
Animation Slide Show Rate
Draw Arrows
Export Menu
Go Around Extruder Off Travel
Layers
Layer
Layer Extra Span
Line
Mouse Mode
Display Line
Viewpoint Move
Numeric Pointer
Scale
Screen Inset
Screen Horizontal Inset
Screen Vertical Inset
Width
Width of Extrusion Thread
Width of Selection Thread
Width of Travel Thread
Icons
Gcodes
Examples
`

## Operation

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

## 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..

### 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 zero.
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 closest 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.

### Numeric Pointer

Default is on.
When selected, the distance along the ruler of the arrow pointers will be drawn next to the pointers.

### 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 and twenty.
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.

### 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 Extrusion Thread

Default is three.
The "Width of Extrusion Thread" sets the width of the extrusion 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 one.
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 skeinlayer being used. These examples are run in a terminal in the folder which contains Screw Holder_penultimate.gcode and skeinlayer.py.
> python skeinlayer.py
This brings up the skeinlayer dialog.
> python skeinlayer.py Screw Holder_penultimate.gcode
This brings up the skeinlayer viewer to view each layer of a gcode file.

Previous / Next / Contents

Modules

``

__init__
fabmetheus_utilities.archive
skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.display_line

fabmetheus_utilities.euclidean
fabmetheus_utilities.gcodec
os

fabmetheus_utilities.settings
skeinforge_application.skeinforge_utilities.skeinforge_polyfile
skeinforge_application.skeinforge_utilities.skeinforge_profile

sys
skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.tableau
skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.view_move

Classes

``

skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.tableau.TableauRepository
  SkeinlayerRepository
skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.tableau.TableauWindow
  SkeinWindow
SkeinlayerSkein

class SkeinWindow(skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.tableau.TableauWindow)

``

Methods defined here:

__init__(self, repository, skein)
  `Initialize the skein window.setWindowNewMouseTool`

addHorizontalRulerRuling(self, xMillimeters)
  `Add a ruling to the horizontal ruler.`

addVerticalRulerRuling(self, yMillimeters)
  `Add a ruling to the vertical ruler.`

createHorizontalLine(self, begin, yPixel)
  `Create a horizontal line for the horizontal ruler.`

createRulers(self)
  `Create the rulers..`

createVerticalLine(self, begin, xPixel)
  `Create a vertical line for the horizontal ruler.`

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, coloredLine, tags, width)
  `Get the drawn colored line.`

getDrawnColoredLineIfThick(self, coloredLine, width)
  `Get the drawn colored line if it has a positive thickness.`

getDrawnSelectedColoredLine(self, coloredLine)
  `Get the drawn selected colored line.`

motion(self, event)
  `The mouse moved.`

qqqmotion(self, event)
  `The mouse moved.`

relayXview(self, *args)
  `Relay xview changes.`

relayYview(self, *args)
  `Relay yview changes.`

update(self)
  `Update the window.`

Methods inherited from skeinforge_application.skeinforge_plugins.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.`

cancel(self, event=None)
  `Set all entities to their saved state.`

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 scroll pane top left.`

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.`

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.`

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.`

setInsetToCanvas(self, event=None)
  `Set the repository insets to the canvas.`

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.`

class SkeinlayerRepository(skeinforge_application.skeinforge_plugins.analyze_plugins.analyze_utilities.tableau.TableauRepository)
`` | `A class to handle the skeinlayer 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_application.skeinforge_plugins.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 SkeinlayerSkein
`` | `A class to write a get a scalable vector graphics text for a gcode skein.`

Methods defined here:

__init__(self)
  `Initialize.`

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

getModelCoordinates(self, screenCoordinates)
  `Get the model coordinates.`

getScreenCoordinates(self, pointComplex)
  `Get the screen coordinates.`

initializeActiveLocation(self)
  `Set variables to default.`

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

linearMove(self, line, location)
  `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, 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.`

Functions

``

getNewRepository()
  `Get new repository.`

getRankIndex(rulingSeparationWidthMillimeters, screenOrdinate)
  `Get rank index.`

getWindowAnalyzeFile(fileName)
  `Display a gcode file in a skeinlayer window.`

getWindowAnalyzeFileGivenText(fileName, gcodeText, repository=None)
  `Display a gcode file in a skeinlayer window given the text.`

getWindowGivenTextRepository(fileName, gcodeText, repository)
  `Display a gcode file in a skeinlayer window given the text and settings.`

main()
  `Display the skeinlayer dialog.`

writeOutput(fileName, fileNamePenultimate, fileNameSuffix, filePenultimateWritten, gcodeText='')
  `Display a skeinlayered gcode file for a skeinforge gcode file, if 'Activate Skeinlayer' is selected.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __date__ = '$Date: 2008/21/04 $' __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)