diff --git a/modules/processes/mill/raster/3D b/modules/processes/mill/raster/3D
index 8ca79093be9c3aaf8d30b70a1fab52f8d5249824..7c53026fcaeb1d05bb74f7d4ecaf69ee327d1c5b 100644
--- a/modules/processes/mill/raster/3D
+++ b/modules/processes/mill/raster/3D
@@ -27,7 +27,7 @@ var init = function() {
    mod.dia_in.value = 0.0156
    mod.dia_mm.value = 25.4*parseFloat(mod.dia_in.value)
    mod.stepover.value = 0.5
-   mod.error.value = 1
+   mod.error.value = 0.001
    }
 //
 // inputs
@@ -38,12 +38,14 @@ var inputs = {
          mod.map = evt.detail.map
          mod.width = evt.detail.width
          mod.height = evt.detail.height
+         mod.depth = Math.floor((mod.zmax-mod.zmin)*mod.width/(mod.xmax-mod.xmin))
          mod.xmin = evt.detail.xmin
          mod.xmax = evt.detail.xmax
          mod.ymin = evt.detail.ymin
          mod.ymax = evt.detail.ymax
          mod.zmin = evt.detail.zmin
          mod.zmax = evt.detail.zmax
+         mod.dpi = mod.width/(mod.xmax-mod.xmin)
          var ctx = mod.img.getContext("2d")
          ctx.canvas.width = mod.width
          ctx.canvas.height = mod.height
@@ -54,14 +56,15 @@ var inputs = {
 var outputs = {
    toolpath:{type:'',
       event:function(){
-         cmd = {}
-         cmd.path = mod.path
-         cmd.name = mod.name
-         cmd.dpi = mod.dpi
-         cmd.width = mod.width
-         cmd.height = mod.height
-         cmd.depth = mod.depth
-         mods.output(mod,'toolpath',cmd)
+         obj = {}
+         obj.path = mod.path
+         obj.name = "mill raster 3D"
+         obj.dpi = mod.dpi
+         obj.width = mod.width
+         obj.height = mod.height
+         obj.depth = mod.depth
+         mods.output(mod,'toolpath',obj)
+         console.log(mod.path[0].length)
          }}}
 //
 // interface
@@ -216,7 +219,9 @@ function calculate_path() {
    var url = window.URL.createObjectURL(blob)
    var webworker = new Worker(url)
    webworker.addEventListener('message',function(evt) {
-      mod.triangles = evt.data.triangles
+      //
+      // webworker handler
+      //
       mod.path = evt.data.path
       mod.label.nodeValue = 'calculate'
       mod.labelspan.style.fontWeight = 'normal'
@@ -240,7 +245,8 @@ function calculate_path() {
          var ix = mod.path[0][i][0]
          var iy = mod.path[0][i][1]
          var iz = 0.1*mod.path[0][i][2]
-         var line = document.createElementNS('http://www.w3.org/2000/svg','line')
+         var line = document.createElementNS(
+               'http://www.w3.org/2000/svg','line')
             line.setAttribute('stroke','black')
             line.setAttribute('stroke-width',1)
             line.setAttribute('stroke-linecap','round')
@@ -250,7 +256,14 @@ function calculate_path() {
             line.setAttribute('y2',iy-iz)
             g.appendChild(line)
             }
+      //
+      // output path
+      //
+      outputs.toolpath.event()
       })
+   //
+   // call webworker
+   //
    webworker.postMessage({
       h:mod.height,w:mod.width,error:mod.error.value,
       xmin:mod.xmin,xmax:mod.xmax,
@@ -275,7 +288,7 @@ function calculate_path_worker() {
       var map = evt.data.map
       var path = [[]]
       //
-      // line loop
+      // loop over lines
       //
       xstart = 0
       ystart = h-1
@@ -287,6 +300,9 @@ function calculate_path_worker() {
       dx = 1
       dy = 0
       while (1) {
+         //
+         // vectorize
+         //
          xnext = xcur+dx
          ynext = ycur+dy
          znext = Math.floor((map[ynext*w+xnext]-zmax)*w/(xmax-xmin))
@@ -301,13 +317,13 @@ function calculate_path_worker() {
          nzcur = dzcur/dcur
          dxnext = xnext-xcur
          dynext = ynext-ycur
-         dznext = znext-xcur
+         dznext = znext-zcur
          dnext = Math.sqrt(dxnext*dxnext+dynext*dynext+dznext*dznext)
          nxnext = dxnext/dnext
          nynext = dynext/dnext
          nznext = dznext/dnext
          dot = nxcur*nxnext+nycur*nynext+nzcur*nznext
-         if (Math.abs(dot) >= error) {
+         if (dot <= (1-error)) {
             path[0].push([xcur,ycur,zcur])
             xstart = xcur
             ystart = ycur