Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
mods
Commits
5670956e
Commit
5670956e
authored
May 27, 2017
by
Neil Gershenfeld
Browse files
first pass at G-code output
parent
b9466454
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
js/mods.js
View file @
5670956e
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
//
//
/*
/*
todo
todo
SopTL view z pan
G-code output
STL view z pan
STL up sign flip
STL up sign flip
STL height map
STL height map
rough cut
rough cut
...
@@ -31,7 +32,6 @@ todo
...
@@ -31,7 +32,6 @@ todo
save and reload program
save and reload program
SVG path export
SVG path export
collapse module
collapse module
G-code output
direct toolpath calculation
direct toolpath calculation
file load
file load
OBJ
OBJ
...
...
modules/toolpath/formats/G-code
View file @
5670956e
...
@@ -30,7 +30,8 @@ var init = function() {
...
@@ -30,7 +30,8 @@ var init = function() {
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.unitsin.checked = true
mod.tool.value = 1
mod.coolanton.checked = true
}
}
//
//
// inputs
// inputs
...
@@ -52,7 +53,7 @@ var outputs = {
...
@@ -52,7 +53,7 @@ var outputs = {
file:{type:'object',
file:{type:'object',
event:function(str){
event:function(str){
obj = {}
obj = {}
obj.name = mod.name+".
sbp
"
obj.name = mod.name+".
nc
"
obj.contents = str
obj.contents = str
mods.output(mod,'file',obj)
mods.output(mod,'file',obj)
}}}
}}}
...
@@ -117,52 +118,60 @@ var interface = function(div){
...
@@ -117,52 +118,60 @@ var interface = function(div){
div.appendChild(document.createTextNode(' (RPM)'))
div.appendChild(document.createTextNode(' (RPM)'))
div.appendChild(document.createElement('br'))
div.appendChild(document.createElement('br'))
//
//
//
file units
//
tool
//
//
div.appendChild(document.createTextNode('file units:'))
div.appendChild(document.createTextNode('tool: '))
var input = document.createElement('input')
input.type = 'text'
input.size = 6
div.appendChild(input)
mod.tool = input
div.appendChild(document.createElement('br'))
//
// coolant
//
div.appendChild(document.createTextNode('coolant:'))
var input = document.createElement('input')
var input = document.createElement('input')
input.type = 'radio'
input.type = 'radio'
input.name = mod.div.id+'
units
'
input.name = mod.div.id+'
coolant
'
input.id = mod.div.id+'
unitsi
n'
input.id = mod.div.id+'
coolanto
n'
div.appendChild(input)
div.appendChild(input)
mod.
unitsi
n = input
mod.
coolanto
n = input
div.appendChild(document.createTextNode('
i
n'))
div.appendChild(document.createTextNode('
o
n'))
var input = document.createElement('input')
var input = document.createElement('input')
input.type = 'radio'
input.type = 'radio'
input.name = mod.div.id+'
units
'
input.name = mod.div.id+'
coolant
'
input.id = mod.div.id+'
unitsmm
'
input.id = mod.div.id+'
coolantoff
'
div.appendChild(input)
div.appendChild(input)
mod.
unitsmm
= input
mod.
coolantoff
= input
div.appendChild(document.createTextNode('
mm
'))
div.appendChild(document.createTextNode('
off
'))
}
}
//
//
// local functions
// local functions
//
//
function make_path() {
function make_path() {
var dx =
units*
mod.width/mod.dpi
var dx = mod.width/mod.dpi
var nx = mod.width
var nx = mod.width
var scale = dx/(nx-1)
var scale = dx/(nx-1)
var jog_speed = parseFloat(mod.jogspeed.value)/25.4
var cut_speed = parseFloat(mod.cutspeed.value)/25.4
var cut_speed = parseFloat(mod.cutspeed.value)/25.4
var plunge_speed = parseFloat(mod.plungespeed.value)/25.4
var plunge_speed = parseFloat(mod.plungespeed.value)/25.4
var jog_speed = parseFloat(mod.jogspeed.value)/25.4
var jog_height = parseFloat(mod.jogheight.value)/25.4
var jog_height = parseFloat(mod.jogheight.value)/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
// xy plane, inch mode, cancel diameter compensation, cancel length offset
str += "G17\n" // xy plane
// coordinate system 1, cancel motion, non-incremental motion, feed/minute mode
str += "G20\n" // inches
str += "G17\n"
str += "G40\n" // cancel tool radius compensation
str += "G20\n"
str += "G49\n" // cancel tool length compensation
str += "G40\n"
str += "G54\n" // coordinate system 1
str += "G49\n"
str += "G80\n" // cancel canned cycles
str += "G54\n"
str += "G90\n" // absolute coordinates
str += "G80\n"
str += "G94\n" // feed/minute units
str += "G90\n"
str += "G94\n"
str += "T"+tool+"M06\n" // tool selection, tool change
str += "T"+tool+"M06\n" // tool selection, tool change
str += "F"+cut_speed.toFixed(4)+"\n" // feed rate
str += "F"+cut_speed.toFixed(4)+"\n" // feed rate
str += "S"+spindle_speed+"\n" // spindle speed
str += "S"+spindle_speed+"\n" // spindle speed
if (mod.coolant.checked)
if (mod.coolant
on
.checked)
str += "M08\n" // coolant on
str += "M08\n" // coolant on
str += "G00Z"+jog_height.toFixed(4)+"\n" // move up before starting spindle
str += "G00Z"+jog_height.toFixed(4)+"\n" // move up before starting spindle
str += "M03\n" // spindle on clockwise
str += "M03\n" // spindle on clockwise
...
@@ -199,14 +208,13 @@ function make_path() {
...
@@ -199,14 +208,13 @@ function make_path() {
//
//
str += "G00Z"+jog_height.toFixed(4)+"\n" // move up before stopping spindle
str += "G00Z"+jog_height.toFixed(4)+"\n" // move up before stopping spindle
str += "M05\n" // spindle stop
str += "M05\n" // spindle stop
if (mod.coolant.checked)
if (mod.coolant
on
.checked)
str += "M09\n" // coolant off
str += "M09\n" // coolant off
str += "M30\n" // program end and reset
str += "M30\n" // program end and reset
str += "%\n" // tape end
str += "%\n" // tape end
//
//
// output file
// output file
//
//
str += "MZ,"+jog_height.toFixed(4)+"\r\n"
outputs.file.event(str)
outputs.file.event(str)
}
}
//
//
...
...
programs/index.html
View file @
5670956e
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
<i>
iterate
</i><br>
<i>
iterate
</i><br>
<a
href=
"javascript:handler('programs/iterate/z%20theta%20scan')"
>
z theta scan
</a><br>
<a
href=
"javascript:handler('programs/iterate/z%20theta%20scan')"
>
z theta scan
</a><br>
<i>
machines
</i><br>
<i>
machines
</i><br>
<i>
G-code
</i><br>
<a
href=
"javascript:handler('programs/machines/G-code/mill%202D%20png')"
>
mill 2D png
</a><br>
<i>
Roland
</i><br>
<i>
Roland
</i><br>
<i>
mill
</i><br>
<i>
mill
</i><br>
<i>
MDX-20
</i><br>
<i>
MDX-20
</i><br>
...
...
programs/machines/G-code/mill 2D png
0 → 100644
View file @
5670956e
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment