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

ready for tool shape

parent c8ea4dcf
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ var name = 'mill raster 3D (incomplete)' ...@@ -24,7 +24,7 @@ var name = 'mill raster 3D (incomplete)'
// initialization // initialization
// //
var init = function() { var init = function() {
mod.dia_in.value = 0.0156 mod.dia_in.value = 0.125
mod.dia_mm.value = 25.4*parseFloat(mod.dia_in.value) mod.dia_mm.value = 25.4*parseFloat(mod.dia_in.value)
mod.stepover.value = 0.5 mod.stepover.value = 0.5
mod.error.value = 0.001 mod.error.value = 0.001
...@@ -265,10 +265,14 @@ function calculate_path() { ...@@ -265,10 +265,14 @@ function calculate_path() {
// call webworker // call webworker
// //
webworker.postMessage({ webworker.postMessage({
h:mod.height,w:mod.width,error:mod.error.value, height:mod.height,width:mod.width,
error:mod.error.value,
xmin:mod.xmin,xmax:mod.xmax, xmin:mod.xmin,xmax:mod.xmax,
ymin:mod.ymin,ymax:mod.ymax, ymin:mod.ymin,ymax:mod.ymax,
zmin:mod.zmin,zmax:mod.zmax, zmin:mod.zmin,zmax:mod.zmax,
diameter:mod.dia_mm.value,
stepover:mod.stepover.value,
mmunits: mod.mmunits,
map:mod.map}) map:mod.map})
} }
// //
...@@ -276,8 +280,8 @@ function calculate_path() { ...@@ -276,8 +280,8 @@ function calculate_path() {
// //
function calculate_path_worker() { function calculate_path_worker() {
self.addEventListener('message',function(evt) { self.addEventListener('message',function(evt) {
var h = evt.data.h var h = evt.data.height
var w = evt.data.w var w = evt.data.width
var error = evt.data.error var error = evt.data.error
var xmin = evt.data.xmin var xmin = evt.data.xmin
var xmax = evt.data.xmax var xmax = evt.data.xmax
...@@ -286,6 +290,10 @@ function calculate_path_worker() { ...@@ -286,6 +290,10 @@ function calculate_path_worker() {
var zmin = evt.data.zmin var zmin = evt.data.zmin
var zmax = evt.data.zmax var zmax = evt.data.zmax
var map = evt.data.map var map = evt.data.map
var diameter = evt.data.diameter
var stepover = evt.data.stepover
var mmunits = evt.data.mmunits
var ystep = Math.floor(stepover*diameter*w/(mmunits*(xmax-xmin)))
var path = [[]] var path = [[]]
// //
// loop over lines // loop over lines
...@@ -335,7 +343,7 @@ function calculate_path_worker() { ...@@ -335,7 +343,7 @@ function calculate_path_worker() {
if (xcur == (w-1)) { if (xcur == (w-1)) {
if (dx == 1) { if (dx == 1) {
dx = 0 dx = 0
dy = -10 dy = -ystep
} }
else { else {
dx = -1 dx = -1
...@@ -345,7 +353,7 @@ function calculate_path_worker() { ...@@ -345,7 +353,7 @@ function calculate_path_worker() {
else if (xcur == 0) { else if (xcur == 0) {
if (dx == -1) { if (dx == -1) {
dx = 0 dx = 0
dy = -10 dy = -ystep
} }
else { else {
dx = 1 dx = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment