mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
move brim code to separate function
This commit is contained in:
parent
c8150c3bf7
commit
e16a5dda90
18
src/sliceActions/addBrim.js
Normal file
18
src/sliceActions/addBrim.js
Normal file
@ -0,0 +1,18 @@
|
||||
import THREE from 'three.js';
|
||||
import { PRECISION } from '../constants.js';
|
||||
|
||||
const offsetOptions = {
|
||||
jointType: 'jtSquare',
|
||||
endType: 'etClosedPolygon',
|
||||
miterLimit: 2.0,
|
||||
roundPrecision: 0.25
|
||||
};
|
||||
|
||||
export default function addBrim(slices, settings) {
|
||||
console.log('add brim');
|
||||
|
||||
const brimOffset = settings.config['brimOffset'] / PRECISION;
|
||||
|
||||
const fistLayer = slices[0];
|
||||
fistLayer.brim = fistLayer.getOutline().offset(brimOffset, offsetOptions);
|
||||
}
|
@ -1,27 +1,15 @@
|
||||
import THREE from 'three.js';
|
||||
import { PRECISION } from '../constants.js';
|
||||
|
||||
const offsetOptions = {
|
||||
jointType: 'jtSquare',
|
||||
endType: 'etClosedPolygon',
|
||||
miterLimit: 2.0,
|
||||
roundPrecision: 0.25
|
||||
};
|
||||
|
||||
export default function optimizePaths(slices, settings) {
|
||||
console.log("opimize paths");
|
||||
|
||||
const brimOffset = settings.config["brimOffset"] / PRECISION;
|
||||
|
||||
const start = new THREE.Vector2(0, 0);
|
||||
|
||||
for (let layer = 0; layer < slices.length; layer ++) {
|
||||
const slice = slices[layer];
|
||||
|
||||
if (layer === 0) {
|
||||
slice.brim = slice.getOutline().offset(brimOffset, offsetOptions);
|
||||
}
|
||||
|
||||
// start = slice.optimizePaths(start);
|
||||
|
||||
for (let i = 0; i < slice.parts.length; i ++) {
|
||||
|
@ -6,6 +6,7 @@ import generateInfills from './sliceActions/generateInfills.js';
|
||||
import generateInnerLines from './sliceActions/generateInnerLines.js';
|
||||
import generateSupport from './sliceActions/generateSupport.js';
|
||||
import intersectionsToShapes from './sliceActions/intersectionsToShapes.js';
|
||||
import addBrim from './sliceActions/addBrim.js';
|
||||
import optimizePaths from './sliceActions/optimizePaths.js';
|
||||
import shapesToSlices from './sliceActions/shapesToSlices.js';
|
||||
import slicesToGCode from './sliceActions/slicesToGCode.js';
|
||||
@ -96,6 +97,8 @@ export default class extends EventDispatcher {
|
||||
this._updateProgress(settings);
|
||||
}
|
||||
|
||||
addBrim(slices, settings);
|
||||
|
||||
optimizePaths(slices, settings);
|
||||
this.progress.optimizedPaths = true;
|
||||
this._updateProgress(settings);
|
||||
|
Loading…
Reference in New Issue
Block a user