Skip to content

Instantly share code, notes, and snippets.

@tmpvar
Created April 27, 2014 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmpvar/11339347 to your computer and use it in GitHub Desktop.
Save tmpvar/11339347 to your computer and use it in GitHub Desktop.
gcode generator for a 6.35mm sheet of aluminum for a printerbotjr v1 (mounting holes not included)
var gcode = [];
var G1 = function(obj) {
gcode.push('G1 ' + Object.keys(obj).map(function(a) {
return a.toUpperCase() + Number(obj[a]).toFixed(3);
}).join(' '));
};
G1({z: 5});
var offset = 6.35;
for (var i = 0.2; i>=-6.4; i-=.2) {
G1({ x: 0, y: 0, z: i-.05});
G1({ x: 175+offset, y: 0, z: i-.1});
G1({ x: 175+offset, y: 120 + offset, z: i-.15});
G1({ x: 0, y: 120 + offset, z: i-.2});
G1({ x: 0, y: 0});
}
console.log(gcode.join('\n'));
G1({z: 5})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment