Commit bc60d28d authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

stock offset for stapler

parent 04c20825
...@@ -109,6 +109,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel ...@@ -109,6 +109,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel
} }
var machineJSON = camPlist.allMachines[machineName]; var machineJSON = camPlist.allMachines[machineName];
if (machineJSON.defaults) this._setMachineDefaults(machineJSON.defaults); if (machineJSON.defaults) this._setMachineDefaults(machineJSON.defaults);
if (machineJSON.lattice) this._setLatticeDefaults(machineJSON.lattice)
var self = this; var self = this;
require(['assembler'], function(Assembler){ require(['assembler'], function(Assembler){
...@@ -116,6 +117,12 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel ...@@ -116,6 +117,12 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel
}); });
}, },
_setLatticeDefaults: function(defaults){
_.each(defaults, function(value, key){
lattice.set(key, value);
});
},
_setMachineDefaults: function(defaults){ _setMachineDefaults: function(defaults){
var self = this; var self = this;
_.each(defaults, function(value, key){ _.each(defaults, function(value, key){
......
...@@ -261,7 +261,15 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' ...@@ -261,7 +261,15 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
Assembler.prototype._postReleaseStock = function(index, position, material, settings, exporter){ Assembler.prototype._postReleaseStock = function(index, position, material, settings, exporter){
var data = ""; var data = "";
if (material == "fiberGlass") position.x -= 26.1*settings.scale; var stock = _.find(this.stock, function(thisStock){
return thisStock.getMaterial() == material
});
if (stock === undefined) {
console.warn("no stock defined of type " + material + " for this assembler");
return data;
}
position.sub(stock.getPosition().multiplyScalar(settings.scale));
position.sub(settings.originPosition); position.sub(settings.originPosition);
data += this._postMoveXY(position, settings, exporter); data += this._postMoveXY(position, settings, exporter);
......
...@@ -79,6 +79,10 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ ...@@ -79,6 +79,10 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
return this.id; return this.id;
}; };
Component.prototype.getPosition = function(){
return this.object3D.position.clone();
};
Component.prototype.setTranslucent = function(translucent){ Component.prototype.setTranslucent = function(translucent){
if (this.stl === undefined) return; if (this.stl === undefined) return;
this.stl.material.transparent = translucent; this.stl.material.transparent = translucent;
......
...@@ -34,11 +34,19 @@ define(['underscore', 'cam', 'three', 'component', 'lattice', 'threeModel'], ...@@ -34,11 +34,19 @@ define(['underscore', 'cam', 'three', 'component', 'lattice', 'threeModel'],
//todo rotation //todo rotation
}; };
StockComponent.prototype.getPosition = function(){
return this.cell.getPosition();
};
StockComponent.prototype.setMaterial = function(materialName){ StockComponent.prototype.setMaterial = function(materialName){
this.cell.changeMaterial(materialName); this.cell.changeMaterial(materialName);
three.render(); three.render();
}; };
StockComponent.prototype.getMaterial = function(){
return this.cell.getMaterialName();
};
......
...@@ -132,9 +132,13 @@ define(['three'], function(THREE){ ...@@ -132,9 +132,13 @@ define(['three'], function(THREE){
}, },
name: "Stock 2", name: "Stock 2",
parent: "zAxis", parent: "zAxis",
position: {x:26.1,y:0,z:0} position: {x:26,y:0.236,z:0}
} }
}, },
lattice:{
scale: 1.27,
units: 'mm'
},
defaults: { defaults: {
camStrategy: "raster", camStrategy: "raster",
placementOrder: "XYZ",//used for raster strategy entry placementOrder: "XYZ",//used for raster strategy entry
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment