Skip to content

Commit

Permalink
[CURA-11485] Fix: z-offset as a property of gcode paths (#2042)
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton authored Mar 7, 2024
2 parents 8c370bd + 25e134d commit fd753dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,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);
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,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;
Expand Down Expand Up @@ -420,7 +421,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(),
Expand Down Expand Up @@ -451,6 +453,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()),
Expand Down

0 comments on commit fd753dd

Please sign in to comment.