Skip to content

Commit 52016f1

Browse files
Copilotjgphilpott
andcommitted
Fix smart wipe nozzle feature not triggered during slicing
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
1 parent 07a48a4 commit 52016f1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/slicer/slice.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ module.exports =
182182
centerOffsetX = (buildPlateWidth / 2) - meshCenterX
183183
centerOffsetY = (buildPlateLength / 2) - meshCenterY
184184

185-
# Store center offsets for smart wipe nozzle in post-print.
185+
# Store center offsets and raw mesh bounds for smart wipe nozzle in post-print.
186186
slicer.centerOffsetX = centerOffsetX
187187
slicer.centerOffsetY = centerOffsetY
188+
slicer._meshBounds = boundingBox
188189

189190
# Store bounding box for metadata (convert to build plate coordinates)
190191
slicer.meshBounds = {

src/slicer/slice.test.coffee

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,23 @@ describe 'Slicing', ->
322322
# Slice the mesh.
323323
result = slicer.slice(mesh)
324324

325-
# Parse G-code to find actual print coordinates (only extrusion moves).
325+
# Parse G-code to find actual print coordinates (only absolute extrusion moves).
326326
lines = result.split('\n')
327327
minX = Infinity
328328
maxX = -Infinity
329329
minY = Infinity
330330
maxY = -Infinity
331+
isRelative = false
331332

332333
for line in lines
333-
if (line.indexOf('G1 ') is 0 or line.indexOf('G0 ') is 0) and line.indexOf('E') > -1
334+
335+
# Track positioning mode to skip relative moves (e.g. smart wipe).
336+
if line.indexOf('G91') is 0
337+
isRelative = true
338+
else if line.indexOf('G90') is 0
339+
isRelative = false
340+
341+
if not isRelative and (line.indexOf('G1 ') is 0 or line.indexOf('G0 ') is 0) and line.indexOf('E') > -1
334342
xMatch = line.match(/X([-\d.]+)/)
335343
yMatch = line.match(/Y([-\d.]+)/)
336344
if xMatch

0 commit comments

Comments
 (0)