slicer didn't fill top anymore; fixed

This commit is contained in:
casperlamboo 2015-06-16 12:37:51 +02:00
parent f9ef14822b
commit 44994f61a8
3 changed files with 55 additions and 1 deletions

48
doodle_app/index.html Normal file
View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>Doodle 3D App</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="../three.js-master/build/three.js"></script>
<script src="../three.js-master/examples/js/controls/EditorControls.js"></script>
<script src="../three.js-master/examples/js/controls/TransformControls.js"></script>
<script src="../three.js-master/examples/js/libs/system.min.js"></script>
<script src="../three.js-master/editor/js/libs/signals.min.js"></script>
<script src="../three.js-master/editor/js/libs/ui.js"></script>
<script src="../three.js-master/editor/js/libs/ui.three.js"></script>
<script src="../three.js-master/editor/js/Storage.js"></script>
<script src="../three.js-master/editor/js/Editor.js"></script>
<script src="../three.js-master/editor/js/Config.js"></script>
<script src="../three.js-master/editor/js/Loader.js"></script>
<script src="../three.js-master/editor/js/Viewport.js"></script>
<script src="../three.js-master/editor/js/Viewport.info.js"></script>
<style>
* {padding: 0px; margin: 0px;}
canvas {border: 1px solid black; margin: 5px;}
.menu_bar {border: 1px solid black; height: 40px; margin: 5px;}
</style>
</head>
<body>
<div class="menu_bar"></div>
<canvas id="design"></canvas>
<canvas id="preview"></canvas>
<div class="menu_bar"></div>
<script>
var editor = new Editor();
var viewport = new Viewport( editor );
document.body.appendChild( viewport.dom );
</script>
</body>
</html>

View File

@ -358,11 +358,16 @@ D3D.Slicer.prototype.generateInfills = function (slices, printer) {
for (var layer = 0; layer < slices.length; layer ++) { for (var layer = 0; layer < slices.length; layer ++) {
var slice = slices[layer]; var slice = slices[layer];
console.log(layer + topSkinCount < slices.length);
if (layer - bottomSkinCount >= 0 && layer + topSkinCount < slices.length) { if (layer - bottomSkinCount >= 0 && layer + topSkinCount < slices.length) {
var downSkin = slices[layer - bottomSkinCount].getOutline(); var downSkin = slices[layer - bottomSkinCount].getOutline();
var upSkin = slices[layer + topSkinCount].getOutline(); var upSkin = slices[layer + topSkinCount].getOutline();
var surroundingLayer = upSkin.intersect(downSkin); var surroundingLayer = upSkin.intersect(downSkin);
} }
else {
var surroundingLayer = false;
}
for (var i = 0; i < slice.parts.length; i ++) { for (var i = 0; i < slice.parts.length; i ++) {
var part = slice.parts[i]; var part = slice.parts[i];
@ -372,7 +377,7 @@ D3D.Slicer.prototype.generateInfills = function (slices, printer) {
var inset = ((part.innerLines.length > 0) ? part.innerLines[part.innerLines.length - 1] : outerLine); var inset = ((part.innerLines.length > 0) ? part.innerLines[part.innerLines.length - 1] : outerLine);
var fillArea = inset.offset(-nozzleRadius); var fillArea = inset.offset(-nozzleRadius);
if (surroundingLayer !== undefined) { if (surroundingLayer) {
var highFillArea = fillArea.difference(surroundingLayer).offset(infillOverlap).intersect(fillArea); var highFillArea = fillArea.difference(surroundingLayer).offset(infillOverlap).intersect(fillArea);
} }
else { else {

View File

@ -57,6 +57,7 @@ function getAPI (url, callback) {
}); });
} }
//button doesnt work in firefox!!!
function downloadFile (file, data) { function downloadFile (file, data) {
'use strict'; 'use strict';