mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 21:47:59 +01:00
combine interlines and outline into shell
This commit is contained in:
parent
d380db1d7a
commit
72db7105fb
@ -37,7 +37,7 @@ outerShell:
|
||||
speed: 40.0
|
||||
innerInfill:
|
||||
flowRate: 1.0
|
||||
speed: 50.0
|
||||
speed: 80.0
|
||||
gridSize: 5.0
|
||||
outerInfill:
|
||||
flowRate: 1.0
|
||||
|
@ -34,16 +34,13 @@ export default function generateInfills(slices, settings) {
|
||||
for (let i = 0; i < slice.parts.length; i ++) {
|
||||
const part = slice.parts[i];
|
||||
|
||||
if (!part.shape.closed) {
|
||||
continue;
|
||||
}
|
||||
if (!part.shape.closed) continue;
|
||||
|
||||
const outerLine = part.outerLine;
|
||||
const innerShell = part.shell[part.shell.length - 1];
|
||||
|
||||
if (outerLine.paths.length > 0) {
|
||||
const inset = (part.innerLines.length > 0) ? part.innerLines[part.innerLines.length - 1] : outerLine;
|
||||
if (innerShell.paths.length === 0) continue;
|
||||
|
||||
const fillArea = inset.offset(-nozzleRadius);
|
||||
const fillArea = innerShell.offset(-nozzleRadius);
|
||||
let innerFillArea;
|
||||
let outerFillArea;
|
||||
if (surroundingLayer) {
|
||||
@ -70,4 +67,3 @@ export default function generateInfills(slices, settings) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export default function generateInnerLines(slices, settings) {
|
||||
shellThickness /= PRECISION;
|
||||
|
||||
const nozzleRadius = nozzleDiameter / 2;
|
||||
const shells = Math.round(shellThickness / nozzleDiameter);
|
||||
const numShells = Math.round(shellThickness / nozzleDiameter);
|
||||
|
||||
for (let layer = 0; layer < slices.length; layer ++) {
|
||||
const slice = slices[layer];
|
||||
@ -32,16 +32,16 @@ export default function generateInnerLines(slices, settings) {
|
||||
const outerLine = part.shape.offset(-nozzleRadius, offsetOptions);
|
||||
|
||||
if (outerLine.paths.length > 0) {
|
||||
part.outerLine.join(outerLine);
|
||||
part.shell.push(outerLine);
|
||||
|
||||
// start with 1 because outerLine is the 1st (0) shell
|
||||
for (let shell = 1; shell < shells; shell += 1) {
|
||||
const offset = shell * nozzleDiameter;
|
||||
for (let inset = 1; inset < numShells; inset += 1) {
|
||||
const offset = inset * nozzleDiameter;
|
||||
|
||||
const innerLine = outerLine.offset(-offset, offsetOptions);
|
||||
const shell = outerLine.offset(-offset, offsetOptions);
|
||||
|
||||
if (innerLine.paths.length > 0) {
|
||||
part.innerLines.push(innerLine);
|
||||
if (shell.paths.length > 0) {
|
||||
part.shell.push(shell);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -5,7 +5,10 @@ export default function calculateOutlines(slices, settings) {
|
||||
const slice = slices[layer];
|
||||
|
||||
slice.outline = slice.parts.reduce((shape, part) => {
|
||||
if (part.outerLine) shape.join(part.outerLine);
|
||||
if (part.shape.closed) {
|
||||
const [outerLine] = part.shell;
|
||||
shape.join(outerLine);
|
||||
}
|
||||
return shape;
|
||||
}, new Shape([], true));
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ export default class {
|
||||
const part = { shape };
|
||||
|
||||
if (shape.closed) {
|
||||
part.innerLines = [];
|
||||
part.outerLine = new Shape([], true);
|
||||
part.shell = [];
|
||||
part.innerFill = new Shape([], false);
|
||||
part.outerFill = new Shape([], false);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export default function optimizePaths(slices, settings) {
|
||||
for (let i = 0; i < slice.parts.length; i ++) {
|
||||
const part = slice.parts[i];
|
||||
|
||||
const shape = part.shape.closed ? part.outerLine : part.shape;
|
||||
const shape = part.shape.closed ? part.shell[0] : part.shape;
|
||||
const bounds = shape.shapeBounds();
|
||||
|
||||
boundingBoxes.set(part, bounds);
|
||||
@ -48,9 +48,13 @@ export default function optimizePaths(slices, settings) {
|
||||
parts.push(part);
|
||||
|
||||
if (part.shape.closed) {
|
||||
if (part.innerFill.paths.length > 0) {
|
||||
part.innerFill = optimizeShape(part.innerFill, start);
|
||||
start.copy(part.innerFill.lastPoint(true));
|
||||
for (let i = 0; i < part.shell.length; i ++) {
|
||||
const shell = part.shell[i];
|
||||
|
||||
if (shell.paths.length === 0) continue;
|
||||
|
||||
part.shell[i] = optimizeShape(shell, start);
|
||||
start.copy(part.shell[i].lastPoint(true));
|
||||
}
|
||||
|
||||
if (part.outerFill.paths.length > 0) {
|
||||
@ -58,18 +62,9 @@ export default function optimizePaths(slices, settings) {
|
||||
start.copy(part.outerFill.lastPoint(true));
|
||||
}
|
||||
|
||||
for (let i = 0; i < part.innerLines.length; i ++) {
|
||||
const innerLine = part.innerLines[i];
|
||||
|
||||
if (innerLine.paths.length > 0) {
|
||||
part.innerLines[i] = optimizeShape(innerLine, start);
|
||||
start.copy(part.innerLines[i].lastPoint(true));
|
||||
}
|
||||
}
|
||||
|
||||
if (part.outerLine.paths.length > 0) {
|
||||
part.outerLine = optimizeShape(part.outerLine, start);
|
||||
start.copy(part.outerLine.lastPoint(true));
|
||||
if (part.innerFill.paths.length > 0) {
|
||||
part.innerFill = optimizeShape(part.innerFill, start);
|
||||
start.copy(part.innerFill.lastPoint(true));
|
||||
}
|
||||
} else {
|
||||
part.shape = optimizeShape(part.shape, start);
|
||||
|
@ -10,9 +10,8 @@ export default function removePrecision(slices) {
|
||||
const part = slice.parts[i];
|
||||
|
||||
if (part.shape.closed) {
|
||||
part.outerLine.scaleDown(inversePrecision);
|
||||
for (let i = 0; i < part.innerLines.length; i ++) {
|
||||
const innerLine = part.innerLines[i];
|
||||
for (let i = 0; i < part.shell.length; i ++) {
|
||||
const innerLine = part.shell[i];
|
||||
innerLine.scaleDown(inversePrecision);
|
||||
}
|
||||
part.innerFill.scaleDown(inversePrecision);
|
||||
|
@ -49,15 +49,17 @@ export default function slicesToGCode(slices, settings) {
|
||||
const part = slice.parts[i];
|
||||
|
||||
if (part.shape.closed) {
|
||||
pathToGCode(gcode, part.innerFill, false, true, z, profiles.innerInfill);
|
||||
pathToGCode(gcode, part.outerFill, false, false, z, profiles.outerInfill);
|
||||
for (let i = 0; i < part.shell.length; i ++) {
|
||||
const shell = part.shell[i];
|
||||
const isOuterShell = i === 0;
|
||||
|
||||
for (let i = 0; i < part.innerLines.length; i ++) {
|
||||
const innerLine = part.innerLines[i];
|
||||
pathToGCode(gcode, innerLine, false, false, z, profiles.innerShell);
|
||||
const unRetract = isOuterShell;
|
||||
const profile = isOuterShell ? profiles.outerShell : profiles.innerShell;
|
||||
pathToGCode(gcode, shell, false, unRetract, z, profile);
|
||||
}
|
||||
|
||||
pathToGCode(gcode, part.outerLine, true, false, z, profiles.outerShell);
|
||||
pathToGCode(gcode, part.outerFill, false, false, z, profiles.outerInfill);
|
||||
pathToGCode(gcode, part.innerFill, true, false, z, profiles.innerInfill);
|
||||
} else {
|
||||
const retract = !(slice.parts.length === 1 && typeof slice.support === 'undefined');
|
||||
pathToGCode(gcode, part.shape, retract, retract, z, profiles.outerShell);
|
||||
|
Loading…
Reference in New Issue
Block a user