From 7c97bad396d8f7e1e10f578c29b1deee583aed2d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 16 Nov 2023 13:12:10 +0100 Subject: [PATCH 1/2] Add .z_offset to gcode-path. The 'just get it working' version. Needs updated grpc-definitions! part of CURA-11265 --- src/LayerPlan.cpp | 4 ++++ src/plugins/converters.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 52305a9521..78887c04a4 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -2036,6 +2036,10 @@ void LayerPlan::writeGCode(GCodeExport& gcode) else { gcode.writeZhopEnd(); + if (z > 0 && path.z_offset != 0) + { + gcode.setZ(z + path.z_offset); + } } } const auto& extruder_changed = ! last_extrusion_config.has_value() || (last_extrusion_config.value().type != path.config.type); diff --git a/src/plugins/converters.cpp b/src/plugins/converters.cpp index 72a8166de7..f3cb1268c0 100644 --- a/src/plugins/converters.cpp +++ b/src/plugins/converters.cpp @@ -358,6 +358,7 @@ gcode_paths_modify_request::value_type gcode_path->set_layer_thickness(path.config.getLayerThickness()); gcode_path->set_flow_ratio(path.config.getFlowRatio()); gcode_path->set_is_bridge_path(path.config.isBridgePath()); + gcode_path->set_z_offset(path.config.z_offset); } return message; @@ -417,7 +418,8 @@ gcode_paths_modify_request::value_type [[nodiscard]] GCodePathConfig gcode_paths_modify_response::buildConfig(const v0::GCodePath& path) { - return { .type = getPrintFeatureType(path.feature()), + return { .z_offset = path.z_offset(), + .type = getPrintFeatureType(path.feature()), .line_width = path.line_width(), .layer_thickness = path.layer_thickness(), .flow = path.flow_ratio(), @@ -448,6 +450,7 @@ gcode_paths_modify_response::native_value_type for (const auto& gcode_path_msg : message.gcode_paths()) { GCodePath path{ + .z_offset = gcode_path_msg.z_offset(), .config = buildConfig(gcode_path_msg), .mesh = gcode_path_msg.mesh_name().empty() ? nullptr : meshes.at(gcode_path_msg.mesh_name()), .space_fill_type = getSpaceFillType(gcode_path_msg.space_fill_type()), From 25e134de6bf62a469ab6806733522f2210efc286 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 6 Mar 2024 18:28:47 +0100 Subject: [PATCH 2/2] Update branch to surrounding code. part of CURA-11485 (also ref CURA-11265) --- src/LayerPlan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index f0a029cf03..fa4787b24e 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -2150,9 +2150,9 @@ void LayerPlan::writeGCode(GCodeExport& gcode) else { gcode.writeZhopEnd(); - if (z > 0 && path.z_offset != 0) + if (z_ > 0 && path.z_offset != 0) { - gcode.setZ(z + path.z_offset); + gcode.setZ(z_ + path.z_offset); } } }