NEW: add support_object_first_layer_gap option

jira: STUDIO-6202
github: #3521

Change-Id: I6f1ce9f5312e9482c0f5bf6ac3215861c501106c
(cherry picked from commit 83027d923a6e67fa0013e5d9f627283c68e996de)
This commit is contained in:
Arthur 2024-03-06 08:44:32 +08:00 committed by Lane.Wei
parent 1a23e0631c
commit 29da3bc441
11 changed files with 34 additions and 13 deletions

View File

@ -805,7 +805,7 @@ static std::vector<std::string> s_Preset_print_options {
"max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
#endif /* HAS_PRESSURE_EQUALIZER */
"inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_object_first_layer_gap","support_interface_speed",
"bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed", "outer_wall_acceleration",
"initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "inner_wall_acceleration", "sparse_infill_acceleration",
"accel_to_decel_enable", "accel_to_decel_factor", "skirt_loops", "skirt_distance",

View File

@ -3026,6 +3026,17 @@ void PrintConfigDef::init_fff_params()
//Support with too small spacing may touch the object and difficult to remove.
def->set_default_value(new ConfigOptionFloat(0.35));
def = this->add("support_object_first_layer_gap", coFloat);
def->label = L("Support/object first layer gap");
def->category = L("Support");
def->tooltip = L("XY separation between an object and its support at the first layer.");
def->sidetext = L("mm");
def->min = 0;
def->max = 10;
def->mode = comAdvanced;
//Support with too small spacing may touch the object and difficult to remove.
def->set_default_value(new ConfigOptionFloat(0.2));
def = this->add("support_angle", coFloat);
def->label = L("Pattern angle");
def->category = L("Support");

View File

@ -721,6 +721,7 @@ PRINT_CONFIG_CLASS_DEFINE(
// Overhang angle threshold.
((ConfigOptionInt, support_threshold_angle))
((ConfigOptionFloat, support_object_xy_distance))
((ConfigOptionFloat, support_object_first_layer_gap))
((ConfigOptionFloat, xy_hole_compensation))
((ConfigOptionFloat, xy_contour_compensation))
((ConfigOptionBool, flush_into_objects))

View File

@ -783,6 +783,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "support_base_pattern"
|| opt_key == "support_style"
|| opt_key == "support_object_xy_distance"
|| opt_key == "support_object_first_layer_gap"
|| opt_key == "support_base_pattern_spacing"
|| opt_key == "support_expansion"
//|| opt_key == "independent_support_layer_height" // BBS

View File

@ -3250,7 +3250,7 @@ void PrintObjectSupportMaterial::trim_support_layers_by_object(
bool is_overlap = is_layers_overlap(support_layer, object_layer);
for (const ExPolygon& expoly : object_layer.lslices) {
// BBS
bool is_sharptail = !intersection_ex({ expoly }, object_layer.sharp_tails).empty();
bool is_sharptail = overlaps({ expoly }, object_layer.sharp_tails);
coordf_t trimming_offset = is_sharptail ? scale_(sharp_tail_xy_gap) :
is_overlap ? gap_xy_scaled :
scale_(no_overlap_xy_gap);
@ -3415,10 +3415,11 @@ SupportGeneratorLayersPtr generate_raft_base(
Polygons &raft = columns_base->polygons;
Polygons trimming;
// BBS: if first layer of support is intersected with object island, it must have the same function as brim unless in nobrim mode.
if (object.has_brim())
trimming = offset(object.layers().front()->lslices, (float)scale_(object.config().brim_object_gap.value), SUPPORT_SURFACES_OFFSET_PARAMETERS);
else
trimming = offset(object.layers().front()->lslices, (float)scale_(support_params.gap_xy), SUPPORT_SURFACES_OFFSET_PARAMETERS);
// brim_object_gap is changed to 0 by default, it's no longer appropriate to use it to determine the gap of first layer support.
//if (object.has_brim())
// trimming = offset(object.layers().front()->lslices, (float)scale_(object.config().brim_object_gap.value), SUPPORT_SURFACES_OFFSET_PARAMETERS);
//else
trimming = offset(object.layers().front()->lslices, (float)scale_(support_params.gap_xy_first_layer), SUPPORT_SURFACES_OFFSET_PARAMETERS);
if (inflate_factor_1st_layer > SCALED_EPSILON) {
// Inflate in multiple steps to avoid leaking of the support 1st layer through object walls.
auto nsteps = std::max(5, int(ceil(inflate_factor_1st_layer / support_params.first_layer_flow.scaled_width())));

View File

@ -66,6 +66,7 @@ struct SupportParameters {
bridge_flow_ratio += region.config().bridge_flow;
}
this->gap_xy = object_config.support_object_xy_distance.value;
this->gap_xy_first_layer = object_config.support_object_first_layer_gap.value;
bridge_flow_ratio /= object.num_printing_regions();
this->support_material_bottom_interface_flow = slicing_params.soluble_interface || !object_config.thick_bridges ?
@ -149,6 +150,7 @@ struct SupportParameters {
// coordf_t support_layer_height_max;
coordf_t gap_xy;
coordf_t gap_xy_first_layer;
float base_angle;
float interface_angle;

View File

@ -1982,7 +1982,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
}
else {
if (collision_base.empty())
collision_base = m_ts_data->get_collision((layer_nr == 0 && has_brim) ? config.brim_object_gap : m_ts_data->m_xy_distance, layer_nr);
collision_base = m_ts_data->get_collision((layer_nr == 0) ? config.support_object_first_layer_gap : m_ts_data->m_xy_distance, layer_nr);
return collision_base;
}
};
@ -2104,7 +2104,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
roof_1st_layer = intersection_ex(roof_1st_layer, m_machine_border);
// let supports touch objects when brim is on
//auto avoid_region = get_collision_polys((layer_nr == 0 && has_brim) ? config.brim_object_gap : m_ts_data->m_xy_distance, layer_nr);
//auto avoid_region = get_collision_polys((layer_nr == 0) ? config.support_object_xy_distance : m_ts_data->m_xy_distance, layer_nr);
//base_areas = avoid_object_remove_extra_small_parts(base_areas, avoid_region);
//base_areas = diff_clipped(base_areas, avoid_region);
@ -2357,7 +2357,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
// make sure 1) roof1 and object 2) roof1 and roof, won't intersect
// Note: We can't replace roof1 directly, as we have recorded its address.
// So instead we need to replace its members one by one.
auto tmp1 = diff_ex(roof1, get_collision((layer_nr == 0 && has_brim) ? config.brim_object_gap : m_ts_data->m_xy_distance, layer_nr));
auto tmp1 = diff_ex(roof1, get_collision((layer_nr == 0) ? config.support_object_xy_distance : m_ts_data->m_xy_distance, layer_nr));
tmp1 = diff_ex(tmp1, ts_layer->roof_areas);
if (!tmp1.empty()) {
roof1.contour = std::move(tmp1[0].contour);

View File

@ -61,6 +61,7 @@ struct TreeSupportMeshGroupSettings {
0;
this->support_material_buildplate_only = config.support_on_build_plate_only;
this->support_xy_distance = scaled<coord_t>(config.support_object_xy_distance.value);
this->support_xy_distance_1st_layer = scaled<coord_t>(config.support_object_first_layer_gap.value);
// Separation of interfaces, it is likely smaller than support_xy_distance.
this->support_xy_distance_overhang = std::min(this->support_xy_distance, scaled<coord_t>(0.5 * external_perimeter_width));
this->support_top_distance = scaled<coord_t>(slicing_params.gap_support_object);
@ -123,6 +124,7 @@ struct TreeSupportMeshGroupSettings {
// Distance of the support structure from the print in the X/Y directions.
// minimum: 0, maximum warning: 1.5 * machine_nozzle_tip_outer_diameter
coord_t support_xy_distance { scaled<coord_t>(0.7) };
coord_t support_xy_distance_1st_layer { scaled<coord_t>(0.7) };
// Minimum Support X/Y Distance
// Distance of the support structure from the overhang in the X/Y directions.
// minimum_value: 0, minimum warning": support_xy_distance - support_line_width * 2, maximum warning: support_xy_distance

View File

@ -632,7 +632,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
//BBS: add more support params to dependent of enable_support
"support_type", "support_on_build_plate_only",
"support_remove_small_overhang","support_interface_not_for_body",
"support_object_xy_distance"/*, "independent_support_layer_height"*/})
"support_object_xy_distance","support_object_first_layer_gap"/*, "independent_support_layer_height"*/})
toggle_field(el, have_support_material);
toggle_field("support_threshold_angle", have_support_material && is_auto(support_type));
//toggle_field("support_closing_radius", have_support_material && support_style == smsSnug);

View File

@ -83,9 +83,10 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::OBJECT_C
{"enable_support", "",4},{"support_type", "",5},{"support_threshold_angle", "",6},{"support_on_build_plate_only", "",7},
{"support_filament", "",8},{"support_interface_filament", "",9},{"support_expansion", "",24},{"support_style", "",25},
{"tree_support_brim_width", "",26}, {"tree_support_branch_angle", "",10}, {"tree_support_wall_count", "",11},//tree support
{"support_top_z_distance", "",13},{"support_bottom_z_distance", "",12},{"support_base_pattern", "",14},{"support_base_pattern_spacing", "",15},
{"support_interface_top_layers", "",16},{"support_interface_bottom_layers", "",17},{"support_interface_spacing", "",18},{"support_bottom_interface_spacing", "",19},
{"support_object_xy_distance", "",20}, {"bridge_no_support", "",21},{"max_bridge_length", "",22},{"support_critical_regions_only", "",23},{"support_remove_small_overhang","",27}
{"support_top_z_distance", "",13},{"support_bottom_z_distance", "",12},{"support_base_pattern", "",14},{"support_base_pattern_spacing", "",15},
{"support_interface_top_layers", "",16},{"support_interface_bottom_layers", "",17},{"support_interface_spacing", "",18},{"support_bottom_interface_spacing", "",19},
{"support_object_xy_distance", "",20}, {"bridge_no_support", "",21},{"max_bridge_length", "",22},{"support_critical_regions_only", "",23},{"support_remove_small_overhang","",27},
{"support_object_first_layer_gap","",28}
}},
{ L("Speed"), {{"support_speed", "",12}, {"support_interface_speed", "",13}
}}
@ -146,6 +147,7 @@ std::vector<SimpleSettingData> SettingsFactory::get_visible_options(const std::s
"tree_support_wall_count",
//support
"support_top_z_distance", "support_base_pattern", "support_base_pattern_spacing", "support_interface_top_layers", "support_interface_bottom_layers", "support_interface_spacing", "support_bottom_interface_spacing", "support_object_xy_distance",
"support_object_first_layer_gap",
//adhesion
"brim_type", "brim_width", "brim_object_gap", "raft_layers"
};*/

View File

@ -2073,6 +2073,7 @@ void TabPrint::build()
//optgroup->append_single_option_line("support_interface_loop_pattern");
optgroup->append_single_option_line("support_object_xy_distance", "support");
optgroup->append_single_option_line("support_object_first_layer_gap", "support");
optgroup->append_single_option_line("bridge_no_support", "support#base-pattern");
optgroup->append_single_option_line("max_bridge_length", "support#base-pattern");
optgroup->append_single_option_line("independent_support_layer_height", "support");