/* NEJE DK-8-KZ is a low cost laser carver that uses 500x500 images instead of gcode. Making a physical grid, we can calcuate how to engrave several objects at a time. This sketch maks a grid on a 500x500 pixel image, so you can engave it on a cardboard to use as pattern. This sketch builds on a prior work, "Untitled Sketch", created by [unnamed author] http://sketchpad.cc/sp/pad/view/ro.LRZM2F1IbFm/rev.318 */ // Pressing Control-R will render this sketch. PFont MyFont; int width=500; int height=500; int steps=10; int stepw=width/steps; int steph=height/steps; void setup() { // this is run once. size(width,height); colorMode(RGB); background(255,255,255); stroke(0,0,0); MyFont=createFont("Courier",10) textFont(MyFont); // textSize(20); fill(0,0,0); /* I tried with 1, but grid is oo thin or you to see it */ strokeWeight(3); textAlign(CENTER); for (int f=stepw;f<=(width-stepw);f+=stepw){ line (f,steph,f,height-steph); text(str(f),f,steph); } textAlign(RIGHT); for (int g=steph;g<=(height-steph);g+=steph){ line (stepw,g,width-stepw,g); if (stepw!=g) { text(str(g),stepw,g); } } saveFrame("grid.gif"); }