diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index ab9b0eed251ffd531251554cca273cc0b868baf0..bc2d49aa179c787e1c172647a81896c3c9d1e07f 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -25,7 +25,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' if (json.components && _.keys(json.components).length > 0) { var componentsJSON = json.components; this.components = this._buildAssemblerComponents(componentsJSON); - this._loadSTLs(componentsJSON, this.components); + this._loadSTLs(json, this.components); this._configureAssemblerMovementDependencies(componentsJSON, this.components, this.object3D); } @@ -49,16 +49,19 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' }; Assembler.prototype._loadSTLs = function(json, components){ - var stlFilenames = this._getStlNames(json); + var stlFilenames = this._getStlNames(json.components); function geometryPreProcess(geometry){//todo do this better if(geometry === undefined || (geometry.vertices && geometry.vertices.length == 0)) return null; - geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-4.0757, -4.3432, -6.2154)); - geometry.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI/2)); + if (json.translation) geometry.applyMatrix(new THREE.Matrix4().makeTranslation(json.translation.x, json.translation.y, json.translation.z)); + if (json.rotation) { + if (json.rotation.x) geometry.applyMatrix(new THREE.Matrix4().makeRotationX(json.rotation.x)); + if (json.rotation.y) geometry.applyMatrix(new THREE.Matrix4().makeRotationY(json.rotation.y)); + if (json.rotation.z) geometry.applyMatrix(new THREE.Matrix4().makeRotationZ(json.rotation.z)); + } + if (json.scale) geometry.applyMatrix(new THREE.Matrix4().makeScale(json.scale, json.scale, json.scale)); - var unitScale = 20; - geometry.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale)); geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-21, -0.63, 0)); return geometry; } diff --git a/js/plists/CamPList.js b/js/plists/CamPList.js index 4516a495baa0f0c09d155b4e3db58c32f1cbe616..29f2a11d005613eee20848aa3f6f219c32272fd1 100644 --- a/js/plists/CamPList.js +++ b/js/plists/CamPList.js @@ -34,6 +34,9 @@ define([], function(){ relative: false, camProcesses: ["gcode"], numMaterials: 2, + translation: {x:-4.0757,y: -4.3432,z: -6.2154}, + rotation: {x:Math.PI/2,y:0,z:0}, + scale: 20, components: { xAxis: { name: "X Axis",