Handle parameter name change properly.

Fix build break and keep compatibility to existing user preset after #4444 changes
This commit is contained in:
SoftFever 2024-03-13 21:57:06 +08:00
parent 242ad33eb4
commit cab5fe715d
6 changed files with 14 additions and 11 deletions

View file

@ -1922,7 +1922,7 @@ void PerimeterGenerator::add_infill_contour_for_arachne( ExPolygons infil
void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perimeter_spacing, coord_t ext_perimeter_width)
{
//store surface for bridge infill to avoid unsupported perimeters (but the first one, this one is always good)
if (this->config->counterbole_hole_bridging != chbNone
if (this->config->counterbore_hole_bridging != chbNone
&& this->lower_slices != NULL && !this->lower_slices->empty()) {
const coordf_t bridged_infill_margin = scale_(BRIDGE_INFILL_MARGIN);
@ -1955,7 +1955,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
}
if (!bridgeable.empty()) {
//check if we get everything or just the bridgeable area
if (/*this->config->counterbole_hole_bridging.value == chbNoPeri || */this->config->counterbole_hole_bridging.value == chbFilled) {
if (/*this->config->counterbore_hole_bridging.value == chbNoPeri || */this->config->counterbore_hole_bridging.value == chbFilled) {
//we bridge everything, even the not-bridgeable bits
for (size_t i = 0; i < unsupported_filtered.size();) {
ExPolygon& poly_unsupp = *(unsupported_filtered.begin() + i);
@ -1977,7 +1977,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
}
unsupported_filtered = intersection_ex(last,
offset2_ex(unsupported_filtered, double(-perimeter_spacing / 2), double(bridged_infill_margin + perimeter_spacing / 2)));
if (this->config->counterbole_hole_bridging.value == chbFilled) {
if (this->config->counterbore_hole_bridging.value == chbFilled) {
for (ExPolygon& expol : unsupported_filtered) {
//check if the holes won't be covered by the upper layer
//TODO: if we want to do that, we must modify the geometry before making perimeters.
@ -2027,7 +2027,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
}
//TODO: add other polys as holes inside this one (-margin)
} else if (/*this->config->counterbole_hole_bridging.value == chbBridgesOverhangs || */this->config->counterbole_hole_bridging.value == chbBridges) {
} else if (/*this->config->counterbore_hole_bridging.value == chbBridgesOverhangs || */this->config->counterbore_hole_bridging.value == chbBridges) {
//simplify to avoid most of artefacts from printing lines.
ExPolygons bridgeable_simplified;
for (ExPolygon& poly : bridgeable) {
@ -2046,7 +2046,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
//unbridgeable = offset2_ex(unbridgeable, -ext_perimeter_width, ext_perimeter_width);
// if (this->config->counterbole_hole_bridging.value == chbBridges) {
// if (this->config->counterbore_hole_bridging.value == chbBridges) {
ExPolygons unbridgeable = unsupported_filtered;
for (ExPolygon& expol : unbridgeable)
expol.holes.clear();

View file

@ -772,7 +772,7 @@ static std::vector<std::string> s_Preset_print_options {
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction",
"seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction", "counterbole_hole_bridging",
"infill_direction", "counterbore_hole_bridging",
"minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","gap_fill_target",
"ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_angle",
"max_travel_detour_distance",

View file

@ -5750,6 +5750,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
else if(opt_key == "ironing_direction") {
opt_key = "ironing_angle";
}
else if(opt_key == "counterbole_hole_bridging"){
opt_key = "counterbore_hole_bridging";
}
// Ignore the following obsolete configuration keys:
static std::set<std::string> ignore = {

View file

@ -318,7 +318,7 @@ enum class GCodeThumbnailsFormat {
PNG, JPG, QOI, BTT_TFT, ColPic
};
enum CounterboleHoleBridgingOption {
enum CounterboreHoleBridgingOption {
chbNone, chbBridges, chbFilled
};
@ -406,7 +406,7 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(BedType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(DraftShield)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ForwardCompatibilitySubstitutionRule)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(GCodeThumbnailsFormat)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(CounterboleHoleBridgingOption)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(CounterboreHoleBridgingOption)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PrintHostType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AuthorizationType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType)
@ -952,7 +952,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, overhang_reverse))
((ConfigOptionBool, overhang_reverse_internal_only))
((ConfigOptionFloatOrPercent, overhang_reverse_threshold))
((ConfigOptionEnum<CounterboleHoleBridgingOption>, counterbole_hole_bridging))
((ConfigOptionEnum<CounterboreHoleBridgingOption>, counterbore_hole_bridging))
((ConfigOptionEnum<WallSequence>, wall_sequence))
((ConfigOptionBool, is_infill_first))
((ConfigOptionBool, small_area_infill_flow_compensation))

View file

@ -1302,7 +1302,7 @@ void PrintObject::detect_surfaces_type()
ExPolygons layerm_slices_surfaces = to_expolygons(layerm->slices.surfaces);
// no_perimeter_full_bridge allow to put bridges where there are nothing, hence adding area to slice, that's why we need to start from the result of PerimeterGenerator.
if (layerm->region().config().counterbole_hole_bridging.value == chbFilled) {
if (layerm->region().config().counterbore_hole_bridging.value == chbFilled) {
layerm_slices_surfaces = union_ex(layerm_slices_surfaces, to_expolygons(layerm->fill_surfaces.surfaces));
}

View file

@ -2051,7 +2051,7 @@ void TabPrint::build()
optgroup->append_single_option_line("thick_bridges");
optgroup->append_single_option_line("thick_internal_bridges");
optgroup->append_single_option_line("dont_filter_internal_bridges");
optgroup->append_single_option_line("counterbole_hole_bridging","counterbole-hole-bridging");
optgroup->append_single_option_line("counterbore_hole_bridging","counterbore-hole-bridging");
optgroup = page->new_optgroup(L("Overhangs"), L"param_advanced");
optgroup->append_single_option_line("detect_overhang_wall");