diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index 1e331a0c2b752bec0f1f7595cb96e15b24003c91..c1b96b9c5b402a2b6afda6c17a20cac1dd24b419 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -151,8 +151,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' data += self._postMoveXY(exporter, stockPosition.x-wcs.x, stockPosition.y-wcs.y); data += self._postMoveToStock(exporter, thisStockPosition, rapidHeight, wcs, safeHeight); } - var cellPosition = cell.getPosition();//todo cell.getAbsolutePosition(); - console.log(cellPosition); + var cellPosition = cell.getAbsolutePosition(); data += self._postMoveXY(exporter, cellPosition.x-wcs.x, cellPosition.y-wcs.y); data += self._postReleaseStock(cellPosition, cell, exporter, rapidHeight, wcs, safeHeight); data += "\n"; @@ -182,7 +181,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' var data = ""; data += exporter.rapidZ(cellPosition.z-wcs.z+safeHeight); data += exporter.moveZ(cellPosition.z-wcs.z); - data += exporter.addComment(JSON.stringify(cell.index)); + data += exporter.addComment(JSON.stringify(cell.getAbsoluteIndex())); data += exporter.moveZ(cellPosition.z-wcs.z+safeHeight); data += exporter.rapidZ(rapidHeight); return data; @@ -212,8 +211,11 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' }; Assembler.prototype.releaseStock = function(index){ + console.log(index); lattice.showCellAtIndex(JSON.parse(index)); - this.stock.hide(); + _.each(this.stock, function(stock){ + stock.hide(); + }); }; Assembler.prototype.pause = function(){ @@ -233,7 +235,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' if (totalThreads > 0) return; callback(); } - var startingPos = {x:this.components.xAxis.getPosition(), y:this.components.yAxis.getPosition(), z:this.components.zAxis.getPosition()}; + var startingPos = {x:this.components.xAxis.getPosition().x, y:this.components.yAxis.getPosition().y, z:this.components.zAxis.getPosition().z}; speed = this._normalizeSpeed(startingPos, x, y, this._reorganizeSpeed(speed)); this.components.xAxis.moveTo(this._makeAxisVector(x, "x"), speed.x, sketchyCallback); this.components.yAxis.moveTo(this._makeAxisVector(y, "y"), speed.y, sketchyCallback); @@ -255,7 +257,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' Assembler.prototype._normalizeSpeed = function(startingPos, x, y, speed){//xy moves need speed normalization var normSpeed = {}; - if (x == "" || y == "") return speed; + if (x == "" || y == "" || x === null || y === null) return speed; var deltaX = x-startingPos.x; var deltaY = y-startingPos.y; var totalDistance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); diff --git a/js/cam/assemblers/Component.js b/js/cam/assemblers/Component.js index 85b478bdddc24e5b081e10c803801351ba159711..331fc3c6c27f6c5c379d5f560da4ff031b0542b7 100644 --- a/js/cam/assemblers/Component.js +++ b/js/cam/assemblers/Component.js @@ -81,7 +81,8 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ var currentPosition = this.getPosition(); var diff = _.clone(target); _.each(_.keys(target), function(key){ - diff[key] -= currentPosition[key]; + if (target[key] === null) diff[key] = 0; + else diff[key] -= currentPosition[key]; }); var diffLength = this._getLength(diff); @@ -97,7 +98,6 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ _.each(_.keys(incrementVector), function(key){ incrementVector[key] *= increment/diffLength; }); - this._incrementalMove(incrementVector, target, callback); }; diff --git a/js/lattice/LatticeCAM.js b/js/lattice/LatticeCAM.js index bc7a87f8d0d810714365e6aa49d5a2ed42aa9e0b..ea8a81b969d294baf81735565599de639823ee8f 100644 --- a/js/lattice/LatticeCAM.js +++ b/js/lattice/LatticeCAM.js @@ -24,7 +24,7 @@ define(['lattice', 'three'], function(lattice, THREE){ firstLetter = order.charAt(0); order = order.substr(1); } - if (!cells) cells = this.cells;//grab cells once at beginning and hold onto it in case changes are made while looping + if (!cells) cells = this.sparseCells;//grab cells once at beginning and hold onto it in case changes are made while looping var newVarOrder; var newVarDim; if (firstLetter == 'X'){ diff --git a/js/plists/CamPList.js b/js/plists/CamPList.js index 95c92ccf42b70baf6362343507ecf1108788cc61..06a7e0fcbc3bbb9f1b224b0c4c75a07c3dd67604 100644 --- a/js/plists/CamPList.js +++ b/js/plists/CamPList.js @@ -44,7 +44,7 @@ define([], function(){ axisOfMotion: null, //minBound //maxBound - parent: "frame", + parent: "yAxis", children: ["zAxis"], stl: { filename: "assets/stls/stapler/xAxis.stl", @@ -53,14 +53,14 @@ define([], function(){ rotation: {x:0,y:0,z:0} } }, - yAxis: { + frame: { name: "Y Axis", isLinear: true, axisOfMotion: null, //minBound //maxBound parent: "substrate", - children: ["frame"], + children: ["yAxis"], stl: { filename: "assets/stls/stapler/yAxis.stl", offset: {x:0,y:0,z:0}, @@ -83,13 +83,13 @@ define([], function(){ rotation: {x:0,y:0,z:0} } }, - frame: { + yAxis: { name: "Frame", isLinear: true, axisOfMotion: null, //minBound //maxBound - parent: "yAxis", + parent: "frame", children: ["xAxis"], stl: { filename: "assets/stls/stapler/frame.stl", @@ -105,7 +105,7 @@ define([], function(){ //minBound //maxBound parent: null, - children: ["frame"], + children: ["yAxis"], stl: { filename: "assets/stls/stapler/substrate.stl", offset: {x:0,y:0,z:0},