mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 21:47:59 +01:00
parent
bcf62c71ec
commit
9805991d9f
@ -2,49 +2,49 @@ dimensions:
|
|||||||
x: 200
|
x: 200
|
||||||
y: 200
|
y: 200
|
||||||
z: 200
|
z: 200
|
||||||
temperature: 210
|
|
||||||
bedTemperature: 70
|
|
||||||
# heatBedTemperature: 20
|
|
||||||
# heatTemperature: 20
|
|
||||||
# heatupEnabled: true
|
|
||||||
travelSpeed: 200.0
|
|
||||||
layerHeight: 0.15
|
|
||||||
heatedBed: false
|
heatedBed: false
|
||||||
nozzleDiameter: 0.4
|
nozzleDiameter: 0.4
|
||||||
filamentThickness: 2.85
|
filamentThickness: 2.85
|
||||||
|
temperature: 210
|
||||||
|
bedTemperature: 70
|
||||||
|
layerHeight: 0.15
|
||||||
|
brimOffset: 4.0
|
||||||
|
thickness:
|
||||||
|
top: 1.2
|
||||||
|
bottom: 1.2
|
||||||
|
shell: 0.8
|
||||||
retraction:
|
retraction:
|
||||||
amount: 3.0
|
|
||||||
enabled: true
|
enabled: true
|
||||||
|
amount: 3.0
|
||||||
speed: 50.0
|
speed: 50.0
|
||||||
minDistance: 0.0
|
minDistance: 0.0
|
||||||
|
travel:
|
||||||
|
speed: 200.0
|
||||||
support:
|
support:
|
||||||
|
enabled: false
|
||||||
acceptanceMargin: 1.5
|
acceptanceMargin: 1.5
|
||||||
distanceY: 0.4
|
distanceY: 0.4
|
||||||
enabled: false
|
|
||||||
gridSize: 6.0
|
gridSize: 6.0
|
||||||
margin: 2.0
|
margin: 2.0
|
||||||
plateSize: 4.0
|
plateSize: 4.0
|
||||||
flowRate: 0.8
|
flowRate: 0.8
|
||||||
speed: 40.0
|
speed: 40.0
|
||||||
outerLine:
|
innerShell:
|
||||||
flowRate: 1.0
|
|
||||||
speed: 40.0
|
|
||||||
innerLine:
|
|
||||||
flowRate: 1.0
|
flowRate: 1.0
|
||||||
speed: 50.0
|
speed: 50.0
|
||||||
fill:
|
outerShell:
|
||||||
|
flowRate: 1.0
|
||||||
|
speed: 40.0
|
||||||
|
innerInfill:
|
||||||
flowRate: 1.0
|
flowRate: 1.0
|
||||||
speed: 50.0
|
speed: 50.0
|
||||||
gridSize: 5.0
|
gridSize: 5.0
|
||||||
|
outerInfill:
|
||||||
|
flowRate: 1.0
|
||||||
|
speed: 50.0
|
||||||
brim:
|
brim:
|
||||||
flowRate: 1.0
|
flowRate: 1.0
|
||||||
speed: 40.0
|
speed: 40.0
|
||||||
offset: 4.0
|
firstLayer:
|
||||||
top:
|
|
||||||
thickness: 1.2
|
|
||||||
bottom:
|
|
||||||
flowRate: 1.2
|
flowRate: 1.2
|
||||||
speed: 40.0
|
speed: 40.0
|
||||||
thickness: 0.4
|
|
||||||
shell:
|
|
||||||
thickness: 0.4
|
|
||||||
|
@ -5,15 +5,16 @@ import Shape from 'clipper-js';
|
|||||||
export default function generateInfills(slices, settings) {
|
export default function generateInfills(slices, settings) {
|
||||||
let {
|
let {
|
||||||
layerHeight,
|
layerHeight,
|
||||||
fill: { gridSize: fillGridSize },
|
innerInfill: { gridSize: infillGridSize },
|
||||||
bottom: { thickness: bottomThickness },
|
thickness: {
|
||||||
top: { thickness: topThickness },
|
top: topThickness,
|
||||||
|
bottom: bottomThickness
|
||||||
|
},
|
||||||
nozzleDiameter
|
nozzleDiameter
|
||||||
} = settings;
|
} = settings;
|
||||||
|
|
||||||
fillGridSize /= PRECISION;
|
infillGridSize /= PRECISION;
|
||||||
nozzleDiameter /= PRECISION;
|
nozzleDiameter /= PRECISION;
|
||||||
infillOverlap /= PRECISION;
|
|
||||||
|
|
||||||
const bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
|
const bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
|
||||||
const topSkinCount = Math.ceil(topThickness/layerHeight);
|
const topSkinCount = Math.ceil(topThickness/layerHeight);
|
||||||
@ -54,7 +55,7 @@ export default function generateInfills(slices, settings) {
|
|||||||
|
|
||||||
if (lowFillArea && lowFillArea.paths.length > 0) {
|
if (lowFillArea && lowFillArea.paths.length > 0) {
|
||||||
const bounds = lowFillArea.shapeBounds();
|
const bounds = lowFillArea.shapeBounds();
|
||||||
const lowFillTemplate = getFillTemplate(bounds, fillGridSize, true, true);
|
const lowFillTemplate = getFillTemplate(bounds, infillGridSize, true, true);
|
||||||
|
|
||||||
part.fill.join(lowFillTemplate.intersect(lowFillArea));
|
part.fill.join(lowFillTemplate.intersect(lowFillArea));
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,12 @@ export default function generateInnerLines(slices, settings) {
|
|||||||
let {
|
let {
|
||||||
layerHeight,
|
layerHeight,
|
||||||
nozzleDiameter,
|
nozzleDiameter,
|
||||||
shell: { thickness: shellThickness }
|
thickness: { shell: shellThickness }
|
||||||
} = settings;
|
} = settings;
|
||||||
|
|
||||||
nozzleDiameter /= PRECISION;
|
nozzleDiameter /= PRECISION;
|
||||||
shellThickness /= PRECISION;
|
shellThickness /= PRECISION;
|
||||||
|
|
||||||
const nozzleRadius = nozzleDiameter / 2;
|
const nozzleRadius = nozzleDiameter / 2;
|
||||||
const shells = Math.round(shellThickness / nozzleDiameter);
|
const shells = Math.round(shellThickness / nozzleDiameter);
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ export default class {
|
|||||||
if (this._isRetracted && enabled) {
|
if (this._isRetracted && enabled) {
|
||||||
this._isRetracted = false;
|
this._isRetracted = false;
|
||||||
|
|
||||||
const speed = retractionSpeed * 60;
|
speed *= 60;
|
||||||
|
|
||||||
if (this._extruder > retractionMinDistance) {
|
if (this._extruder > minDistance) {
|
||||||
this._addGCode({
|
this._addGCode({
|
||||||
[MOVE]: 0,
|
[MOVE]: 0,
|
||||||
[EXTRUDER]: this._extruder.toFixed(3),
|
[EXTRUDER]: this._extruder.toFixed(3),
|
||||||
@ -121,9 +121,9 @@ export default class {
|
|||||||
if (!this._isRetracted && enabled) {
|
if (!this._isRetracted && enabled) {
|
||||||
this._isRetracted = true;
|
this._isRetracted = true;
|
||||||
|
|
||||||
const speed = retractionSpeed * 60;
|
speed *= 60;
|
||||||
|
|
||||||
if (this._extruder > retractionMinDistance) {
|
if (this._extruder > minDistance) {
|
||||||
this._addGCode({
|
this._addGCode({
|
||||||
[MOVE]: 0,
|
[MOVE]: 0,
|
||||||
[EXTRUDER]: (this._extruder - retractionAmount).toFixed(3),
|
[EXTRUDER]: (this._extruder - retractionAmount).toFixed(3),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import GCode from './helpers/GCode.js';
|
import GCode from './helpers/GCode.js';
|
||||||
|
|
||||||
const PROFILE_TYPES = ['brim', 'outerLine', 'innerLine', 'fill', 'support'];
|
const PROFILE_TYPES = ['support', 'innerShell', 'outerShell', 'innerInfill', 'outerInfill', 'brim'];
|
||||||
|
|
||||||
export default function slicesToGCode(slices, settings) {
|
export default function slicesToGCode(slices, settings) {
|
||||||
const {
|
const {
|
||||||
@ -9,7 +9,7 @@ export default function slicesToGCode(slices, settings) {
|
|||||||
nozzleDiameter,
|
nozzleDiameter,
|
||||||
travelSpeed,
|
travelSpeed,
|
||||||
retraction,
|
retraction,
|
||||||
retractionEnabled
|
travel
|
||||||
} = settings;
|
} = settings;
|
||||||
|
|
||||||
const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
|
const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
|
||||||
@ -19,29 +19,24 @@ export default function slicesToGCode(slices, settings) {
|
|||||||
const gcode = new GCode(nozzleToFilamentRatio);
|
const gcode = new GCode(nozzleToFilamentRatio);
|
||||||
|
|
||||||
const defaultProfile = {
|
const defaultProfile = {
|
||||||
travelProfile: {
|
travelProfile: travel,
|
||||||
speed: travelSpeed
|
retractionProfile: retraction
|
||||||
},
|
|
||||||
retractProfile: {
|
|
||||||
...retraction,
|
|
||||||
enabled: retractionEnabled
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let isBottom = true;
|
let isFirstLayer = true;
|
||||||
for (let layer = 0; layer < slices.length; layer ++) {
|
for (let layer = 0; layer < slices.length; layer ++) {
|
||||||
const slice = slices[layer];
|
const slice = slices[layer];
|
||||||
const z = layer * layerHeight + 0.2;
|
const z = layer * layerHeight + 0.2;
|
||||||
|
|
||||||
if (layer === 1) {
|
if (layer === 1) {
|
||||||
gcode.turnFanOn();
|
gcode.turnFanOn();
|
||||||
isBottom = false;
|
isFirstLayer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const profiles = PROFILE_TYPES.reduce((profiles, profileType) => {
|
const profiles = PROFILE_TYPES.reduce((profiles, profileType) => {
|
||||||
profiles[profileType] = {
|
profiles[profileType] = {
|
||||||
...defaultProfile,
|
...defaultProfile,
|
||||||
lineProfile: isBottom ? settings.bottom : settings[profileType]
|
lineProfile: isFirstLayer ? settings.firstLayer : settings[profileType]
|
||||||
}
|
}
|
||||||
return profiles;
|
return profiles;
|
||||||
}, {});
|
}, {});
|
||||||
@ -54,17 +49,17 @@ export default function slicesToGCode(slices, settings) {
|
|||||||
const part = slice.parts[i];
|
const part = slice.parts[i];
|
||||||
|
|
||||||
if (part.shape.closed) {
|
if (part.shape.closed) {
|
||||||
pathToGCode(gcode, part.outerLine, false, true, profiles.outerLine);
|
pathToGCode(gcode, part.outerLine, false, true, profiles.outerShell);
|
||||||
|
|
||||||
for (let i = 0; i < part.innerLines.length; i ++) {
|
for (let i = 0; i < part.innerLines.length; i ++) {
|
||||||
const innerLine = part.innerLines[i];
|
const innerLine = part.innerLines[i];
|
||||||
pathToGCode(gcode, innerLine, false, false, z, profiles.innerLine);
|
pathToGCode(gcode, innerLine, false, false, z, profiles.innerShell);
|
||||||
}
|
}
|
||||||
|
|
||||||
pathToGCode(gcode, part.fill, true, false, z, profiles.fill);
|
pathToGCode(gcode, part.fill, true, false, z, profiles.outerInfill);
|
||||||
} else {
|
} else {
|
||||||
const retract = !(slice.parts.length === 1 && typeof slice.support === 'undefined');
|
const retract = !(slice.parts.length === 1 && typeof slice.support === 'undefined');
|
||||||
pathToGCode(gcode, part.shape, retract, retract, z, profiles.outerLine);
|
pathToGCode(gcode, part.shape, retract, retract, z, profiles.outerShell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +71,7 @@ export default function slicesToGCode(slices, settings) {
|
|||||||
return gcode.getGCode();
|
return gcode.getGCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelProfile, retractProfile }) {
|
function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelProfile, retractionProfile }) {
|
||||||
const { closed } = shape;
|
const { closed } = shape;
|
||||||
const paths = shape.mapToLower();
|
const paths = shape.mapToLower();
|
||||||
|
|
||||||
@ -93,7 +88,7 @@ function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelP
|
|||||||
gcode.moveTo(point.x, point.y, z, travelProfile);
|
gcode.moveTo(point.x, point.y, z, travelProfile);
|
||||||
|
|
||||||
if (unRetract) {
|
if (unRetract) {
|
||||||
gcode.unRetract(retractProfile);
|
gcode.unRetract(retractionProfile);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gcode.lineTo(point.x, point.y, z, lineProfile);
|
gcode.lineTo(point.x, point.y, z, lineProfile);
|
||||||
@ -102,6 +97,6 @@ function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelP
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (retract) {
|
if (retract) {
|
||||||
gcode.retract(retractProfile);
|
gcode.retract(retractionProfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user