Difference between revisions of "Tsp sld"

From ShapeOko
Jump to: navigation, search
Line 1: Line 1:
[[File:Shapeoko_tsp.png|center|thumb|750px|Single Line Drawing of Shapeoko]]
[[File:Shapeoko_tsp.png|center|thumb|400px|Single Line Drawing of Shapeoko]]

Revision as of 16:21, 20 June 2012

Single Line Drawing of Shapeoko

Single line drawings are exactly that. An entire drawing comprised of a single line. If done by hand, you would place the pencil onto your drawing surface and never lift the tip from the media. Think of how an etch-a-sketch works and you'll immediately know how the images are created.

Luckily for the non-artistic types at least, you don't need to be skilled in drawing to generate the paths.


Download the following software and files:

Getting Started

Processing Library Folder Location in win7 x64

Once everything is downloaded. You need to move some things around.

  • Move the controlP5 library (unzipped) to your processing/libraries folder
  • Move the Toxic Libs library (unzipped) to your processing/libraries folder

Load the StippleGen2 Sketch in Processing

  • Open Processing
  • Click File
  • Click Open
  • Browse to where you saved StippleGen2
  • Select the StippleGen_2.pde sketch and click open
  • Once the sketch is loaded, click the 'Run' button in the top left.
  • If all goes well, your sketch will load, looking like this
  • Once loaded, the sketch will begin immediately processing the default image.
  • First you'll see a bunch of lines, resembling a spider web (representing a Voronoi Diagram)
  • After the Voronoi Diagram is complete, the image will turn into a Stippled image.
  • You'll notice this Stippled Image changing as it goes through generations
StippleGen2.pdf sketch code
StippleGen2.pde GUI
Stippled Image of Shapeoko

Generate the SVG

StippleGen2 Control Panel
Optimizing TSP path

Although watching Stippled Images being generated is somewhat mesmerizing, you'll probably bore after a while. When you do, load up one of your own images. The sketch will accept .png, .jpg, and .gif files. The control panel for the sketch is located at the bottom of the window.

  • To load your file, click "LOAD IMAGE FILE (.PNG, .JPG, OR .GIF)" located in the middle left of the control panel
  • Browse to the file of your choice and click "open".
  • Once opened, your file will go through the Voronoi Diagram Phase, then the Stipples.
  • You can adjust the settings by sliding the values in the control panel left and right.
    • Stipples: Dictates how many dots create the image. The high the number, the clearer the picture. The trade-off here is TIME. The higher the number, the longer the processing will take.
  • After your file has iterated, and you're happy with how it looks, click the "PAUSE (TO CALCULATE TSP PATH)" button in the middle of the control panel.
  • Your image will turn into dots and blue lines. For our purposes, we're only concerned with the lines. The dots are representing the paths they will be optimizing.
  • After the lines have settled down, signifying the path has been somewhat optimized, click the "SAVE "TSP" Path (.SVG FORMAT)" buttin in the left/middle of the control panel. Save your file in a place you'll remember.

Convert to DXF

Open SVG in inkscape
  • Open Inkscape
  • Click File -> Open. Browse to where you saved the SVG file in the previous step.
  • Select the file and click 'Open'
  • Your image will load in the inkskape window.
  • Pro Tip: If you canvas is larger than the image, you can easily reduce it's size:
    • Click File
    • Click Document Properties
    • Click to expand "Resize Page to Drawing or Selection"
    • Click "Resize Page to Drawing or Selection" button, close the window
  • To save the file as DXF, Click File->Save As
  • Select "Desktop Cutting Plotter (R13" from the save as type pulldown menu.
  • Click Save.
  • OK, now your Traveling Salesman Problem path is saved as a DXF file!

Create Toolpath


  • Open CamBam
  • Click File-> Open
  • Browse to the DXF file you created in the previous step. Open it.

Center your drawing

    • Right click on the path
    • Select Transform
    • Click "Center Extents"

Scale your Drawing

  • The drawing is probably too big. Scale it down:
    • Right click on the path
    • Select Transform
    • Click Resize
    • The sizes are probably indicated in mm. Keep your overall work area in mind when re-sizing.
    • After you're happy with the new size, click Apply.
Center Extents
Resize Dialog Box

Create Toolpath

  • Create your toolpath by using the engrave function
    • Select the polyline from layer_1 in the window on the left. Selecting the polyline will turn it red.
    • Right click the path in the preview window
    • Select Machining -> Engrave
    • Highlight the new machining op (Part1->Engrave1)
    • Scroll to the bottom of the properties window
    • Change tool diameter to 0.02 (diameter of an ultra fine tip sharpie)
    • Right click the Engrave1 Machining Op, and select Generate Toolpath
    • This will turn your polyline purple
    • If there are no errors, right click the Engrave1 Machining Op again, and select Produce Gcode.
    • Save your gcode file