Skip to content

Commit

Permalink
Don't register a new layer if not extruding a line
Browse files Browse the repository at this point in the history
We do retracts/unretracts on different heights sometimes, for instance after a pause. This would get seen as a new layer. It's quite safe to say that purely retracts and unretracts on a different height do not constitute a layer in a normal g-code file. There would be nothing to draw anyway.

Contributes to issue CURA-8522. Fixes Ultimaker#10282.
  • Loading branch information
Ghostkeeper committed Nov 5, 2021
1 parent 74ff28c commit fd5b248
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/GCodeReader/FlavorParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _gCode0(self, position: Position, params: PositionOptional, path: List[List[

# Only when extruding we can determine the latest known "layer height" which is the difference in height between extrusions
# Also, 1.5 is a heuristic for any priming or whatsoever, we skip those.
if z > self._previous_z and (z - self._previous_z < 1.5):
if z > self._previous_z and (z - self._previous_z < 1.5) and (params.x is not None or params.y is not None):
self._current_layer_thickness = z - self._previous_z # allow a tiny overlap
self._previous_z = z
elif self._previous_extrusion_value > e[self._extruder_number]:
Expand Down

0 comments on commit fd5b248

Please sign in to comment.