mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 19:43:48 +01:00
replace vars with const and let
This commit is contained in:
parent
6891e09b54
commit
1cddce9e69
@ -19,34 +19,32 @@ export default function generateInfills(slices, settings) {
|
|||||||
nozzleDiameter *= scale;
|
nozzleDiameter *= scale;
|
||||||
infillOverlap *= scale;
|
infillOverlap *= scale;
|
||||||
|
|
||||||
var bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
|
const bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
|
||||||
var topSkinCount = Math.ceil(topThickness/layerHeight);
|
const topSkinCount = Math.ceil(topThickness/layerHeight);
|
||||||
var nozzleRadius = nozzleDiameter / 2;
|
const nozzleRadius = nozzleDiameter / 2;
|
||||||
var hightemplateSize = Math.sqrt(2 * Math.pow(nozzleDiameter, 2));
|
const hightemplateSize = Math.sqrt(2 * Math.pow(nozzleDiameter, 2));
|
||||||
|
|
||||||
for (var layer = 0; layer < slices.length; layer ++) {
|
for (let layer = 0; layer < slices.length; layer ++) {
|
||||||
var slice = slices[layer];
|
const slice = slices[layer];
|
||||||
|
|
||||||
|
let surroundingLayer;
|
||||||
if (layer - bottomSkinCount >= 0 && layer + topSkinCount < slices.length) {
|
if (layer - bottomSkinCount >= 0 && layer + topSkinCount < slices.length) {
|
||||||
var downSkin = slices[layer - bottomSkinCount].getOutline();
|
const downSkin = slices[layer - bottomSkinCount].getOutline();
|
||||||
var upSkin = slices[layer + topSkinCount].getOutline();
|
const upSkin = slices[layer + topSkinCount].getOutline();
|
||||||
var surroundingLayer = upSkin.intersect(downSkin);
|
surroundingLayer = upSkin.intersect(downSkin);
|
||||||
}
|
|
||||||
else {
|
|
||||||
var surroundingLayer = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < slice.parts.length; i ++) {
|
for (let i = 0; i < slice.parts.length; i ++) {
|
||||||
var part = slice.parts[i];
|
const part = slice.parts[i];
|
||||||
|
|
||||||
if (!part.shape.closed) {
|
if (!part.shape.closed) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var outerLine = part.outerLine;
|
const outerLine = part.outerLine;
|
||||||
|
|
||||||
if (outerLine.paths.length > 0) {
|
if (outerLine.paths.length > 0) {
|
||||||
var inset = (part.innerLines.length > 0) ? part.innerLines[part.innerLines.length - 1] : outerLine;
|
const inset = (part.innerLines.length > 0) ? part.innerLines[part.innerLines.length - 1] : outerLine;
|
||||||
|
|
||||||
const fillArea = inset.offset(-nozzleRadius);
|
const fillArea = inset.offset(-nozzleRadius);
|
||||||
let lowFillArea;
|
let lowFillArea;
|
||||||
@ -67,16 +65,16 @@ export default function generateInfills(slices, settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lowFillArea && lowFillArea.paths.length > 0) {
|
if (lowFillArea && lowFillArea.paths.length > 0) {
|
||||||
var bounds = lowFillArea.shapeBounds();
|
const bounds = lowFillArea.shapeBounds();
|
||||||
var lowFillTemplate = getFillTemplate(bounds, fillGridSize, true, true);
|
const lowFillTemplate = getFillTemplate(bounds, fillGridSize, true, true);
|
||||||
|
|
||||||
part.fill.join(lowFillTemplate.intersect(lowFillArea));
|
part.fill.join(lowFillTemplate.intersect(lowFillArea));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highFillArea.paths.length > 0) {
|
if (highFillArea.paths.length > 0) {
|
||||||
var bounds = highFillArea.shapeBounds();
|
const bounds = highFillArea.shapeBounds();
|
||||||
var even = (layer % 2 === 0);
|
const even = (layer % 2 === 0);
|
||||||
var highFillTemplate = getFillTemplate(bounds, hightemplateSize, even, !even);
|
const highFillTemplate = getFillTemplate(bounds, hightemplateSize, even, !even);
|
||||||
|
|
||||||
part.fill.join(highFillTemplate.intersect(highFillArea));
|
part.fill.join(highFillTemplate.intersect(highFillArea));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user