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
}
var machineJSON = camPlist.allMachines[machineName];
if (machineJSON.defaults) this._setMachineDefaults(machineJSON.defaults);
if (machineJSON.lattice) this._setLatticeDefaults(machineJSON.lattice)
var self = this;
require(['assembler'], function(Assembler){
......@@ -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){
var self = this;
_.each(defaults, function(value, key){
......
......@@ -261,7 +261,15 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
Assembler.prototype._postReleaseStock = function(index, position, material, settings, exporter){
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);
data += this._postMoveXY(position, settings, exporter);
......
......@@ -79,6 +79,10 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
return this.id;
};
Component.prototype.getPosition = function(){
return this.object3D.position.clone();
};
Component.prototype.setTranslucent = function(translucent){
if (this.stl === undefined) return;
this.stl.material.transparent = translucent;
......
......@@ -34,11 +34,19 @@ define(['underscore', 'cam', 'three', 'component', 'lattice', 'threeModel'],
//todo rotation
};
StockComponent.prototype.getPosition = function(){
return this.cell.getPosition();
};
StockComponent.prototype.setMaterial = function(materialName){
this.cell.changeMaterial(materialName);
three.render();
};
StockComponent.prototype.getMaterial = function(){
return this.cell.getMaterialName();
};
......
......@@ -132,9 +132,13 @@ define(['three'], function(THREE){
},
name: "Stock 2",
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: {
camStrategy: "raster",
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