From ca7c3de6ee6eff97e231d57e3de4699a83b958f3 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 19 Aug 2015 02:51:09 -0400 Subject: [PATCH] eod --- js/cam/assemblers/Assembler.js | 5 +++++ js/cam/assemblers/AssemblerPost.js | 10 +++++++++- js/cam/assemblers/Component.js | 9 +++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index 1a74ec14..6efbb243 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -237,7 +237,11 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' } var startingPos = this.components.xAxis.getPosition().add(this.components.frame.getPosition().add(this.components.zAxis.getPosition()));//this.components.zAxis.getAbsolutePosition();//get position of end effector + console.log("here"); + console.log(startingPos);//this.components.zAxis.applyAbsoluteRotation( + console.log(position); speed = this._normalizeSpeed(startingPos, position, new THREE.Vector3(speed, speed, speed));//todo fix this + this.components.xAxis.moveTo(position, speed.x, sketchyCallback); this.components.frame.moveTo(position, speed.y, sketchyCallback); this.components.zAxis.moveTo(position, speed.z, sketchyCallback); @@ -247,6 +251,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' if (position.x === null && position.y === null) return speed; var deltaX = position.x-startingPos.x; var deltaY = position.y-startingPos.y; + console.log(deltaX + " " + deltaY); var totalDistance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); if (totalDistance == 0) return speed; speed.x = Math.abs(deltaX/totalDistance*speed.x); diff --git a/js/cam/assemblers/AssemblerPost.js b/js/cam/assemblers/AssemblerPost.js index fda2586c..62ed2f32 100644 --- a/js/cam/assemblers/AssemblerPost.js +++ b/js/cam/assemblers/AssemblerPost.js @@ -195,6 +195,14 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti AssemblerPost.prototype._postReleaseStock = function(index, position, material, settings, exporter, context){ var data = ""; + + //offset for rotation + var offset = this.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale); +// position.add(new THREE.Vector3(18.23*((index.z)%2), 0.3*((index.z)%2), 0)); + if (index.z%2 != 0){ + position = new THREE.Vector3(-position.y, position.x, position.z); + } + var stock = _.find(this.stock, function(thisStock){ return thisStock.getMaterial() == material }); @@ -205,7 +213,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti position.sub(stock.getPosition().multiplyScalar(settings.scale)); position.sub(settings.originPosition); -// position.add(new THREE.Vector3(18.23*((index.z+1)%2), 0.3*((index.z+1)%2), 0)); + // (5.08mm, 5.715mm) // x = part_pos[0]*1.27 + 18.23*((layer+1)%2) diff --git a/js/cam/assemblers/Component.js b/js/cam/assemblers/Component.js index 8cef66b2..ceb9381d 100644 --- a/js/cam/assemblers/Component.js +++ b/js/cam/assemblers/Component.js @@ -209,8 +209,9 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ if (callback) callback(); return; } + target = this.applyRotation(target);//absolute? - var currentPosition = this.getPosition();//local position + var currentPosition = this.getPosition(); var increment = speed/1500.0*cam.get("simSpeed"); var incrVector = target.clone().sub(currentPosition); @@ -232,9 +233,9 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ return target.multiply(motion); }; - Component.prototype.getThisDistanceToTarget = function(target){ - return target.clone().multiply(this.getAbsoluteMotionVector()); - }; +// Component.prototype.getThisDistanceToTarget = function(target){ +// return target.clone().multiply(this.getAbsoluteMotionVector()); +// }; Component.prototype._incrementalMove = function(increment, target, callback){ var self = this; -- GitLab