mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 03:23:48 +01:00
fixed higher layer algorithm
This commit is contained in:
parent
052f894c70
commit
3d34c59514
@ -13,13 +13,14 @@ var files = [
|
||||
"src/slicer.js"
|
||||
];
|
||||
|
||||
var DEST = 'build/';
|
||||
var destination = 'build/';
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src(files)
|
||||
// .pipe(watch(files))
|
||||
.pipe(concat('d3d.js'))
|
||||
.pipe(gulp.dest(DEST))
|
||||
.pipe(gulp.dest(destination))
|
||||
.pipe(uglify())
|
||||
.pipe(rename({extname: '.min.js'}))
|
||||
.pipe(gulp.dest(DEST));
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
@ -57,7 +57,6 @@ var printerConfig = {
|
||||
"printer.wallThickness": 0.4,
|
||||
|
||||
//variabele toevoegen;
|
||||
//overleg met rick;
|
||||
//-snelheid, retraction etc voor verschillende types (outerlayer, innerlayer, fill)
|
||||
"printer.shellThickness": 0.8,
|
||||
"printer.fillSize": 5, //dit is het raster aan de binnen kant van de geometry
|
||||
@ -67,6 +66,7 @@ var printer = new D3D.Printer(printerConfig);
|
||||
|
||||
var localIp = location.hash.substring(1);
|
||||
var doodleBox = new D3D.Box(localIp);
|
||||
//var printer = doodleBox.printer;
|
||||
|
||||
var scene = new THREE.Scene();
|
||||
|
||||
@ -117,11 +117,12 @@ var slicer = new D3D.Slicer().setGeometry(geometry);
|
||||
|
||||
var gcode = slicer.getGcode(printer);
|
||||
|
||||
/*var canvas = document.getElementById("canvas");
|
||||
var canvas = document.getElementById("canvas");
|
||||
var context = canvas.getContext("2d");
|
||||
|
||||
var img = slicer.drawPaths(printer, 0, 1);
|
||||
context.drawImage(img, 0, 0);*/
|
||||
var layer = 90;
|
||||
var img = slicer.drawPaths(printer, layer, layer + 1);
|
||||
context.drawImage(img, 0, 0);
|
||||
|
||||
(function animate () {
|
||||
"use strict";
|
||||
|
@ -230,11 +230,9 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
||||
|
||||
var fillArea = this.getInset((inset || outerLayer), wallThickness);
|
||||
|
||||
var highFill;
|
||||
|
||||
var fillAbove = undefined;
|
||||
var fillAbove = false;
|
||||
//for (var i = 1; i < shellThickness/layerHeight; i ++) {
|
||||
for (var i = 1; i < shellThickness/layerHeight + 4; i ++) {
|
||||
for (var i = 1; i < shellThickness/layerHeight; i ++) {
|
||||
var newLayer = ClipperLib.JS.Clone(slices[layer + i]);
|
||||
ClipperLib.JS.ScaleUpPaths(newLayer, scale);
|
||||
|
||||
@ -243,13 +241,13 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
||||
|
||||
break;
|
||||
}
|
||||
else if (fillAbove === undefined) {
|
||||
else if (fillAbove === false) {
|
||||
fillAbove = newLayer;
|
||||
}
|
||||
else {
|
||||
var c = new ClipperLib.Clipper();
|
||||
var solution = new ClipperLib.Paths();
|
||||
c.AddPaths(fillArea, ClipperLib.PolyType.ptSubject, true);
|
||||
c.AddPaths(newLayer, ClipperLib.PolyType.ptSubject, true);
|
||||
c.AddPaths(fillAbove, ClipperLib.PolyType.ptClip, true);
|
||||
c.Execute(ClipperLib.ClipType.ctIntersection, solution);
|
||||
|
||||
@ -453,8 +451,6 @@ D3D.Slicer.prototype.drawPaths = function (printer, min, max) {
|
||||
var context = canvas.getContext("2d");
|
||||
|
||||
for (var layer = min; layer < max; layer ++) {
|
||||
var layer = 0;
|
||||
context.clearRect(0, 0, 400, 400);
|
||||
var slice = data[layer % data.length];
|
||||
|
||||
drawPolygons(slice.outerLayer, "red");
|
||||
|
Loading…
Reference in New Issue
Block a user