Skip to content
Snippets Groups Projects
Commit a1abccbe authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

G-code sec or min option

parent 9642cc79
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,10 @@
// - inch/s to inch/min
//...........- mm/s to mm/min
//
// Updated: Neil Gershenfeld
// Date: Oct 28 2020
// Comments: added mm/s vs mm/min option
//
// This work may be reproduced, modified, distributed, performed, and
// displayed for any purpose, but must acknowledge the mods
// project. Copyright is retained and must be preserved. The work is
......@@ -33,13 +37,14 @@ var name = 'path to G-code'
// initialization
//
var init = function() {
mod.cutspeed.value = '20'
mod.plungespeed.value = '20'
mod.jogspeed.value = '75'
mod.jogheight.value = '5'
mod.spindlespeed.value = '10000'
mod.cutspeed.value = '2.5'
mod.plungespeed.value = '2.5'
mod.jogheight.value = '2'
mod.spindlespeed.value = '11000'
mod.tool.value = '1'
mod.coolanton.checked = true
mod.coolantoff.checked = true
mod.formatMm.checked = true
mod.unitMinutes.checked = true
}
//
// inputs
......@@ -93,17 +98,6 @@ var interface = function(div){
div.appendChild(document.createTextNode(' (mm/s)'))
div.appendChild(document.createElement('br'))
//
// jog speed
//
div.appendChild(document.createTextNode('jog speed: '))
var input = document.createElement('input')
input.type = 'text'
input.size = 6
div.appendChild(input)
mod.jogspeed = input
div.appendChild(document.createTextNode(' (mm/s)'))
div.appendChild(document.createElement('br'))
//
// jog height
//
div.appendChild(document.createTextNode('jog height: '))
......@@ -155,7 +149,7 @@ var interface = function(div){
div.appendChild(document.createTextNode('off'))
div.appendChild(document.createElement('br'))
//
// Inch or mm
// inch or mm format
//
div.appendChild(document.createTextNode('format:'))
var input = document.createElement('input')
......@@ -173,7 +167,26 @@ var interface = function(div){
div.appendChild(input)
mod.formatMm = input
div.appendChild(document.createTextNode('mm'))
div.appendChild(document.createElement('br'))
//
// second or minute rate units
//
div.appendChild(document.createTextNode('rate units:'))
var input = document.createElement('input')
input.type = 'radio'
input.name = mod.div.id+'units'
input.id = mod.div.id+'unitSeconds'
input.checked = true
div.appendChild(input)
mod.unitSeconds = input
div.appendChild(document.createTextNode('second'))
var input = document.createElement('input')
input.type = 'radio'
input.name = mod.div.id+'units'
input.id = mod.div.id+'unitMinutes'
div.appendChild(input)
mod.unitMinutes = input
div.appendChild(document.createTextNode('minute'))
}
//
// local functions
......@@ -182,7 +195,6 @@ function make_path() {
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 scale = dx/(nx-1)
......@@ -195,6 +207,10 @@ function make_path() {
jog_speed /= 25.4
jog_height /= 25.4
}
if (mod.unitMinutes.checked) {
cut_speed *= 60
plunge_speed *= 60
}
var spindle_speed = parseFloat(mod.spindlespeed.value)
var tool = parseInt(mod.tool.value)
str = "%\n" // tape start
......@@ -210,7 +226,7 @@ function make_path() {
str += "G90\n" // absolute coordinates
str += "G94\n" // feed/minute units
str += "T"+tool+"M06\n" // tool selection, tool change
str += "F"+cut_speed.toFixed(4)*60+"\n" // feed rate
str += "F"+cut_speed.toFixed(4)+"\n" // feed rate
str += "S"+spindle_speed+"\n" // spindle speed
if (mod.coolanton.checked)
str += "M08\n" // coolant on
......@@ -232,8 +248,8 @@ function make_path() {
// move down
//
z = scale*mod.path[seg][0][2]
str += "G01Z"+z.toFixed(4)+" F"+plunge_speed.toFixed(4)*60+"\n"
str += "F"+cut_speed.toFixed(4)*60+"\n" //restore xy feed rate
str += "G01Z"+z.toFixed(4)+" F"+plunge_speed.toFixed(4)+"\n"
str += "F"+cut_speed.toFixed(4)+"\n" //restore xy feed rate
for (var pt = 1; pt < mod.path[seg].length; ++pt) {
//
// move to next point
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment