Tsp sld

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 these images are created.

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

The basic workflow goes like this:
 * 1) Open your image in StippleGen2 (processing sketch)
 * 2) Export the TSP Path to SVG format
 * 3) Import SVG file into Inkscape
 * 4) Save SVG file as DXF file
 * 5) Open DXF file in CAM software
 * 6) Insert engraving toolpath on line
 * 7) Save Gcode
 * 8) Stream gcode to your cnc controller
 * 9) Watch in amazement.
 * 10) World Domination.

Requirements
Download the following software and files:
 * Processing - Open Source Programming Environment
 * Inkscape - Open Source Vector Graphics Program
 * StippleGen2
 * ControlP5 Library
 * Toxic Libs Library (0020-complete.zip)
 * You will also need a CAM program. In this tutorial we'll show you how to do it with both CamBam and Sketchup.

Getting Started
'''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

Generate the SVG
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 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!

CamBam

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

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
 * '''Here's the gcode file [[file:Glider_tsp_sld.txt]]