diff --git a/Prusaslicer/Fuzzyficator_Prusaslicer.py b/Prusaslicer/Fuzzyficator_Prusaslicer.py index 4c793e2..8b5f622 100644 --- a/Prusaslicer/Fuzzyficator_Prusaslicer.py +++ b/Prusaslicer/Fuzzyficator_Prusaslicer.py @@ -167,7 +167,23 @@ def interpolate_with_constant_resolution(start_point, end_point, segment_length, new_gcode.append(line) elif line.startswith(';LAYER:'): new_gcode.append(line) - elif 'G1' in line and 'Z' in line: + + elif in_top_solid_infill and line.startswith('G1') and 'X' in line and 'Y' in line and not 'E' in line and not 'Z' in line: + logging.info("Processed a travel move") + + coordinates = {param[0]: float(param[1:]) for param in line.split() if param[0] in 'XY'} + logging.debug(f"Extracted coordinates: {coordinates}") + + current_point = ( + coordinates.get('X', previous_point[0] if previous_point else 0), + coordinates.get('Y', previous_point[1] if previous_point else 0), + coordinates.get('Z', coordinates.get('Z', current_layer_height)) + ) + previous_point = current_point # Update previous point after travel move + + new_gcode.append(line) + + elif 'G1' in line and 'Z' in line and not 'X' in line: # Update the current layer height based on the Z value in the G1 command z_match = re.search(r'Z([-+]?[0-9]*\.?[0-9]+)', line) if z_match: