mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-19 04:27:55 +01:00
move down path to code
This commit is contained in:
parent
bf0f504c34
commit
9d828e3fda
@ -1,32 +1,5 @@
|
||||
import GCode from '../gcode.js';
|
||||
|
||||
function pathToGCode(gcode, shape, retract, unRetract, layer, type) {
|
||||
for (let i = 0; i < shape.paths.length; i ++) {
|
||||
const line = shape.paths[i];
|
||||
|
||||
const length = shape.closed ? (line.length + 1) : line.length;
|
||||
for (let i = 0; i < length; i ++) {
|
||||
const point = line[i % line.length];
|
||||
|
||||
if (i === 0) {
|
||||
// TODO
|
||||
// moveTo should impliment combing
|
||||
gcode.moveTo(point.X, point.Y, layer);
|
||||
|
||||
if (unRetract) {
|
||||
gcode.unRetract();
|
||||
}
|
||||
} else {
|
||||
gcode.lineTo(point.X, point.Y, layer, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (retract) {
|
||||
gcode.retract();
|
||||
}
|
||||
}
|
||||
|
||||
export default function slicesToGCode(slices, settings) {
|
||||
const gcode = new GCode().setSettings(settings);
|
||||
|
||||
@ -67,3 +40,30 @@ export default function slicesToGCode(slices, settings) {
|
||||
|
||||
return gcode.getGCode();
|
||||
}
|
||||
|
||||
function pathToGCode(gcode, shape, retract, unRetract, layer, type) {
|
||||
for (let i = 0; i < shape.paths.length; i ++) {
|
||||
const line = shape.paths[i];
|
||||
|
||||
const length = shape.closed ? (line.length + 1) : line.length;
|
||||
for (let i = 0; i < length; i ++) {
|
||||
const point = line[i % line.length];
|
||||
|
||||
if (i === 0) {
|
||||
// TODO
|
||||
// moveTo should impliment combing
|
||||
gcode.moveTo(point.X, point.Y, layer);
|
||||
|
||||
if (unRetract) {
|
||||
gcode.unRetract();
|
||||
}
|
||||
} else {
|
||||
gcode.lineTo(point.X, point.Y, layer, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (retract) {
|
||||
gcode.retract();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user