Tool to generate G-Code producing drilled dot panels from images.
A working implementation of the tool and some description about the project can be found here:
http://www.mathiasbernhard.ch/fpix-pixel-art/
For eventual updates, I can be found on Twitter: @W0RB1T
The files in this repository are split up into two main parts:
- src/tool
- This folder contains the processingjs sketch files
- In order to edit them in the Processing IDE, they have to be in a folder named fPix_web
- The methods defined in these files are described in more detail below
- gui
- this folder contains the file that actually have to be uploaded to a webserver in order to have the tool run in a browser
- all the single
*.pde
files withinsrc/tool
are concatenated intofPix_web.pde
- the
<canvas>
-element inindex.html
loads this file as itsdata-processing-sources
- the
*.php
-files deal with uploading an image from the users hard drive to the server, displaying all the uploaded images as thumbnails in an<iframe>
and generating the gCode file and writing it to the server
The presentation slides showed at Fablab Zurich can be found here.
The *.pde
files contain the following parts and methods:
- definition of global variables
- setup()
- draw()
- calcResult(): main method to recalculate the result given the current state of parameters
Dot is an inner class defined to contain all the necessary information about one drilled hole (position, depth and whether or not it is to be drilled at all, depending on the threshold)
Methods to generate and return the gCode as a string. It loops through all the Dots in myDots
(ArrayList<ArrayList<Dot>>
)
- calculate average luminosity of an image tile
- make level adjustments (everything below
low
is black and everything abovehigh
is white) - scale the image to fill the entire sheet of material, factor returned to set slider value in gui
- ballnose conversion: converts linear grey scales to drilling depths, taking into account the round form of the tool and the area of a circle increasing to the square of the radius
- fromat numbers to strings (digits after comma) for export, can also be used for mm/inch conversion if necessary
This is where the actual pattern as collection of Dots is calculated. Which of the methods is called depends on the type
variable, checked in a switch
case in Analyse.pde
. Currently, there are four patterns available:
- getOrthoGrid: calculates an orthogonal (90 degree) grid of points
- getHoneyGrid: calculates a hexagonal (60 degree) grid of points - as in a honeycomb
- getPolarGrid: calculates a set of concentric circles
- getSpiralGrid: calculates one continuous spiral from the inside out
Generates a preview of the calculated pattern as PGraphics object that is then displayed by the draw
loop and actually shows up in the <canvas>
on the site. The preview is probably not 100% accuarate compared to the physical result, especially the width and end-to-end-connections of line patterns.
Defined in here are all the methods that are called by the GUI-elements of index.html
to set and get parameters.
Some of the methods can also be called on keyPressed
(for testing purpose, without the GUI)