FIX: z_distance_top==0 not working

jira: STUDIO-6144

Change-Id: I9ddaa237e2d71c8697a41bbbdb86f70d0b1e1452
(cherry picked from commit 38ba45e9cf7f59d2c1de658a56d8f2b109721bcd)
(cherry picked from commit 9d37a31338cf42a285b39daab84af5504e51d009)
This commit is contained in:
Arthur 2024-01-31 14:05:09 +08:00 committed by Noisyfox
parent c7febad548
commit a2e5332eef

View file

@ -3052,6 +3052,7 @@ void TreeSupport::generate_contact_points(std::vector<std::vector<SupportNode*>>
}
}
const int z_distance_top_layers = round_up_divide(scale_(z_distance_top), scale_(layer_height)) + 1; //Support must always be 1 layer below overhang.
int gap_layers = z_distance_top == 0 ? 0 : 1;
// virtual layer with 0 height will be deleted
if (z_distance_top == 0)
z_distance_top = 0.001;
@ -3095,7 +3096,7 @@ void TreeSupport::generate_contact_points(std::vector<std::vector<SupportNode*>>
// print_z=object_layer->bottom_z: it directly contacts the bottom
// height=z_distance_top: it's height is exactly the gap distance
// dist_mm_to_top=0: it directly contacts the bottom
contact_node = m_ts_data->create_node(pt, -1, layer_nr - 1, support_roof_layers + 1, to_buildplate, SupportNode::NO_PARENT, bottom_z, z_distance_top, 0,
contact_node = m_ts_data->create_node(pt, -gap_layers, layer_nr - 1, support_roof_layers + 1, to_buildplate, SupportNode::NO_PARENT, bottom_z, z_distance_top, 0,
unscale_(radius));
contact_node->overhang = overhang_part;
contact_node->is_sharp_tail = is_sharp_tail;
@ -3179,7 +3180,7 @@ void TreeSupport::generate_contact_points(std::vector<std::vector<SupportNode*>>
}
else {
for (auto& elem : move_bounds_layer) {
SupportNode* contact_node = m_ts_data->create_node(elem.state.result_on_layer, -z_distance_top_layers, layer_nr, support_roof_layers + z_distance_top_layers, elem.state.to_buildplate,
SupportNode* contact_node = m_ts_data->create_node(elem.state.result_on_layer, -gap_layers, layer_nr-1, support_roof_layers + 1, elem.state.to_buildplate,
SupportNode::NO_PARENT, print_z, height, z_distance_top);
contact_node->overhang = ExPolygon(elem.influence_area.front());
curr_nodes.emplace_back(contact_node);