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

wip

parent f782bb1d
No related branches found
No related tags found
No related merge requests found
...@@ -57,9 +57,9 @@ var inputs = { ...@@ -57,9 +57,9 @@ var inputs = {
// calculation in progress, show and accumulate // calculation in progress, show and accumulate
// //
draw_path(evt.detail) draw_path(evt.detail)
accumulate_path(evt.detail) accumulate_layer(evt.detail)
mod.offsetCount += 1 mod.offsetCount += 1
if ((mod.offsetCount != parseInt(mod.number.value)) if ((mod.offsetCount != 1+parseInt(mod.number.value))
&& (evt.detail.length > 0)) { && (evt.detail.length > 0)) {
// //
// layer detail present and offset not complete // layer detail present and offset not complete
...@@ -72,6 +72,10 @@ var inputs = { ...@@ -72,6 +72,10 @@ var inputs = {
// //
// layer loop not complete // layer loop not complete
// //
merge_layer()
clear_layer()
draw_path(mod.path)
draw_connections()
console.log('depth '+mod.depth) console.log('depth '+mod.depth)
mod.depth += parseFloat(mod.cut_mm.value) mod.depth += parseFloat(mod.cut_mm.value)
if (mod.depth > parseFloat(mod.max_mm.value)) { if (mod.depth > parseFloat(mod.max_mm.value)) {
...@@ -97,10 +101,6 @@ var inputs = { ...@@ -97,10 +101,6 @@ var inputs = {
// //
mod.label.nodeValue = 'calculate' mod.label.nodeValue = 'calculate'
mod.labelspan.style.fontWeight = 'normal' mod.labelspan.style.fontWeight = 'normal'
merge_path()
clear_path()
draw_path(mod.path)
draw_connections()
outputs.toolpath.event() outputs.toolpath.event()
} }
} }
...@@ -326,7 +326,7 @@ var interface = function(div){ ...@@ -326,7 +326,7 @@ var interface = function(div){
mod.path = [] mod.path = []
mods.output(mod,'offset','') mods.output(mod,'offset','')
mods.output(mod,'depth',{depthmm:mod.depth}) mods.output(mod,'depth',{depthmm:mod.depth})
clear_path() clear_layer()
outputs.diameter.event() outputs.diameter.event()
outputs.offset.event() outputs.offset.event()
}) })
...@@ -407,9 +407,10 @@ function set_values(settings) { ...@@ -407,9 +407,10 @@ function set_values(settings) {
} }
} }
// //
// clear_path // clear_layer
// //
function clear_path() { function clear_layer() {
mod.path = []
var svg = document.getElementById(mod.div.id+'svg') var svg = document.getElementById(mod.div.id+'svg')
svg.setAttribute('viewBox',"0 0 "+(mod.img.width-1)+" "+(mod.img.height-1)) svg.setAttribute('viewBox',"0 0 "+(mod.img.width-1)+" "+(mod.img.height-1))
var g = document.getElementById(mod.div.id+'g') var g = document.getElementById(mod.div.id+'g')
...@@ -419,11 +420,11 @@ function clear_path() { ...@@ -419,11 +420,11 @@ function clear_path() {
svg.appendChild(g) svg.appendChild(g)
} }
// //
// accumulate_path // accumulate_layer
// todo: replace inefficient insertion sort // todo: replace inefficient insertion sort
// todo: move sort out of main thread // todo: move sort out of main thread
// //
function accumulate_path(path) { function accumulate_layer(path) {
var forward = mod.forward.checked var forward = mod.forward.checked
var conventional = mod.conventional.checked var conventional = mod.conventional.checked
var sort = mod.sort.checked var sort = mod.sort.checked
...@@ -462,9 +463,9 @@ function accumulate_path(path) { ...@@ -462,9 +463,9 @@ function accumulate_path(path) {
} }
} }
// //
// merge_path // merge_layer
// //
function merge_path() { function merge_layer() {
var dmerge = mod.dpi*parseFloat(mod.merge.value)*parseFloat(mod.dia_in.value) var dmerge = mod.dpi*parseFloat(mod.merge.value)*parseFloat(mod.dia_in.value)
var seg = 0 var seg = 0
while (seg < (mod.path.length-1)) { while (seg < (mod.path.length-1)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment