mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 03:23:48 +01:00
pre calculate outer lines
This commit is contained in:
parent
44197dd5e4
commit
8e45881a45
@ -26,8 +26,8 @@ export default function generateInfills(slices, settings) {
|
||||
|
||||
let surroundingLayer;
|
||||
if (layer - bottomSkinCount >= 0 && layer + topSkinCount < slices.length) {
|
||||
const downSkin = slices[layer - bottomSkinCount].getOutline();
|
||||
const upSkin = slices[layer + topSkinCount].getOutline();
|
||||
const downSkin = slices[layer - bottomSkinCount].outline;
|
||||
const upSkin = slices[layer + topSkinCount].outline;
|
||||
surroundingLayer = upSkin.intersect(downSkin);
|
||||
}
|
||||
|
||||
|
12
src/sliceActions/generateOutlines.js
Normal file
12
src/sliceActions/generateOutlines.js
Normal file
@ -0,0 +1,12 @@
|
||||
import Shape from 'Doodle3D/clipper-js';
|
||||
|
||||
export default function calculateOutlines(slices, settings) {
|
||||
for (let layer = 0; layer < slices.length; layer ++) {
|
||||
const slice = slices[layer];
|
||||
|
||||
slice.outline = slice.parts.reduce((shape, part) => {
|
||||
if (part.outerLine) shape.join(part.outerLine);
|
||||
return shape;
|
||||
}, new Shape([], true));
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ export default function generateSupport(slices, settings) {
|
||||
if (supportAreas.length > 0) {
|
||||
|
||||
if (layer >= supportDistanceLayers) {
|
||||
var sliceSkin = slices[layer - supportDistanceLayers].getOutline();
|
||||
var sliceSkin = slices[layer - supportDistanceLayers].outline;
|
||||
sliceSkin = sliceSkin;
|
||||
|
||||
var supportAreasSlimmed = supportAreas.difference(sliceSkin.offset(supportMargin));
|
||||
@ -52,7 +52,7 @@ export default function generateSupport(slices, settings) {
|
||||
}
|
||||
}
|
||||
|
||||
var supportSkin = slices[layer + supportDistanceLayers - 1].getOutline();
|
||||
var supportSkin = slices[layer + supportDistanceLayers - 1].outline;
|
||||
|
||||
var slice = slices[layer + supportDistanceLayers];
|
||||
for (var i = 0; i < slice.parts.length; i ++) {
|
||||
|
@ -4,12 +4,6 @@ export default class {
|
||||
constructor() {
|
||||
this.parts = [];
|
||||
}
|
||||
getOutline() {
|
||||
return this.parts.reduce((shape, part) => {
|
||||
if (part.outerLine) shape.join(part.outerLine);
|
||||
return shape;
|
||||
}, new Shape([], true));
|
||||
}
|
||||
add(shape) {
|
||||
const part = { shape };
|
||||
|
||||
|
@ -2,6 +2,7 @@ import calculateLayersIntersections from './calculateLayersIntersections.js';
|
||||
import createLines from './createLines.js';
|
||||
import generateInfills from './generateInfills.js';
|
||||
import generateInnerLines from './generateInnerLines.js';
|
||||
import generateOutlines from './generateOutlines.js';
|
||||
import generateSupport from './generateSupport.js';
|
||||
import intersectionsToShapes from './intersectionsToShapes.js';
|
||||
import addBrim from './addBrim.js';
|
||||
@ -45,6 +46,8 @@ export default function(geometry, settings, onProgress) {
|
||||
|
||||
updateProgress('Generating inner lines');
|
||||
generateInnerLines(slices, settings);
|
||||
updateProgress('Generating out lines');
|
||||
generateOutlines(slices, settings);
|
||||
updateProgress('Generating infills');
|
||||
generateInfills(slices, settings);
|
||||
updateProgress('Generating support');
|
||||
|
Loading…
Reference in New Issue
Block a user