diff --git a/settings/user_settings.json b/settings/user_settings.json index 612cec5..2591447 100644 --- a/settings/user_settings.json +++ b/settings/user_settings.json @@ -1,5 +1,5 @@ { - "layerHeight": 0.2, + "layerHeight": 0.15, "bottomThickness": 0.4, "topThickness": 0.8, "shellThickness": 0.4, @@ -23,11 +23,11 @@ }, "innerLine": { "flowRate": 1.0, - "speed": 50.0 + "speed": 60.0 }, "fill": { "flowRate": 1.0, - "speed": 50.0 + "speed": 100.0 }, "brim": { "flowRate": 1.0, diff --git a/slice_test.html b/slice_test.html index 42a937c..87a5724 100644 --- a/slice_test.html +++ b/slice_test.html @@ -40,7 +40,7 @@ function init () { loader.load('models/pokemon/pikachu.stl', function (geometry) { //var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1); //var geometry = new THREE.SphereGeometry(10, 20, 10); - //var geometry = new THREE.TorusGeometry(20, 10, 30, 30); + var geometry = new THREE.TorusGeometry(20, 10, 30, 30); /* var geometry = (function () { "use strict"; @@ -67,7 +67,7 @@ function init () { })(); */ - var path = [{x: 60, y: 40}, {x: 60, y: 50}, {x: 60, y: 60}, {x: 80, y: 60}, {x: 40, y: 40}, {x: 50, y: 40}, {x: 10, y: 60}]; + /*var path = [{x: 60, y: 40}, {x: 60, y: 50}, {x: 60, y: 60}, {x: 80, y: 60}, {x: 40, y: 40}, {x: 50, y: 40}, {x: 10, y: 60}]; var geometry = new THREE.Geometry(); for (var i = 0; i < path.length; i ++) { @@ -82,12 +82,12 @@ function init () { geometry.faces.push(new THREE.Face3(base, base + 1, base + 2)); geometry.faces.push(new THREE.Face3(base + 3, base + 2, base + 1)); - } + }*/ var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false, side: THREE.DoubleSide}); var mesh = new THREE.Mesh(geometry, material); - mesh.rotation.x = -Math.PI/2; + //mesh.rotation.x = -Math.PI/2; //mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.position.x = 60; mesh.position.z = 60; diff --git a/src/slicer.js b/src/slicer.js index 1f4c0e6..9763077 100644 --- a/src/slicer.js +++ b/src/slicer.js @@ -198,14 +198,14 @@ D3D.Slicer.prototype._slice = function (lines, printer) { var connects = lines[index].connects.clone(); var faceNormals = lines[index].normals.clone(); - if (shape.length > 2 && connects.indexOf(firstPoint) !== -1) { - closed = true; - break; - } - for (var j = 0; j < connects.length; j ++) { index = connects[j]; + if (shape.length > 2 && index === firstPoint) { + closed = true; + break; + } + if (done.indexOf(index) === -1) { if (intersections[index] !== undefined) { @@ -284,7 +284,8 @@ D3D.Slicer.prototype._slice = function (lines, printer) { } } - var part = new D3D.Paths([shape], closed).clean(0.01); + //var part = new D3D.Paths([shape], closed).clean(0.01); + var part = new D3D.Paths([shape], true).clean(0.01); if (part.length > 0) { sliceParts.push(part); } diff --git a/three.js-master/editor_slicer/js/Viewport.js b/three.js-master/editor_slicer/js/Viewport.js index 47d340d..37cd7a0 100755 --- a/three.js-master/editor_slicer/js/Viewport.js +++ b/three.js-master/editor_slicer/js/Viewport.js @@ -34,7 +34,7 @@ var Viewport = function ( editor ) { selectionBox.material.depthTest = false; selectionBox.material.transparent = true; selectionBox.visible = false; - sceneHelpers.add( selectionBox ); + sceneHelpers.add(selectionBox); var transformControls = new THREE.TransformControls( camera, container.dom ); transformControls.addEventListener( 'change', function () {