NEW: add support_object_first_layer_gap option

jira: STUDIO-6202
github: #3521

Change-Id: I6f1ce9f5312e9482c0f5bf6ac3215861c501106c
(cherry picked from commit 83027d923a6e67fa0013e5d9f627283c68e996de)
(cherry picked from commit 29da3bc441a194d5b83ce267fe24ebf3f3811133)
This commit is contained in:
Arthur 2024-03-06 08:44:32 +08:00 committed by Noisyfox
parent 4ee6d636c7
commit fd3ed419c2
11 changed files with 37 additions and 16 deletions

View file

@ -792,7 +792,7 @@ static std::vector<std::string> s_Preset_print_options {
"fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", "fuzzy_skin_first_layer", "fuzzy_skin_noise_type", "fuzzy_skin_scale", "fuzzy_skin_octaves", "fuzzy_skin_persistence",
"max_volumetric_extrusion_rate_slope", "max_volumetric_extrusion_rate_slope_segment_length","extrusion_rate_smoothing_external_perimeter_only",
"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", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
"outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle", "skirt_height", "draft_shield",
"brim_width", "brim_object_gap", "brim_type", "brim_ears_max_angle", "brim_ears_detection_length", "enable_support", "support_type", "support_threshold_angle", "support_threshold_overlap","enforce_support_layers",

View file

@ -4493,6 +4493,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

@ -831,6 +831,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionInt, support_threshold_angle))
((ConfigOptionFloatOrPercent, support_threshold_overlap))
((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

@ -1017,6 +1017,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

@ -445,10 +445,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

@ -69,7 +69,8 @@ struct SupportParameters {
external_perimeter_width = std::max(external_perimeter_width, coordf_t(region.flow(object, frExternalPerimeter, slicing_params.layer_height).width()));
bridge_flow_ratio += region.config().bridge_flow;
}
this->gap_xy = object_config.support_object_xy_distance;//.get_abs_value(external_perimeter_width);
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 ?
@ -210,6 +211,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

@ -1926,7 +1926,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;
}
};
@ -2044,7 +2044,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);
ExPolygons roofs; append(roofs, roof_1st_layer); append(roofs, roof_areas);append(roofs, roof_gap_areas);
@ -2295,7 +2295,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

@ -69,6 +69,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);
@ -158,6 +159,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

@ -596,7 +596,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
"support_interface_pattern", "support_interface_top_layers", "support_interface_bottom_layers",
"bridge_no_support", "max_bridge_length", "support_top_z_distance", "support_bottom_z_distance",
"support_type", "support_on_build_plate_only", "support_critical_regions_only","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_threshold_overlap", config->opt_int("support_threshold_angle") == 0 && have_support_material && is_auto(support_type));

View file

@ -93,7 +93,8 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::OBJECT_C
{"tree_support_brim_width", "",26}, {"tree_support_branch_angle", "",10},{"tree_support_branch_angle_organic","",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_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}
}}
@ -155,6 +156,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

@ -2263,6 +2263,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");