This commit is contained in:
sunsets
2024-01-18 13:53:37 +08:00
7 changed files with 42 additions and 13 deletions

View File

@@ -2993,6 +2993,10 @@ Polylines FillGrid::fill_surface(const Surface *surface, const FillParams &param
{ { 0.f, 0.f }, { float(M_PI / 2.), 0.f } },
polylines_out))
BOOST_LOG_TRIVIAL(error) << "FillGrid::fill_surface() failed to fill a region.";
//w18 reverse fill path
if (this->layer_id % 2 == 1)
for (int i = 0; i < polylines_out.size(); i++)
std::reverse(polylines_out[i].begin(), polylines_out[i].end());
return polylines_out;
}

View File

@@ -1302,9 +1302,14 @@ void PerimeterGenerator::process_arachne(
out_loops.append(extrusion_coll);
ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour());
//w17
const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing;
if (offset_ex(infill_contour, -float(spacing / 2.)).empty())
infill_contour.clear(); // Infill region is too small, so let's filter it out.
coord_t perimeter_width = params.perimeter_flow.scaled_width();
double min_width_top_surface = (params.object_config.top_area_threshold / 100) *
std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
infill_contour = offset2_ex(infill_contour, -min_width_top_surface, min_width_top_surface + perimeter_width);
// create one more offset to be used as boundary for fill
// we offset by half the perimeter spacing (to get to the actual infill boundary)
@@ -1440,7 +1445,8 @@ void PerimeterGenerator::process_with_one_wall_arachne(
std::max(ext_perimeter_spacing, perimeter_width));
infill_contour = diff_ex(infill_contour, bridge_area);
}
double min_width_top_surface = std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
//w17
double min_width_top_surface = (params.object_config.top_area_threshold / 100) * std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
infill_contour = offset2_ex(infill_contour, -min_width_top_surface, min_width_top_surface + perimeter_width);
ExPolygons surface_not_export_to_top = diff_ex(the_layer_surface, infill_contour);
@@ -1784,7 +1790,7 @@ void PerimeterGenerator::process_classic(
//w16
ExPolygons fill_clip;
ExPolygons top_fills;
if (loop_number > 0 && params.object_config.top_one_wall_type != TopOneWallType::None && upper_slices == nullptr)
if (loop_number > 0 && params.object_config.top_one_wall_type != TopOneWallType::Disable && upper_slices == nullptr)
loop_number = 0;
if (loop_number >= 0) {
// In case no perimeters are to be generated, loop_number will equal to -1.
@@ -1891,7 +1897,8 @@ void PerimeterGenerator::process_classic(
0.9 * (params.config.perimeters.value <= 1 ? 0. : (perimeter_spacing * (params.config.perimeters.value - 1))));
else
offset_top_surface = 0;
double min_width_top_surface = (100) *
//w17
double min_width_top_surface = (params.object_config.top_area_threshold/100 ) *
std::max(double(ext_perimeter_spacing / 2 + 10), 1.0 * (double(perimeter_width)));
BoundingBox last_box = get_extents(last);
last_box.offset(SCALED_EPSILON);

View File

@@ -477,6 +477,8 @@ static std::vector<std::string> s_Preset_print_options {
,"seam_gap"
//w16
, "top_one_wall_type"
//w17
,"top_area_threshold"
};
static std::vector<std::string> s_Preset_filament_options {

View File

@@ -237,9 +237,9 @@ static t_config_enum_values s_keys_map_PerimeterGeneratorType {
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PerimeterGeneratorType)
//w16
static t_config_enum_values s_keys_map_TopOneWallType{{"not apply", int(TopOneWallType::None)},
{"all top", int(TopOneWallType::Alltop)},
{"Only top most", int(TopOneWallType::Onlytopmost)}};
static t_config_enum_values s_keys_map_TopOneWallType{{"disable", int(TopOneWallType::Disable)},
{"all_top", int(TopOneWallType::Alltop)},
{"only_top_most", int(TopOneWallType::Onlytopmost)}};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TopOneWallType)
static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
@@ -3543,12 +3543,22 @@ void PrintConfigDef::init_fff_params()
def->category = L("Layers and Perimeters");
def->tooltip = L("Use only one wall on flat top surface, to give more space to the top infill pattern. Could be applyed on topmost surface or all top surface.");
def->set_enum<TopOneWallType>({
{ "none", L("None") },
{ "Only top most", L("Onlytopmost") },
{ "all top", L("Alltop") }
{ "disable", L("Disable") },
{ "all_top", L("All top") },
{ "only_top_most", L("Only top most") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<TopOneWallType>(TopOneWallType::None));
def->set_default_value(new ConfigOptionEnum<TopOneWallType>(TopOneWallType::Alltop));
//w17
def = this->add("top_area_threshold", coPercent);
def->label = L("Top area threshold");
def->tooltip = L("This factor affects the acreage of top area. The small the number the big the top area.");
def->sidetext = L("%");
def->min = 0;
def->max = 500;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercent(100));
def = this->add("wall_transition_length", coFloatOrPercent);
def->label = L("Perimeter transition length");

View File

@@ -145,7 +145,7 @@ enum class PerimeterGeneratorType
enum class GCodeThumbnailsFormat { QIDI,PNG, JPG, QOI };
//w16
enum class TopOneWallType { None, Alltop, Onlytopmost };
enum class TopOneWallType { Disable, Alltop, Onlytopmost };
#define CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(NAME) \
template<> const t_config_enum_names& ConfigOptionEnum<NAME>::get_enum_names(); \
@@ -592,6 +592,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, detect_narrow_internal_solid_infill))
//w16
((ConfigOptionEnum<TopOneWallType>, top_one_wall_type))
//w17
((ConfigOptionPercent, top_area_threshold))
)
PRINT_CONFIG_CLASS_DEFINE(

View File

@@ -865,8 +865,10 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "wall_distribution_count"
|| opt_key == "min_feature_size"
|| opt_key == "min_bead_width"
//w15
|| opt_key == "top_one_wall_type"){
//w16
|| opt_key == "top_one_wall_type"
//w17
|| opt_key == "top_area_threshold") {
steps.emplace_back(posSlice);
} else if (
opt_key == "seam_position"

View File

@@ -1469,6 +1469,8 @@ void TabPrint::build()
optgroup->append_single_option_line("perimeter_generator");
//w16
optgroup->append_single_option_line("top_one_wall_type");
//w17
optgroup->append_single_option_line("top_area_threshold");
optgroup = page->new_optgroup(L("Fuzzy skin (experimental)"));
category_path = "fuzzy-skin_246186/#";