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
This commit is contained in:
Arthur 2024-09-19 11:24:36 +08:00 committed by Lane.Wei
parent 0c8a165a6e
commit 647bd4213c
4 changed files with 20 additions and 5 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ deps/build-linux/*
install_*
build_*/
SVG
doc/
**/process_full/
**/machine_full/
**/filament_full/

View File

@ -863,15 +863,23 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
// Allow empty support layers, as the support generator may produce no extrusions for non-empty support regions.
|| (layer_to_print.support_layer /* && layer_to_print.support_layer->has_extrusions() */)) {
double top_cd = object.config().support_top_z_distance;
//double bottom_cd = object.config().support_bottom_z_distance == 0. ? top_cd : object.config().support_bottom_z_distance;
double bottom_cd = top_cd;
double bottom_cd = object.config().support_bottom_z_distance == 0. ? top_cd : object.config().support_bottom_z_distance;
//if (!object.print()->config().independent_support_layer_height)
{ // the actual support gap may be larger than the configured one due to rounding to layer height for organic support, regardless of independent support layer height
top_cd = std::ceil(top_cd / object.config().layer_height) * object.config().layer_height;
bottom_cd = std::ceil(bottom_cd / object.config().layer_height) * object.config().layer_height;
}
double extra_gap = (layer_to_print.support_layer ? bottom_cd : top_cd);
// raft contact distance should not trigger any warning
if(last_extrusion_layer && last_extrusion_layer->support_layer)
if (last_extrusion_layer && last_extrusion_layer->support_layer) {
double raft_gap = object.config().raft_contact_distance.value;
//if (!object.print()->config().independent_support_layer_height)
{
raft_gap = std::ceil(raft_gap / object.config().layer_height) * object.config().layer_height;
}
extra_gap = std::max(extra_gap, object.config().raft_contact_distance.value);
}
double maximal_print_z = (last_extrusion_layer ? last_extrusion_layer->print_z() : 0.)
+ layer_to_print.layer()->height
+ std::max(0., extra_gap);

View File

@ -1667,6 +1667,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];
#if USE_SUPPORT_3D
std::vector<TreeSupport3D::SupportElements> move_bounds(m_highest_overhang_layer + 1);
@ -2157,6 +2160,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
@ -3649,6 +3653,7 @@ const ExPolygons& TreeSupportData::calculate_collision(const RadiusLayerPair& ke
ExPolygons collision_areas = std::move(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;
}

View File

@ -251,6 +251,7 @@ public:
std::vector<LayerHeightData> layer_heights;
std::vector<SupportNode*> contact_nodes;
// ExPolygon m_machine_border;
private:
/*!