Squashed commit of the following:

commit 61b3ca0b4b4a0b4cfbbc706ede94ef7ccec4c91f
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Wed Feb 10 15:42:27 2021 +0100

    Fix of fuzzy skin

commit d971ed51a5bb65e8bdfd326bc41b9d7ab2e20834
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Wed Feb 10 14:12:51 2021 +0100

    CMake adjustment of MINIMUM_BOOST_VERSION

commit 5d8aa2c59ecf7e32456f2e43e07dedc7d24eb21c
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Wed Feb 10 14:12:33 2021 +0100

    Fix of debug compilation after warning removal.

commit 5e339b3078f0c9d75b6fac28ed3c295ae9fbbef5
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Wed Feb 10 14:11:34 2021 +0100

    Fuzzy Skin changes:
    1) Moved the parameters to region
    2) Removed experimental code.
    3) Allowed fuzzyfication of both outer perimeter and holes.
This commit is contained in:
Vojtech Bubnik 2021-02-10 16:02:32 +01:00
parent f639c08caf
commit 6555b32f5c
12 changed files with 118 additions and 312 deletions

View File

@ -288,10 +288,9 @@ if(SLIC3R_STATIC)
endif() endif()
#set(Boost_DEBUG ON) #set(Boost_DEBUG ON)
# set(Boost_COMPILER "-mgw81") # set(Boost_COMPILER "-mgw81")
if(NOT WIN32) # boost::process was introduced first in version 1.64.0,
# boost::beast::detail::base64 was introduced first in version 1.66.0 # boost::beast::detail::base64 was introduced first in version 1.66.0
set(MINIMUM_BOOST_VERSION "1.66.0") set(MINIMUM_BOOST_VERSION "1.66.0")
endif()
set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time") set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time")
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components}) find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components})

View File

@ -678,7 +678,7 @@ static inline bool line_rounded_thick_segment_collision(
return intersects; return intersects;
} }
#if 0 #ifndef NDEBUG
static inline bool inside_interval(double low, double high, double p) static inline bool inside_interval(double low, double high, double p)
{ {
return p >= low && p <= high; return p >= low && p <= high;
@ -703,7 +703,7 @@ static inline bool cyclic_interval_inside_interval(double outer_low, double oute
} }
return interval_inside_interval(outer_low, outer_high, inner_low, inner_high, double(SCALED_EPSILON)); return interval_inside_interval(outer_low, outer_high, inner_low, inner_high, double(SCALED_EPSILON));
} }
#endif #endif // NDEBUG
// #define INFILL_DEBUG_OUTPUT // #define INFILL_DEBUG_OUTPUT

View File

@ -152,7 +152,10 @@ void Layer::make_perimeters()
&& config.opt_serialize("perimeter_extrusion_width") == other_config.opt_serialize("perimeter_extrusion_width") && config.opt_serialize("perimeter_extrusion_width") == other_config.opt_serialize("perimeter_extrusion_width")
&& config.thin_walls == other_config.thin_walls && config.thin_walls == other_config.thin_walls
&& config.external_perimeters_first == other_config.external_perimeters_first && config.external_perimeters_first == other_config.external_perimeters_first
&& config.infill_overlap == other_config.infill_overlap) && config.infill_overlap == other_config.infill_overlap
&& config.fuzzy_skin == other_config.fuzzy_skin
&& config.fuzzy_skin_thickness == other_config.fuzzy_skin_thickness
&& config.fuzzy_skin_point_dist == other_config.fuzzy_skin_point_dist)
{ {
other_layerm->perimeters.clear(); other_layerm->perimeters.clear();
other_layerm->fills.clear(); other_layerm->fills.clear();

View File

@ -5,7 +5,6 @@
#include <cmath> #include <cmath>
#include <cassert> #include <cassert>
#include <chrono>
namespace Slic3r { namespace Slic3r {
@ -119,24 +118,63 @@ public:
bool is_contour; bool is_contour;
// Depth in the hierarchy. External perimeter has depth = 0. An external perimeter could be both a contour and a hole. // Depth in the hierarchy. External perimeter has depth = 0. An external perimeter could be both a contour and a hole.
unsigned short depth; unsigned short depth;
// Should this contur be fuzzyfied on path generation?
bool fuzzify;
// Children contour, may be both CCW and CW oriented (outer contours or holes). // Children contour, may be both CCW and CW oriented (outer contours or holes).
std::vector<PerimeterGeneratorLoop> children; std::vector<PerimeterGeneratorLoop> children;
PerimeterGeneratorLoop(Polygon polygon, unsigned short depth, bool is_contour) : PerimeterGeneratorLoop(const Polygon &polygon, unsigned short depth, bool is_contour, bool fuzzify) :
polygon(polygon), is_contour(is_contour), depth(depth) {} polygon(polygon), is_contour(is_contour), depth(depth), fuzzify(fuzzify) {}
// External perimeter. It may be CCW or CW oriented (outer contour or hole contour). // External perimeter. It may be CCW or CW oriented (outer contour or hole contour).
bool is_external() const { return this->depth == 0; } bool is_external() const { return this->depth == 0; }
// An island, which may have holes, but it does not have another internal island. // An island, which may have holes, but it does not have another internal island.
bool is_internal_contour() const; bool is_internal_contour() const;
}; };
typedef std::vector<PerimeterGeneratorLoop> PerimeterGeneratorLoops; // Thanks Cura developers for this function.
static void fuzzy_polygon(Polygon &poly, double fuzzy_skin_thickness, double fuzzy_skin_point_dist)
{
const double min_dist_between_points = fuzzy_skin_point_dist * 3. / 4.; // hardcoded: the point distance may vary between 3/4 and 5/4 the supplied value
const double range_random_point_dist = fuzzy_skin_point_dist / 2.;
double dist_left_over = double(rand()) * (min_dist_between_points / 2) / double(RAND_MAX); // the distance to be traversed on the line before making the first new point
Point* p0 = &poly.points.back();
Points out;
out.reserve(poly.points.size());
for (Point &p1 : poly.points)
{ // 'a' is the (next) new point between p0 and p1
Vec2d p0p1 = (p1 - *p0).cast<double>();
double p0p1_size = p0p1.norm();
// so that p0p1_size - dist_last_point evaulates to dist_left_over - p0p1_size
double dist_last_point = dist_left_over + p0p1_size * 2.;
for (double p0pa_dist = dist_left_over; p0pa_dist < p0p1_size;
p0pa_dist += min_dist_between_points + double(rand()) * range_random_point_dist / double(RAND_MAX))
{
double r = double(rand()) * (fuzzy_skin_thickness * 2.) / double(RAND_MAX) - fuzzy_skin_thickness;
out.emplace_back(*p0 + (p0p1 * (p0pa_dist / p0p1_size) + perp(p0p1).cast<double>().normalized() * r).cast<coord_t>());
dist_last_point = p0pa_dist;
}
dist_left_over = p0p1_size - dist_last_point;
p0 = &p1;
}
while (out.size() < 3) {
size_t point_idx = poly.size() - 2;
out.emplace_back(poly[point_idx]);
if (point_idx == 0)
break;
-- point_idx;
}
if (out.size() >= 3)
poly.points = std::move(out);
}
using PerimeterGeneratorLoops = std::vector<PerimeterGeneratorLoop>;
static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perimeter_generator, const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls) static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perimeter_generator, const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls)
{ {
// loops is an arrayref of ::Loop objects // loops is an arrayref of ::Loop objects
// turn each one into an ExtrusionLoop object // turn each one into an ExtrusionLoop object
ExtrusionEntityCollection coll; ExtrusionEntityCollection coll;
Polygon fuzzified;
for (const PerimeterGeneratorLoop &loop : loops) { for (const PerimeterGeneratorLoop &loop : loops) {
bool is_external = loop.is_external(); bool is_external = loop.is_external();
@ -154,12 +192,17 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
// detect overhanging/bridging perimeters // detect overhanging/bridging perimeters
ExtrusionPaths paths; ExtrusionPaths paths;
const Polygon &polygon = loop.fuzzify ? fuzzified : loop.polygon;
if (loop.fuzzify) {
fuzzified = loop.polygon;
fuzzy_polygon(fuzzified, scaled<float>(perimeter_generator.config->fuzzy_skin_thickness.value), scaled<float>(perimeter_generator.config->fuzzy_skin_point_dist.value));
}
if (perimeter_generator.config->overhangs && perimeter_generator.layer_id > 0 if (perimeter_generator.config->overhangs && perimeter_generator.layer_id > 0
&& !(perimeter_generator.object_config->support_material && perimeter_generator.object_config->support_material_contact_distance.value == 0)) { && !(perimeter_generator.object_config->support_material && perimeter_generator.object_config->support_material_contact_distance.value == 0)) {
// get non-overhang paths by intersecting this loop with the grown lower slices // get non-overhang paths by intersecting this loop with the grown lower slices
extrusion_paths_append( extrusion_paths_append(
paths, paths,
intersection_pl((Polygons)loop.polygon, perimeter_generator.lower_slices_polygons()), intersection_pl({ polygon }, perimeter_generator.lower_slices_polygons()),
role, role,
is_external ? perimeter_generator.ext_mm3_per_mm() : perimeter_generator.mm3_per_mm(), is_external ? perimeter_generator.ext_mm3_per_mm() : perimeter_generator.mm3_per_mm(),
is_external ? perimeter_generator.ext_perimeter_flow.width : perimeter_generator.perimeter_flow.width, is_external ? perimeter_generator.ext_perimeter_flow.width : perimeter_generator.perimeter_flow.width,
@ -170,7 +213,7 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
// the loop centerline and original lower slices is >= half nozzle diameter // the loop centerline and original lower slices is >= half nozzle diameter
extrusion_paths_append( extrusion_paths_append(
paths, paths,
diff_pl((Polygons)loop.polygon, perimeter_generator.lower_slices_polygons()), diff_pl({ polygon }, perimeter_generator.lower_slices_polygons()),
erOverhangPerimeter, erOverhangPerimeter,
perimeter_generator.mm3_per_mm_overhang(), perimeter_generator.mm3_per_mm_overhang(),
perimeter_generator.overhang_flow.width, perimeter_generator.overhang_flow.width,
@ -181,7 +224,7 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
chain_and_reorder_extrusion_paths(paths, &paths.front().first_point()); chain_and_reorder_extrusion_paths(paths, &paths.front().first_point());
} else { } else {
ExtrusionPath path(role); ExtrusionPath path(role);
path.polyline = loop.polygon.split_at_first_point(); path.polyline = polygon.split_at_first_point();
path.mm3_per_mm = is_external ? perimeter_generator.ext_mm3_per_mm() : perimeter_generator.mm3_per_mm(); path.mm3_per_mm = is_external ? perimeter_generator.ext_mm3_per_mm() : perimeter_generator.mm3_per_mm();
path.width = is_external ? perimeter_generator.ext_perimeter_flow.width : perimeter_generator.perimeter_flow.width; path.width = is_external ? perimeter_generator.ext_perimeter_flow.width : perimeter_generator.perimeter_flow.width;
path.height = (float)perimeter_generator.layer_height; path.height = (float)perimeter_generator.layer_height;
@ -231,130 +274,8 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
return out; return out;
} }
/*
enum class FuzzyShape {
Triangle,
Sawtooth,
Random
};
*/
static void fuzzy_polygon(Polygon &poly, /* FuzzyShape shape, */ double fuzzy_skin_thickness, double fuzzy_skin_point_dist)
{
#if 0
Point last = poly.points.at(poly.points.size() - 1);
Point last_processed = last;
double max_length = scale_(2);
double min_length = scale_(1);
if (poly.length() < scale_(5))
return;
deepness *= 3;
bool triangle_or_sawtooth = shape == FuzzyShape::Sawtooth;
double length_sum = 0;
Points::iterator it = poly.points.begin();
while (it != poly.points.end()) {
Point &pt = *it;
Line line(last, pt);
double length = line.length();
// split long line
if (length > max_length) {
auto parts = int(ceil(length / max_length));
if (parts == 2) {
Point point_to_insert(line.midpoint());
it = poly.points.insert(it, point_to_insert);
}
else {
Vector part_vector = line.vector() / parts;
Points points_to_insert;
Point point_to_insert(last);
while (--parts) {
point_to_insert += part_vector;
Point point_to_insert_2(point_to_insert);
points_to_insert.push_back(point_to_insert_2);
}
it = poly.points.insert(it, points_to_insert.begin(), points_to_insert.end());
}
continue;
}
length_sum += length;
// join short lines
if (length_sum < min_length) {
last = pt;
it = poly.points.erase(it);
continue;
}
line = Line(last_processed, pt);
last = pt;
last_processed = pt;
if (shape == FuzzyShape::Random) {
triangle_or_sawtooth = !(rand() % 2);
}
Point point_to_insert(triangle_or_sawtooth ? pt : line.midpoint());
int scale = (rand() % deepness) + 1;
Vec2d normal = line.normal().cast<double>();
normal /= line.length() / scale_(1.) / ((double)scale / 20.);
it = poly.points.insert(it, point_to_insert + normal.cast<coord_t>()) + 2;
length_sum = 0;
}
#else
const double min_dist_between_points = fuzzy_skin_point_dist * 3. / 4.; // hardcoded: the point distance may vary between 3/4 and 5/4 the supplied value
const double range_random_point_dist = fuzzy_skin_point_dist / 2.;
double dist_left_over = double(rand()) * (min_dist_between_points / 2) / double(RAND_MAX); // the distance to be traversed on the line before making the first new point
Point* p0 = &poly.points.back();
Points out;
out.reserve(poly.points.size());
for (Point &p1 : poly.points)
{ // 'a' is the (next) new point between p0 and p1
Vec2d p0p1 = (p1 - *p0).cast<double>();
double p0p1_size = p0p1.norm();
// so that p0p1_size - dist_last_point evaulates to dist_left_over - p0p1_size
double dist_last_point = dist_left_over + p0p1_size * 2.;
for (double p0pa_dist = dist_left_over; p0pa_dist < p0p1_size;
p0pa_dist += min_dist_between_points + double(rand()) * range_random_point_dist / double(RAND_MAX))
{
double r = double(rand()) * (fuzzy_skin_thickness * 2.) / double(RAND_MAX) - fuzzy_skin_thickness;
out.emplace_back(*p0 + (p0p1 * (p0pa_dist / p0p1_size) + perp(p0p1).cast<double>().normalized() * r).cast<coord_t>());
dist_last_point = p0pa_dist;
}
dist_left_over = p0p1_size - dist_last_point;
p0 = &p1;
}
while (out.size() < 3) {
size_t point_idx = poly.size() - 2;
out.emplace_back(poly[point_idx]);
if (point_idx == 0)
break;
-- point_idx;
}
if (out.size() >= 3)
poly.points = std::move(out);
#endif
}
void PerimeterGenerator::process() void PerimeterGenerator::process()
{ {
// nasty hack! initialize random generator
auto time_us = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch()).count();
srand(this->layer_id * time_us);
// other perimeters // other perimeters
m_mm3_per_mm = this->perimeter_flow.mm3_per_mm(); m_mm3_per_mm = this->perimeter_flow.mm3_per_mm();
coord_t perimeter_width = this->perimeter_flow.scaled_width(); coord_t perimeter_width = this->perimeter_flow.scaled_width();
@ -396,30 +317,8 @@ void PerimeterGenerator::process()
} }
// fuzzy skin configuration // fuzzy skin configuration
double fuzzy_skin_thickness = scale_(this->object_config->fuzzy_skin_thickness); double fuzzy_skin_thickness = scale_(this->config->fuzzy_skin_thickness);
double fuzzy_skin_point_dist = scale_(this->object_config->fuzzy_skin_point_dist); double fuzzy_skin_point_dist = scale_(this->config->fuzzy_skin_point_dist);
//FuzzyShape fuzzy_skin_shape;
if (this->object_config->fuzzy_skin_perimeter_mode != FuzzySkinPerimeterMode::None) {
/*
switch (this->object_config->fuzzy_skin_shape) {
case FuzzySkinShape::Triangle1:
case FuzzySkinShape::Triangle2:
case FuzzySkinShape::Triangle3:
fuzzy_skin_shape = FuzzyShape::Triangle;
break;
case FuzzySkinShape::Sawtooth1:
case FuzzySkinShape::Sawtooth2:
case FuzzySkinShape::Sawtooth3:
fuzzy_skin_shape = FuzzyShape::Sawtooth;
break;
case FuzzySkinShape::Random1:
case FuzzySkinShape::Random2:
case FuzzySkinShape::Random3:
fuzzy_skin_shape = FuzzyShape::Random;
break;
}
*/
}
// we need to process each island separately because we might have different // we need to process each island separately because we might have different
// extra perimeters for each one // extra perimeters for each one
@ -501,39 +400,22 @@ void PerimeterGenerator::process()
// If i > loop_number, we were looking just for gaps. // If i > loop_number, we were looking just for gaps.
break; break;
} }
for (ExPolygon &expolygon : offsets) { {
const bool fuzzify_contours = this->config->fuzzy_skin != FuzzySkinType::None && i == 0 && this->layer_id > 0;
const bool fuzzify_holes = fuzzify_contours && this->config->fuzzy_skin == FuzzySkinType::All;
for (const ExPolygon &expolygon : offsets) {
// Outer contour may overlap with an inner contour, // Outer contour may overlap with an inner contour,
// inner contour may overlap with another inner contour, // inner contour may overlap with another inner contour,
// outer contour may overlap with itself. // outer contour may overlap with itself.
//FIXME evaluate the overlaps, annotate each point with an overlap depth, //FIXME evaluate the overlaps, annotate each point with an overlap depth,
bool skip_polygon = false;
if (this->object_config->fuzzy_skin_perimeter_mode != FuzzySkinPerimeterMode::None) {
if (i == 0 && (this->object_config->fuzzy_skin_perimeter_mode != FuzzySkinPerimeterMode::ExternalSkipFirst || this->layer_id > 0)) {
if (
this->object_config->fuzzy_skin_perimeter_mode == FuzzySkinPerimeterMode::External ||
this->object_config->fuzzy_skin_perimeter_mode == FuzzySkinPerimeterMode::ExternalSkipFirst
) {
ExPolygon expolygon_fuzzy(expolygon);
fuzzy_polygon(expolygon_fuzzy.contour, /* fuzzy_skin_shape, */ fuzzy_skin_thickness, fuzzy_skin_point_dist);
// compensate for the depth of intersection. // compensate for the depth of intersection.
contours[i].emplace_back(PerimeterGeneratorLoop(expolygon_fuzzy.contour, i, true)); contours[i].emplace_back(expolygon.contour, i, true, fuzzify_contours);
skip_polygon = true;
} else
fuzzy_polygon(expolygon.contour, /* fuzzy_skin_shape, */ fuzzy_skin_thickness, fuzzy_skin_point_dist);
}
}
if (!skip_polygon) {
// compensate for the depth of intersection.
contours[i].emplace_back(PerimeterGeneratorLoop(expolygon.contour, i, true));
}
if (! expolygon.holes.empty()) { if (! expolygon.holes.empty()) {
holes[i].reserve(holes[i].size() + expolygon.holes.size()); holes[i].reserve(holes[i].size() + expolygon.holes.size());
for (const Polygon &hole : expolygon.holes) for (const Polygon &hole : expolygon.holes)
holes[i].emplace_back(PerimeterGeneratorLoop(hole, i, false)); holes[i].emplace_back(hole, i, false, fuzzify_holes);
}
} }
} }
last = std::move(offsets); last = std::move(offsets);

View File

@ -411,7 +411,7 @@ const std::vector<std::string>& Preset::print_options()
"solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first", "solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first",
"ironing", "ironing_type", "ironing_flowrate", "ironing_speed", "ironing_spacing", "ironing", "ironing_type", "ironing_flowrate", "ironing_speed", "ironing_spacing",
"max_print_speed", "max_volumetric_speed", "avoid_crossing_perimeters_max_detour", "max_print_speed", "max_volumetric_speed", "avoid_crossing_perimeters_max_detour",
"fuzzy_skin_perimeter_mode", /* "fuzzy_skin_shape", */ "fuzzy_skin_thickness", "fuzzy_skin_point_dist", "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_dist",
#ifdef HAS_PRESSURE_EQUALIZER #ifdef HAS_PRESSURE_EQUALIZER
"max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
#endif /* HAS_PRESSURE_EQUALIZER */ #endif /* HAS_PRESSURE_EQUALIZER */

View File

@ -1039,51 +1039,20 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert; def->mode = comExpert;
def->set_default_value(new ConfigOptionInts { 0 }); def->set_default_value(new ConfigOptionInts { 0 });
def = this->add("fuzzy_skin_perimeter_mode", coEnum); def = this->add("fuzzy_skin", coEnum);
def->label = L("Fuzzy skin perimeter mode"); def->label = L("Fuzzy Skin");
def->category = L("Fuzzy Skin"); def->category = L("Fuzzy Skin");
def->tooltip = L("Fuzzy skin perimeter mode."); def->tooltip = L("Fuzzy skin type.");
def->enum_keys_map = &ConfigOptionEnum<FuzzySkinPerimeterMode>::get_enum_values(); def->enum_keys_map = &ConfigOptionEnum<FuzzySkinType>::get_enum_values();
def->enum_values.push_back("none"); def->enum_values.push_back("none");
def->enum_values.push_back("external_only"); def->enum_values.push_back("external");
def->enum_values.push_back("external_only_skip_first_layer");
def->enum_values.push_back("all"); def->enum_values.push_back("all");
def->enum_labels.push_back(L("None")); def->enum_labels.push_back(L("None"));
def->enum_labels.push_back(L("External")); def->enum_labels.push_back(L("External perimeters"));
def->enum_labels.push_back(L("External (skip first layer)"));
def->enum_labels.push_back(L("All perimeters")); def->enum_labels.push_back(L("All perimeters"));
def->mode = comSimple; def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<FuzzySkinPerimeterMode>(FuzzySkinPerimeterMode::None)); def->set_default_value(new ConfigOptionEnum<FuzzySkinType>(FuzzySkinType::None));
/*
def = this->add("fuzzy_skin_shape", coEnum);
def->label = L("Fuzzy skin shape");
def->category = L("Fuzzy Skin");
def->tooltip = L("Fuzzy skin shape.");
def->enum_keys_map = &ConfigOptionEnum<FuzzySkinShape>::get_enum_values();
def->enum_values.push_back("triangle1");
def->enum_values.push_back("triangle2");
def->enum_values.push_back("triangle3");
def->enum_values.push_back("sawtooth1");
def->enum_values.push_back("sawtooth2");
def->enum_values.push_back("sawtooth3");
def->enum_values.push_back("random1");
def->enum_values.push_back("random2");
def->enum_values.push_back("random3");
def->enum_labels.push_back(L("Triangle (1)"));
def->enum_labels.push_back(L("Triangle (2)"));
def->enum_labels.push_back(L("Triangle (3)"));
def->enum_labels.push_back(L("Sawtooth (1)"));
def->enum_labels.push_back(L("Sawtooth (2)"));
def->enum_labels.push_back(L("Sawtooth (3)"));
def->enum_labels.push_back(L("Random (1)"));
def->enum_labels.push_back(L("Random (2)"));
def->enum_labels.push_back(L("Random (3)"));
def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<FuzzySkinShape>(FuzzySkinShape::Triangle1));
*/
def = this->add("fuzzy_skin_thickness", coFloat); def = this->add("fuzzy_skin_thickness", coFloat);
def->label = L("Fuzzy skin thickness"); def->label = L("Fuzzy skin thickness");
@ -3357,7 +3326,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
#ifndef HAS_PRESSURE_EQUALIZER #ifndef HAS_PRESSURE_EQUALIZER
, "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", , "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
#endif /* HAS_PRESSURE_EQUALIZER */ #endif /* HAS_PRESSURE_EQUALIZER */
"serial_port", "serial_speed" "serial_port", "serial_speed",
// Introduced in some PrusaSlicer 2.3.1 alpha, later renamed or removed.
"fuzzy_skin_perimeter_mode", "fuzzy_skin_shape",
}; };
// In PrusaSlicer 2.3.0-alpha0 the "monotonous" infill was introduced, which was later renamed to "monotonic". // In PrusaSlicer 2.3.0-alpha0 the "monotonous" infill was introduced, which was later renamed to "monotonic".

View File

@ -43,27 +43,12 @@ enum AuthorizationType {
atKeyPassword, atUserPassword atKeyPassword, atUserPassword
}; };
enum class FuzzySkinPerimeterMode { enum class FuzzySkinType {
None, None,
External, External,
ExternalSkipFirst, All,
All
}; };
/*
enum class FuzzySkinShape {
Triangle1,
Triangle2,
Triangle3,
Sawtooth1,
Sawtooth2,
Sawtooth3,
Random1,
Random2,
Random3
};
*/
enum InfillPattern : int { enum InfillPattern : int {
ipRectilinear, ipMonotonic, ipAlignedRectilinear, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb, ipRectilinear, ipMonotonic, ipAlignedRectilinear, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb,
ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, ipCount, ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, ipCount,
@ -168,35 +153,16 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<AuthorizationType
return keys_map; return keys_map;
} }
template<> inline const t_config_enum_values& ConfigOptionEnum<FuzzySkinPerimeterMode>::get_enum_values() { template<> inline const t_config_enum_values& ConfigOptionEnum<FuzzySkinType>::get_enum_values() {
static t_config_enum_values keys_map; static t_config_enum_values keys_map;
if (keys_map.empty()) { if (keys_map.empty()) {
keys_map["none"] = int(FuzzySkinPerimeterMode::None); keys_map["none"] = int(FuzzySkinType::None);
keys_map["external_only"] = int(FuzzySkinPerimeterMode::External); keys_map["external"] = int(FuzzySkinType::External);
keys_map["external_only_skip_first_layer"] = int(FuzzySkinPerimeterMode::ExternalSkipFirst); keys_map["all"] = int(FuzzySkinType::All);
keys_map["all"] = int(FuzzySkinPerimeterMode::All);
} }
return keys_map; return keys_map;
} }
/*
template<> inline const t_config_enum_values& ConfigOptionEnum<FuzzySkinShape>::get_enum_values() {
static t_config_enum_values keys_map;
if (keys_map.empty()) {
keys_map["triangle1"] = int(FuzzySkinShape::Triangle1);
keys_map["triangle2"] = int(FuzzySkinShape::Triangle2);
keys_map["triangle3"] = int(FuzzySkinShape::Triangle3);
keys_map["sawtooth1"] = int(FuzzySkinShape::Sawtooth1);
keys_map["sawtooth2"] = int(FuzzySkinShape::Sawtooth2);
keys_map["sawtooth3"] = int(FuzzySkinShape::Sawtooth3);
keys_map["random1"] = int(FuzzySkinShape::Random1);
keys_map["random2"] = int(FuzzySkinShape::Random2);
keys_map["random3"] = int(FuzzySkinShape::Random3);
}
return keys_map;
}
*/
template<> inline const t_config_enum_values& ConfigOptionEnum<InfillPattern>::get_enum_values() { template<> inline const t_config_enum_values& ConfigOptionEnum<InfillPattern>::get_enum_values() {
static t_config_enum_values keys_map; static t_config_enum_values keys_map;
if (keys_map.empty()) { if (keys_map.empty()) {
@ -503,10 +469,6 @@ public:
ConfigOptionFloat elefant_foot_compensation; ConfigOptionFloat elefant_foot_compensation;
ConfigOptionFloatOrPercent extrusion_width; ConfigOptionFloatOrPercent extrusion_width;
ConfigOptionFloatOrPercent first_layer_height; ConfigOptionFloatOrPercent first_layer_height;
ConfigOptionEnum<FuzzySkinPerimeterMode> fuzzy_skin_perimeter_mode;
// ConfigOptionEnum<FuzzySkinShape> fuzzy_skin_shape;
ConfigOptionFloat fuzzy_skin_thickness;
ConfigOptionFloat fuzzy_skin_point_dist;
ConfigOptionBool infill_only_where_needed; ConfigOptionBool infill_only_where_needed;
// Force the generation of solid shells between adjacent materials/volumes. // Force the generation of solid shells between adjacent materials/volumes.
ConfigOptionBool interface_shells; ConfigOptionBool interface_shells;
@ -555,10 +517,6 @@ protected:
OPT_PTR(elefant_foot_compensation); OPT_PTR(elefant_foot_compensation);
OPT_PTR(extrusion_width); OPT_PTR(extrusion_width);
OPT_PTR(first_layer_height); OPT_PTR(first_layer_height);
OPT_PTR(fuzzy_skin_perimeter_mode);
// OPT_PTR(fuzzy_skin_shape);
OPT_PTR(fuzzy_skin_thickness);
OPT_PTR(fuzzy_skin_point_dist);
OPT_PTR(infill_only_where_needed); OPT_PTR(infill_only_where_needed);
OPT_PTR(interface_shells); OPT_PTR(interface_shells);
OPT_PTR(layer_height); OPT_PTR(layer_height);
@ -613,6 +571,9 @@ public:
ConfigOptionFloat fill_angle; ConfigOptionFloat fill_angle;
ConfigOptionPercent fill_density; ConfigOptionPercent fill_density;
ConfigOptionEnum<InfillPattern> fill_pattern; ConfigOptionEnum<InfillPattern> fill_pattern;
ConfigOptionEnum<FuzzySkinType> fuzzy_skin;
ConfigOptionFloat fuzzy_skin_thickness;
ConfigOptionFloat fuzzy_skin_point_dist;
ConfigOptionFloat gap_fill_speed; ConfigOptionFloat gap_fill_speed;
ConfigOptionFloatOrPercent infill_anchor; ConfigOptionFloatOrPercent infill_anchor;
ConfigOptionFloatOrPercent infill_anchor_max; ConfigOptionFloatOrPercent infill_anchor_max;
@ -667,6 +628,9 @@ protected:
OPT_PTR(fill_angle); OPT_PTR(fill_angle);
OPT_PTR(fill_density); OPT_PTR(fill_density);
OPT_PTR(fill_pattern); OPT_PTR(fill_pattern);
OPT_PTR(fuzzy_skin);
OPT_PTR(fuzzy_skin_thickness);
OPT_PTR(fuzzy_skin_point_dist);
OPT_PTR(gap_fill_speed); OPT_PTR(gap_fill_speed);
OPT_PTR(infill_anchor); OPT_PTR(infill_anchor);
OPT_PTR(infill_anchor_max); OPT_PTR(infill_anchor_max);

View File

@ -523,8 +523,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "gap_fill_speed" || opt_key == "gap_fill_speed"
|| opt_key == "overhangs" || opt_key == "overhangs"
|| opt_key == "first_layer_extrusion_width" || opt_key == "first_layer_extrusion_width"
|| opt_key == "fuzzy_skin_perimeter_mode" || opt_key == "fuzzy_skin"
// || opt_key == "fuzzy_skin_shape"
|| opt_key == "fuzzy_skin_thickness" || opt_key == "fuzzy_skin_thickness"
|| opt_key == "fuzzy_skin_point_dist" || opt_key == "fuzzy_skin_point_dist"
|| opt_key == "perimeter_extrusion_width" || opt_key == "perimeter_extrusion_width"

View File

@ -1202,10 +1202,8 @@ boost::any& Choice::get_value()
} }
else if (m_opt_id.compare("ironing_type") == 0) else if (m_opt_id.compare("ironing_type") == 0)
m_value = static_cast<IroningType>(ret_enum); m_value = static_cast<IroningType>(ret_enum);
else if (m_opt_id.compare("fuzzy_skin_perimeter_mode") == 0) else if (m_opt_id.compare("fuzzy_skin") == 0)
m_value = static_cast<FuzzySkinPerimeterMode>(ret_enum); m_value = static_cast<FuzzySkinType>(ret_enum);
// else if (m_opt_id.compare("fuzzy_skin_shape") == 0)
// m_value = static_cast<FuzzySkinShape>(ret_enum);
else if (m_opt_id.compare("gcode_flavor") == 0) else if (m_opt_id.compare("gcode_flavor") == 0)
m_value = static_cast<GCodeFlavor>(ret_enum); m_value = static_cast<GCodeFlavor>(ret_enum);
else if (m_opt_id.compare("machine_limits_usage") == 0) else if (m_opt_id.compare("machine_limits_usage") == 0)

View File

@ -182,10 +182,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
else if (opt_key.compare("ironing_type") == 0) else if (opt_key.compare("ironing_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<IroningType>(boost::any_cast<IroningType>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<IroningType>(boost::any_cast<IroningType>(value)));
else if (opt_key.compare("fuzzy_skin_perimeter_mode") == 0) else if (opt_key.compare("fuzzy_skin") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<FuzzySkinPerimeterMode>(boost::any_cast<FuzzySkinPerimeterMode>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<FuzzySkinType>(boost::any_cast<FuzzySkinType>(value)));
// else if (opt_key.compare("fuzzy_skin_shape") == 0)
// config.set_key_value(opt_key, new ConfigOptionEnum<FuzzySkinShape>(boost::any_cast<FuzzySkinShape>(value)));
else if (opt_key.compare("gcode_flavor") == 0) else if (opt_key.compare("gcode_flavor") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value)));
else if (opt_key.compare("machine_limits_usage") == 0) else if (opt_key.compare("machine_limits_usage") == 0)

View File

@ -869,12 +869,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
else if (opt_key == "ironing_type") { else if (opt_key == "ironing_type") {
ret = static_cast<int>(config.option<ConfigOptionEnum<IroningType>>(opt_key)->value); ret = static_cast<int>(config.option<ConfigOptionEnum<IroningType>>(opt_key)->value);
} }
else if (opt_key == "fuzzy_skin_perimeter_mode") { else if (opt_key == "fuzzy_skin") {
ret = static_cast<int>(config.option<ConfigOptionEnum<FuzzySkinPerimeterMode>>(opt_key)->value); ret = static_cast<int>(config.option<ConfigOptionEnum<FuzzySkinType>>(opt_key)->value);
} }
// else if (opt_key == "fuzzy_skin_shape") {
// ret = static_cast<int>(config.option<ConfigOptionEnum<FuzzySkinShape>>(opt_key)->value);
// }
else if (opt_key == "gcode_flavor") { else if (opt_key == "gcode_flavor") {
ret = static_cast<int>(config.option<ConfigOptionEnum<GCodeFlavor>>(opt_key)->value); ret = static_cast<int>(config.option<ConfigOptionEnum<GCodeFlavor>>(opt_key)->value);
} }

View File

@ -1438,14 +1438,9 @@ void TabPrint::build()
optgroup->append_single_option_line("gap_fill_enabled"); optgroup->append_single_option_line("gap_fill_enabled");
optgroup = page->new_optgroup(L("Fuzzy skin (experimental)")); optgroup = page->new_optgroup(L("Fuzzy skin (experimental)"));
Option option = optgroup->get_option("fuzzy_skin_perimeter_mode"); Option option = optgroup->get_option("fuzzy_skin");
option.opt.width = 30; option.opt.width = 30;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
#if 0
option = optgroup->get_option("fuzzy_skin_shape");
option.opt.width = 30;
optgroup->append_single_option_line(option);
#endif
optgroup->append_single_option_line(optgroup->get_option("fuzzy_skin_thickness")); optgroup->append_single_option_line(optgroup->get_option("fuzzy_skin_thickness"));
optgroup->append_single_option_line(optgroup->get_option("fuzzy_skin_point_dist")); optgroup->append_single_option_line(optgroup->get_option("fuzzy_skin_point_dist"));