From 8a2a9abbd48dcc6c3f11dc9445df32045d71f47a Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 13 Jun 2017 19:29:15 +0200 Subject: [PATCH] Fix of "Raft and support dont work together" https://github.com/prusa3d/Slic3r/issues/314 There was an issue with raft & soluble support. Also there was a bug, where the support was not generated correctly after a change of the support Z gap. --- xs/src/libslic3r/PrintObject.cpp | 4 ++-- xs/src/libslic3r/SupportMaterial.cpp | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index ee7d9cb19..30da8b4ae 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -159,14 +159,14 @@ bool PrintObject::invalidate_state_by_config_options(const std::vectorreset_layer_height_profile(); } else if ( - opt_key == "clip_multipart_objects" + opt_key == "clip_multipart_objects" + || opt_key == "support_material_contact_distance" || opt_key == "xy_size_compensation") { steps.emplace_back(posSlice); } else if ( opt_key == "support_material" || opt_key == "support_material_angle" || opt_key == "support_material_buildplate_only" - || opt_key == "support_material_contact_distance" || opt_key == "support_material_enforce_layers" || opt_key == "support_material_extruder" || opt_key == "support_material_extrusion_width" diff --git a/xs/src/libslic3r/SupportMaterial.cpp b/xs/src/libslic3r/SupportMaterial.cpp index 529a2df52..f3bf0fc40 100644 --- a/xs/src/libslic3r/SupportMaterial.cpp +++ b/xs/src/libslic3r/SupportMaterial.cpp @@ -891,7 +891,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_ // Interface layer will be synchronized with the object. assert(layer_id > 0); new_layer.height = object.layers[layer_id - 1]->height; - new_layer.bottom_z = new_layer.print_z - new_layer.height; + new_layer.bottom_z = (layer_id == 1) ? m_slicing_params.object_print_z_min : object.layers[layer_id - 2]->print_z; } } else { // Contact layer will be printed with a normal flow, but @@ -1044,11 +1044,11 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta // top shapes so this can be done here layer_new.height = m_slicing_params.soluble_interface ? // Align the interface layer with the object's layer height. - object.get_layer(layer_id + 1)->height : + object.layers[layer_id + 1]->height : // Place a bridge flow interface layer over the top surface. m_support_material_interface_flow.nozzle_diameter; - layer_new.print_z = layer.print_z + layer_new.height + - (m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value); + layer_new.print_z = m_slicing_params.soluble_interface ? object.layers[layer_id + 1]->print_z : + layer.print_z + layer_new.height + m_object_config->support_material_contact_distance.value; layer_new.bottom_z = layer.print_z; layer_new.idx_object_layer_below = layer_id; layer_new.bridging = ! m_slicing_params.soluble_interface; @@ -1382,12 +1382,20 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int // Find the first object layer, which has its print_z in this support Z range. while (idx_layer_object < object.layers.size() && object.layers[idx_layer_object]->print_z < extr1z + EPSILON) ++ idx_layer_object; + if (idx_layer_object == 0 && extr1z == m_slicing_params.raft_interface_top_z) { + // Insert one base support layer below the object. + MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate); + layer_new.print_z = m_slicing_params.object_print_z_min; + layer_new.bottom_z = m_slicing_params.raft_interface_top_z; + layer_new.height = layer_new.print_z - layer_new.bottom_z; + intermediate_layers.push_back(&layer_new); + } // Emit all intermediate support layers synchronized with object layers up to extr2z. for (; idx_layer_object < object.layers.size() && object.layers[idx_layer_object]->print_z < extr2z + EPSILON; ++ idx_layer_object) { MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate); layer_new.print_z = object.layers[idx_layer_object]->print_z; layer_new.height = object.layers[idx_layer_object]->height; - layer_new.bottom_z = layer_new.print_z - layer_new.height; + layer_new.bottom_z = (idx_layer_object > 0) ? object.layers[idx_layer_object - 1]->print_z : (layer_new.print_z - layer_new.height); assert(intermediate_layers.empty() || intermediate_layers.back()->print_z < layer_new.print_z + EPSILON); intermediate_layers.push_back(&layer_new); }