File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff 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 = {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments