FIX: fix hybrid tree support may go outside plate

1. fix hybrid tree support may go outside plate
github: #4769
2. fix false alarm of empty layer warning
jira: STUDIO-8178

Change-Id: I7bcc3959b06184901cbec946e8840c7a94bc1cab
(cherry picked from commit 647bd4213c363eff6258992f5f607c1f03cbc482)
This commit is contained in:
Arthur
2024-09-19 11:24:36 +08:00
committed by Noisyfox
parent fff60480e7
commit d7c5eb6f16
3 changed files with 19 additions and 4 deletions

View File

@@ -1662,6 +1662,9 @@ void TreeSupport::generate()
create_tree_support_layers();
m_ts_data = m_object->alloc_tree_support_preview_cache();
m_ts_data->is_slim = is_slim;
// // get the ring of outside plate
// auto tmp= diff_ex(offset_ex(m_machine_border, scale_(100)), m_machine_border);
// if (!tmp.empty()) m_ts_data->m_machine_border = tmp[0];
std::vector<TreeSupport3D::SupportElements> move_bounds(m_highest_overhang_layer + 1);
profiler.stage_start(STAGE_GENERATE_CONTACT_NODES);
@@ -2093,6 +2096,7 @@ void TreeSupport::draw_circles()
// join roof segments
roof_areas = diff_clipped(offset2_ex(roof_areas, line_width_scaled, -line_width_scaled), get_collision(false));
roof_areas = intersection_ex(roof_areas, m_machine_border);
roof_1st_layer = diff_clipped(offset2_ex(roof_1st_layer, line_width_scaled, -line_width_scaled), get_collision(false));
// roof_1st_layer and roof_areas may intersect, so need to subtract roof_areas from roof_1st_layer
@@ -3460,6 +3464,7 @@ const ExPolygons& TreeSupportData::calculate_collision(const RadiusLayerPair& ke
ExPolygons collision_areas = offset_ex(m_layer_outlines[key.layer_nr], scale_(key.radius+m_xy_distance));
collision_areas = expolygons_simplify(collision_areas, scale_(m_radius_sample_resolution));
// collision_areas.emplace_back(m_machine_border);
const auto ret = m_collision_cache.insert({ key, std::move(collision_areas) });
return ret.first->second;
}