From af96629b76fa9cb6b5e6c406b55c0ba523d3578b Mon Sep 17 00:00:00 2001 From: Nicolas Predella Date: Wed, 6 May 2026 17:28:35 +0300 Subject: [PATCH] nonplanar and preview --- __init__.py | 7 +------ core/slice.py | 7 ++++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/__init__.py b/__init__.py index 9734de1..377d42a 100644 --- a/__init__.py +++ b/__init__.py @@ -294,7 +294,6 @@ class SLICENODE_SliceShells(SliceNode): return slices - @register_class class SLICENODE_BufferShells(SliceNode): bl_label = "Buffer Shells" @@ -567,11 +566,7 @@ class SLICENODE_GcodeToMesh(ExecSliceNode): new_e = params.get('E', last_e) if cmd == 'G1': - # Check if it's an extrusion move - # In absolute mode (typical), E must increase. - # In relative mode, E must be > 0. - # We'll assume absolute mode as per Pather.to_gcode() M82 - is_extruding = new_e > last_e + is_extruding = new_e > 0 if is_extruding: segments.append(((last_x, last_y, last_z), (new_x, new_y, new_z))) diff --git a/core/slice.py b/core/slice.py index 2205b8f..a3f442e 100644 --- a/core/slice.py +++ b/core/slice.py @@ -331,6 +331,7 @@ class Pather(object): ] last_z = -1.0 + max_z = 0 for line in self.paths: coords = line.tolist() @@ -341,7 +342,7 @@ class Pather(object): if abs(z0 - last_z) > 0.001: gcode.append(f";BEFORE_LAYER_CHANGE") - gcode.append(f"G1 Z{z0:.3f} F720") + gcode.append(f"G0 Z{z0:.3f} F720") gcode.append(f";AFTER_LAYER_CHANGE") last_z = z0 @@ -350,11 +351,11 @@ class Pather(object): for p1, p2 in zip(coords, coords[1:]): seg_len: float = segment_length_3d(p1, p2) - # Calculate extrusion for this segment only e_segment = seg_len * self.extrusion_rate x, y, z = p2 gcode.append( f"G1 X{x:.3f} Y{y:.3f} Z{z:.3f} E{e_segment:.5f} F{self.feedrate}" ) - + max_z = max(max_z, z) + return "\n".join(gcode) \ No newline at end of file