Skip to content
Snippets Groups Projects
Commit 3ef0df96 authored by skeatz's avatar skeatz
Browse files

added option for in or mm

parent b8b115c3
Branches
No related tags found
No related merge requests found
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
// Neil Gershenfeld // Neil Gershenfeld
// (c) Massachusetts Institute of Technology 2018 // (c) Massachusetts Institute of Technology 2018
// //
// Updated: Steven Chew
// Date: Feb 20 2019
// Comments: Added option to output in inch or mm
//
// This work may be reproduced, modified, distributed, performed, and // This work may be reproduced, modified, distributed, performed, and
// displayed for any purpose, but must acknowledge the mods // displayed for any purpose, but must acknowledge the mods
// project. Copyright is retained and must be preserved. The work is // project. Copyright is retained and must be preserved. The work is
...@@ -25,12 +29,12 @@ var name = 'path to G-code' ...@@ -25,12 +29,12 @@ var name = 'path to G-code'
// initialization // initialization
// //
var init = function() { var init = function() {
mod.cutspeed.value = 20 mod.cutspeed.value = '20'
mod.plungespeed.value = 20 mod.plungespeed.value = '20'
mod.jogspeed.value = 75 mod.jogspeed.value = '75'
mod.jogheight.value = 5 mod.jogheight.value = '5'
mod.spindlespeed.value = 10000 mod.spindlespeed.value = '10000'
mod.tool.value = 1 mod.tool.value = '1'
mod.coolanton.checked = true mod.coolanton.checked = true
} }
// //
...@@ -145,23 +149,56 @@ var interface = function(div){ ...@@ -145,23 +149,56 @@ var interface = function(div){
div.appendChild(input) div.appendChild(input)
mod.coolantoff = input mod.coolantoff = input
div.appendChild(document.createTextNode('off')) div.appendChild(document.createTextNode('off'))
div.appendChild(document.createElement('br'))
//
// Inch or mm
//
div.appendChild(document.createTextNode('format:'))
var input = document.createElement('input')
input.type = 'radio'
input.name = mod.div.id+'format'
input.id = mod.div.id+'formatInch'
input.checked = true
div.appendChild(input)
mod.formatInch = input
div.appendChild(document.createTextNode('inch'))
var input = document.createElement('input')
input.type = 'radio'
input.name = mod.div.id+'format'
input.id = mod.div.id+'formatMm'
div.appendChild(input)
mod.formatMm = input
div.appendChild(document.createTextNode('mm'))
} }
// //
// local functions // local functions
// //
function make_path() { function make_path() {
var dx = mod.width/mod.dpi var dx = 25.4*mod.width/mod.dpi
var cut_speed = parseFloat(mod.cutspeed.value)
var plunge_speed = parseFloat(mod.plungespeed.value)
var jog_speed = parseFloat(mod.jogspeed.value)
var jog_height = parseFloat(mod.jogheight.value)
var nx = mod.width var nx = mod.width
var scale = dx/(nx-1) var scale = dx/(nx-1)
var cut_speed = parseFloat(mod.cutspeed.value)/25.4 var in_mm_scale = 1
var plunge_speed = parseFloat(mod.plungespeed.value)/25.4 if (mod.formatInch.checked) {
var jog_speed = parseFloat(mod.jogspeed.value)/25.4 dx /= 25.4
var jog_height = parseFloat(mod.jogheight.value)/25.4 scale /= 25.4
cut_speed /= 25.4
plunge_speed /= 25.4
jog_speed /= 25.4
jog_height /= 25.4
}
var spindle_speed = parseFloat(mod.spindlespeed.value) var spindle_speed = parseFloat(mod.spindlespeed.value)
var tool = parseInt(mod.tool.value) var tool = parseInt(mod.tool.value)
str = "%\n" // tape start str = "%\n" // tape start
str += "G17\n" // xy plane str += "G17\n" // xy plane
if (mod.formatInch.checked)
str += "G20\n" // inches str += "G20\n" // inches
if (mod.formatMm.checked)
str += "G21\n" // mm
str += "G40\n" // cancel tool radius compensation str += "G40\n" // cancel tool radius compensation
str += "G49\n" // cancel tool length compensation str += "G49\n" // cancel tool length compensation
str += "G54\n" // coordinate system 1 str += "G54\n" // coordinate system 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment