From aa085d1c7e5be0ec8baafd44f98c7efba77022e5 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Thu, 8 Jan 2015 21:31:27 -0800 Subject: [PATCH] attach sketch to SolidMesh --- web/app/engine.js | 7 +++---- web/app/main.js | 1 - web/app/workbench.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/web/app/engine.js b/web/app/engine.js index a91d404f..3741186e 100644 --- a/web/app/engine.js +++ b/web/app/engine.js @@ -126,7 +126,6 @@ TCAD.utils.equal = function(v1, v2) { TCAD.utils.sketchToPolygons = function(geom) { var dict = {}; - var points = {}; var lines = geom.lines; function key(a) { @@ -153,7 +152,7 @@ TCAD.utils.sketchToPolygons = function(geom) { memDir(b, a); } - graph = { + var graph = { id : key, @@ -168,7 +167,7 @@ TCAD.utils.sketchToPolygons = function(geom) { size : function() { return points.length; - }, + } }; var loops = TCAD.graph.finaAllLoops(graph); @@ -337,9 +336,9 @@ TCAD.SketchFace.prototype.syncSketches = function(geom) { for (var i = this.sketch3DGroup.children.length - 1; i >= 0; --i) { this.sketch3DGroup.remove(this.sketch3DGroup.children[i]); } - } else { this.sketch3DGroup = new THREE.Object3D(); + this.solid.meshObject.add(this.sketch3DGroup); } this.geom = []; diff --git a/web/app/main.js b/web/app/main.js index 0f71ed73..5a25e182 100644 --- a/web/app/main.js +++ b/web/app/main.js @@ -18,7 +18,6 @@ TCAD.App = function() { if (savedFace != null) { var geom = TCAD.workbench.readSketchGeom(JSON.parse(savedFace)); sketchFace.syncSketches(geom); - this.viewer.scene.add(sketchFace.sketch3DGroup); } } this.viewer.render(); diff --git a/web/app/workbench.js b/web/app/workbench.js index 3695bb18..cb0621cc 100644 --- a/web/app/workbench.js +++ b/web/app/workbench.js @@ -80,6 +80,6 @@ TCAD.Craft.prototype.current = function() { TCAD.Craft.prototype.modify = function(solid, modification) { var faces = modification(); this.app.viewer.scene.remove( solid.meshObject ); - this.app.viewer.scene.add( TCAD.utils.createSolidMesh(faces) ); + //this.app.viewer.scene.add( TCAD.utils.createSolidMesh(faces) ); this.app.viewer.render(); };