Commit 9cea6ac1 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

all post processing in script

parent e00219d1
......@@ -408,6 +408,7 @@ label {
.CodeMirror {
opacity: 0.6;
margin: 0 20px 0 -10px;
font-size: 10pt;
}
.editComposite, .editMaterial {
......
......@@ -101,6 +101,33 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
data += exporter.rapidZ(position.z + context.zClearHeight, settings);
return data;
};
this.customCalcPositionOffsets = function(index, position, material, settings, context){
//this feeds into moveXY and placePart's position parameter
if (index.z%2 != 0){
//offset for rotation
var offset = this.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in mm
var dist = position.clone().sub(offset);
position = offset.add(new THREE.Vector3(dist.y, -dist.x, position.z));
}
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 null;
}
position.sub(stock.getPosition().multiplyScalar(settings.scale));
position.sub(settings.originPosition);
return position;
}
}
......@@ -199,23 +226,8 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
// position.add(new THREE.Vector3(18.23*((index.z)%2), 0.3*((index.z)%2), 0));
if (index.z%2 != 0){
//offset for rotation
var offset = this.components.substrate.centerOfRotation.clone().multiplyScalar(settings.scale);//offset in mm
var dist = position.clone().sub(offset);
position = offset.add(new THREE.Vector3(dist.y, -dist.x, position.z));
}
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);
var position = this.customCalcPositionOffsets(index, position, material, settings, context);
if (position === null) return data;
// (5.08mm, 5.715mm)
......
......@@ -19,6 +19,7 @@ Rotation (xyz):  
Scale: &nbsp;&nbsp;<input data-property="scale" value="<%= scale %>" placeholder="Scale" class="form-control floatInput assembler" type="text"><br/><br/>
Edit Code:<br/><br/>
Context Variables <a class="editMachineCode" data-name="customFunctionsContext" href="#">Edit</a><br/>
Position Offsets <a class="editMachineCode" data-name="customCalcPositionOffsets" href="#">Edit</a><br/>
Header <a class="editMachineCode" data-name="customHeader" href="#">Edit</a><br/>
Go Home <a class="editMachineCode" data-name="customHome" href="#">Edit</a><br/>
<!--Pick up stock <a class="editMachineCode" data-name="customHeader" href="#">Edit</a><br/>-->
......
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