Skip to content

Commit 64fa3e8

Browse files
committed
checkpoint
1 parent 86329ad commit 64fa3e8

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

docs/exporters/EXPORTERS.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,25 @@ const { Exporter } = require("@jgphilpott/polyslice");
108108
async function printFile(filepath) {
109109
// Read G-code file
110110
const gcode = fs.readFileSync(filepath, "utf8");
111-
111+
112112
// Connect to printer
113113
await Exporter.connectSerial({
114114
path: "/dev/ttyUSB0",
115115
baudRate: 115200
116116
});
117-
117+
118118
console.log("Connected! Starting print...");
119-
119+
120120
// Stream with acknowledgment (recommended for Node.js)
121121
const result = await Exporter.streamGCodeWithAck(gcode, {
122122
onProgress: (current, total, line) => {
123123
const percent = Math.round((current / total) * 100);
124124
process.stdout.write(`\rProgress: ${percent}%`);
125125
}
126126
});
127-
127+
128128
console.log(`\nComplete! Sent ${result.totalLines} lines.`);
129-
129+
130130
// Disconnect
131131
await Exporter.disconnectSerial();
132132
}
@@ -143,16 +143,16 @@ const exporter = window.PolysliceExporter;
143143
async function streamToPrinter(gcode) {
144144
// Connect (will prompt user to select port)
145145
await exporter.connectSerial({ baudRate: 115200 });
146-
146+
147147
// Stream with delay (browser must use delay-based method)
148148
await exporter.streamGCode(gcode, {
149149
delay: 50, // 50ms between lines
150150
onProgress: (current, total, line) => {
151-
document.getElementById("progress").textContent =
151+
document.getElementById("progress").textContent =
152152
`${current}/${total}: ${line}`;
153153
}
154154
});
155-
155+
156156
// Disconnect
157157
await exporter.disconnectSerial();
158158
}
@@ -169,29 +169,29 @@ async function sliceAndPrint(mesh) {
169169
printer: new Printer("Ender3"),
170170
filament: new Filament("GenericPLA")
171171
});
172-
172+
173173
// 2. Generate G-code
174174
const gcode = slicer.slice(mesh);
175-
175+
176176
// 3. Save a copy to file
177177
await Exporter.saveToFile(gcode, "print-backup.gcode");
178-
178+
179179
// 4. Connect to printer
180180
await Exporter.connectSerial({
181181
path: "/dev/ttyUSB0",
182182
baudRate: 115200
183183
});
184-
184+
185185
// 5. Stream to printer with acknowledgment
186186
await Exporter.streamGCodeWithAck(gcode, {
187187
onProgress: (current, total) => {
188188
console.log(`${Math.round((current / total) * 100)}%`);
189189
}
190190
});
191-
191+
192192
// 6. Disconnect
193193
await Exporter.disconnectSerial();
194-
194+
195195
console.log("Print complete!");
196196
}
197197
```

src/slicer/adhesion/brim/brim.coffee

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,25 +186,25 @@ module.exports =
186186
# Optimize starting point to be closest to home position (for first loop) or previous end
187187
# This prevents corner clipping artifacts
188188
if brimPath.length >= 3
189-
189+
190190
# For the first path, start closest to home position (0, 0 in build plate coords)
191191
# For subsequent paths, start closest to where we last ended
192192
referenceX = if loopIndex is 0 and pathIdx is 0 then -centerOffsetX else prevPoint?.x ? -centerOffsetX
193193
referenceY = if loopIndex is 0 and pathIdx is 0 then -centerOffsetY else prevPoint?.y ? -centerOffsetY
194-
194+
195195
# Find the point in the path closest to the reference position
196196
minDistSq = Infinity
197197
bestStartIndex = 0
198-
198+
199199
for point, idx in brimPath
200200
dx = point.x - referenceX
201201
dy = point.y - referenceY
202202
distSq = dx * dx + dy * dy
203-
203+
204204
if distSq < minDistSq
205205
minDistSq = distSq
206206
bestStartIndex = idx
207-
207+
208208
# Rotate the path to start at the best point
209209
if bestStartIndex > 0
210210
brimPath = brimPath[bestStartIndex...].concat(brimPath[0...bestStartIndex])

src/slicer/adhesion/skirt/skirt.coffee

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,25 +304,25 @@ module.exports =
304304
# Optimize starting point to be closest to home position (for first loop) or previous end
305305
# This prevents corner clipping artifacts
306306
if skirtPath.length >= 3
307-
307+
308308
# For the first path, start closest to home position (0, 0 in build plate coords)
309309
# For subsequent paths, start closest to where we last ended
310310
referenceX = if loopIndex is 0 and pathIdx is 0 then -centerOffsetX else prevPoint?.x ? -centerOffsetX
311311
referenceY = if loopIndex is 0 and pathIdx is 0 then -centerOffsetY else prevPoint?.y ? -centerOffsetY
312-
312+
313313
# Find the point in the path closest to the reference position
314314
minDistSq = Infinity
315315
bestStartIndex = 0
316-
316+
317317
for point, idx in skirtPath
318318
dx = point.x - referenceX
319319
dy = point.y - referenceY
320320
distSq = dx * dx + dy * dy
321-
321+
322322
if distSq < minDistSq
323323
minDistSq = distSq
324324
bestStartIndex = idx
325-
325+
326326
# Rotate the path to start at the best point
327327
if bestStartIndex > 0
328328
skirtPath = skirtPath[bestStartIndex...].concat(skirtPath[0...bestStartIndex])

0 commit comments

Comments
 (0)