Allowed "Slicing engine" and all Arachne parameters to be settable per object.

This commit is contained in:
Lukáš Hejl 2022-03-14 09:00:36 +01:00
parent 556e2b71cc
commit adf2d21c67
7 changed files with 43 additions and 43 deletions

View file

@ -17,36 +17,36 @@ namespace Slic3r::Arachne
{ {
WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t nominal_bead_width, const size_t inset_count, const coord_t wall_0_inset, WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t nominal_bead_width, const size_t inset_count, const coord_t wall_0_inset,
const PrintConfig &print_config) const PrintObjectConfig &print_object_config)
: outline(outline) : outline(outline)
, bead_width_0(nominal_bead_width) , bead_width_0(nominal_bead_width)
, bead_width_x(nominal_bead_width) , bead_width_x(nominal_bead_width)
, inset_count(inset_count) , inset_count(inset_count)
, wall_0_inset(wall_0_inset) , wall_0_inset(wall_0_inset)
, strategy_type(print_config.beading_strategy_type.value) , strategy_type(print_object_config.beading_strategy_type.value)
, print_thin_walls(Slic3r::Arachne::fill_outline_gaps) , print_thin_walls(Slic3r::Arachne::fill_outline_gaps)
, min_feature_size(scaled<coord_t>(print_config.min_feature_size.value)) , min_feature_size(scaled<coord_t>(print_object_config.min_feature_size.value))
, min_bead_width(scaled<coord_t>(print_config.min_bead_width.value)) , min_bead_width(scaled<coord_t>(print_object_config.min_bead_width.value))
, small_area_length(static_cast<double>(nominal_bead_width) / 2.) , small_area_length(static_cast<double>(nominal_bead_width) / 2.)
, toolpaths_generated(false) , toolpaths_generated(false)
, print_config(print_config) , print_object_config(print_object_config)
{ {
} }
WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t bead_width_0, const coord_t bead_width_x, WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t bead_width_0, const coord_t bead_width_x,
const size_t inset_count, const coord_t wall_0_inset, const PrintConfig &print_config) const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config)
: outline(outline) : outline(outline)
, bead_width_0(bead_width_0) , bead_width_0(bead_width_0)
, bead_width_x(bead_width_x) , bead_width_x(bead_width_x)
, inset_count(inset_count) , inset_count(inset_count)
, wall_0_inset(wall_0_inset) , wall_0_inset(wall_0_inset)
, strategy_type(print_config.beading_strategy_type.value) , strategy_type(print_object_config.beading_strategy_type.value)
, print_thin_walls(Slic3r::Arachne::fill_outline_gaps) , print_thin_walls(Slic3r::Arachne::fill_outline_gaps)
, min_feature_size(scaled<coord_t>(print_config.min_feature_size.value)) , min_feature_size(scaled<coord_t>(print_object_config.min_feature_size.value))
, min_bead_width(scaled<coord_t>(print_config.min_bead_width.value)) , min_bead_width(scaled<coord_t>(print_object_config.min_bead_width.value))
, small_area_length(static_cast<double>(bead_width_0) / 2.) , small_area_length(static_cast<double>(bead_width_0) / 2.)
, toolpaths_generated(false) , toolpaths_generated(false)
, print_config(print_config) , print_object_config(print_object_config)
{ {
} }
@ -491,7 +491,7 @@ const VariableWidthPaths& WallToolPaths::generate()
const coord_t smallest_segment = Slic3r::Arachne::meshfix_maximum_resolution; const coord_t smallest_segment = Slic3r::Arachne::meshfix_maximum_resolution;
const coord_t allowed_distance = Slic3r::Arachne::meshfix_maximum_deviation; const coord_t allowed_distance = Slic3r::Arachne::meshfix_maximum_deviation;
const coord_t epsilon_offset = (allowed_distance / 2) - 1; const coord_t epsilon_offset = (allowed_distance / 2) - 1;
const double transitioning_angle = Geometry::deg2rad(this->print_config.wall_transition_angle.value); const double transitioning_angle = Geometry::deg2rad(this->print_object_config.wall_transition_angle.value);
constexpr coord_t discretization_step_size = scaled<coord_t>(0.8); constexpr coord_t discretization_step_size = scaled<coord_t>(0.8);
// Simplify outline for boost::voronoi consumption. Absolutely no self intersections or near-self intersections allowed: // Simplify outline for boost::voronoi consumption. Absolutely no self intersections or near-self intersections allowed:
@ -508,10 +508,10 @@ const VariableWidthPaths& WallToolPaths::generate()
if (area(prepared_outline) > 0) if (area(prepared_outline) > 0)
{ {
const coord_t wall_transition_length = scaled<coord_t>(this->print_config.wall_transition_length.value); const coord_t wall_transition_length = scaled<coord_t>(this->print_object_config.wall_transition_length.value);
const double wall_split_middle_threshold = this->print_config.wall_split_middle_threshold.value / 100.; // For an uneven nr. of lines: When to split the middle wall into two. const double wall_split_middle_threshold = this->print_object_config.wall_split_middle_threshold.value / 100.; // For an uneven nr. of lines: When to split the middle wall into two.
const double wall_add_middle_threshold = this->print_config.wall_add_middle_threshold.value / 100.; // For an even nr. of lines: When to add a new middle in between the innermost two walls. const double wall_add_middle_threshold = this->print_object_config.wall_add_middle_threshold.value / 100.; // For an even nr. of lines: When to add a new middle in between the innermost two walls.
const int wall_distribution_count = this->print_config.wall_distribution_count.value; const int wall_distribution_count = this->print_object_config.wall_distribution_count.value;
const size_t max_bead_count = (inset_count < std::numeric_limits<coord_t>::max() / 2) ? 2 * inset_count : std::numeric_limits<coord_t>::max(); const size_t max_bead_count = (inset_count < std::numeric_limits<coord_t>::max() / 2) ? 2 * inset_count : std::numeric_limits<coord_t>::max();
const auto beading_strat = BeadingStrategyFactory::makeStrategy const auto beading_strat = BeadingStrategyFactory::makeStrategy
( (
@ -529,7 +529,7 @@ const VariableWidthPaths& WallToolPaths::generate()
wall_0_inset, wall_0_inset,
wall_distribution_count wall_distribution_count
); );
const coord_t transition_filter_dist = scaled<coord_t>(this->print_config.wall_transition_filter_distance.value); const coord_t transition_filter_dist = scaled<coord_t>(this->print_object_config.wall_transition_filter_distance.value);
SkeletalTrapezoidation wall_maker SkeletalTrapezoidation wall_maker
( (
prepared_outline, prepared_outline,

View file

@ -29,7 +29,7 @@ public:
* \param inset_count The maximum number of parallel extrusion lines that make up the wall * \param inset_count The maximum number of parallel extrusion lines that make up the wall
* \param wall_0_inset How far to inset the outer wall, to make it adhere better to other walls. * \param wall_0_inset How far to inset the outer wall, to make it adhere better to other walls.
*/ */
WallToolPaths(const Polygons& outline, const coord_t nominal_bead_width, const size_t inset_count, const coord_t wall_0_inset, const PrintConfig &print_config); WallToolPaths(const Polygons& outline, const coord_t nominal_bead_width, const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config);
/*! /*!
* A class that creates the toolpaths given an outline, nominal bead width and maximum amount of walls * A class that creates the toolpaths given an outline, nominal bead width and maximum amount of walls
@ -39,7 +39,7 @@ public:
* \param inset_count The maximum number of parallel extrusion lines that make up the wall * \param inset_count The maximum number of parallel extrusion lines that make up the wall
* \param wall_0_inset How far to inset the outer wall, to make it adhere better to other walls. * \param wall_0_inset How far to inset the outer wall, to make it adhere better to other walls.
*/ */
WallToolPaths(const Polygons& outline, const coord_t bead_width_0, const coord_t bead_width_x, const size_t inset_count, const coord_t wall_0_inset, const PrintConfig &print_config); WallToolPaths(const Polygons& outline, const coord_t bead_width_0, const coord_t bead_width_x, const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config);
/*! /*!
* Generates the Toolpaths * Generates the Toolpaths
@ -122,7 +122,7 @@ private:
bool toolpaths_generated; //<! Are the toolpaths generated bool toolpaths_generated; //<! Are the toolpaths generated
VariableWidthPaths toolpaths; //<! The generated toolpaths VariableWidthPaths toolpaths; //<! The generated toolpaths
Polygons inner_contour; //<! The inner contour of the generated toolpaths Polygons inner_contour; //<! The inner contour of the generated toolpaths
const PrintConfig &print_config; const PrintObjectConfig &print_object_config;
}; };
} // namespace Slic3r::Arachne } // namespace Slic3r::Arachne

View file

@ -101,7 +101,7 @@ void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollec
g.overhang_flow = this->bridging_flow(frPerimeter); g.overhang_flow = this->bridging_flow(frPerimeter);
g.solid_infill_flow = this->flow(frSolidInfill); g.solid_infill_flow = this->flow(frSolidInfill);
if (print_config.slicing_engine.value == SlicingEngine::Arachne) if (this->layer()->object()->config().slicing_engine.value == SlicingEngine::Arachne)
g.process_arachne(); g.process_arachne();
else else
g.process_classic(); g.process_classic();

View file

@ -315,7 +315,7 @@ void PerimeterGenerator::process_arachne()
coord_t bead_width_x = perimeter_width; coord_t bead_width_x = perimeter_width;
coord_t wall_0_inset = 0; coord_t wall_0_inset = 0;
Arachne::WallToolPaths wallToolPaths(last_p, bead_width_0, bead_width_x, coord_t(loop_number + 1), wall_0_inset, *this->print_config); Arachne::WallToolPaths wallToolPaths(last_p, bead_width_0, bead_width_x, coord_t(loop_number + 1), wall_0_inset, *this->object_config);
wallToolPaths.generate(); wallToolPaths.generate();
std::set<size_t> bins_with_index_zero_perimeters; std::set<size_t> bins_with_index_zero_perimeters;

View file

@ -222,18 +222,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
osteps.emplace_back(posInfill); osteps.emplace_back(posInfill);
osteps.emplace_back(posSupportMaterial); osteps.emplace_back(posSupportMaterial);
steps.emplace_back(psSkirtBrim); steps.emplace_back(psSkirtBrim);
} else if (
opt_key == "slicing_engine"
|| opt_key == "beading_strategy_type"
|| opt_key == "wall_transition_length"
|| opt_key == "wall_transition_filter_distance"
|| opt_key == "wall_transition_angle"
|| opt_key == "wall_distribution_count"
|| opt_key == "wall_split_middle_threshold"
|| opt_key == "wall_add_middle_threshold"
|| opt_key == "min_feature_size"
|| opt_key == "min_bead_width") {
osteps.emplace_back(posSlice);
} else { } else {
// for legacy, if we can't handle this option let's invalidate all steps // for legacy, if we can't handle this option let's invalidate all steps
//FIXME invalidate all steps of all objects as well? //FIXME invalidate all steps of all objects as well?

View file

@ -497,6 +497,16 @@ PRINT_CONFIG_CLASS_DEFINE(
// ((ConfigOptionFloat, seam_preferred_direction_jitter)) // ((ConfigOptionFloat, seam_preferred_direction_jitter))
((ConfigOptionFloat, slice_closing_radius)) ((ConfigOptionFloat, slice_closing_radius))
((ConfigOptionEnum<SlicingMode>, slicing_mode)) ((ConfigOptionEnum<SlicingMode>, slicing_mode))
((ConfigOptionEnum<SlicingEngine>, slicing_engine))
((ConfigOptionEnum<BeadingStrategyType>, beading_strategy_type))
((ConfigOptionFloat, wall_transition_length))
((ConfigOptionFloat, wall_transition_filter_distance))
((ConfigOptionFloat, wall_transition_angle))
((ConfigOptionInt, wall_distribution_count))
((ConfigOptionPercent, wall_split_middle_threshold))
((ConfigOptionPercent, wall_add_middle_threshold))
((ConfigOptionFloat, min_feature_size))
((ConfigOptionFloat, min_bead_width))
((ConfigOptionBool, support_material)) ((ConfigOptionBool, support_material))
// Automatic supports (generated based on support_material_threshold). // Automatic supports (generated based on support_material_threshold).
((ConfigOptionBool, support_material_auto)) ((ConfigOptionBool, support_material_auto))
@ -768,16 +778,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, skirt_distance)) ((ConfigOptionFloat, skirt_distance))
((ConfigOptionInt, skirt_height)) ((ConfigOptionInt, skirt_height))
((ConfigOptionInt, skirts)) ((ConfigOptionInt, skirts))
((ConfigOptionEnum<SlicingEngine>, slicing_engine))
((ConfigOptionEnum<BeadingStrategyType>, beading_strategy_type))
((ConfigOptionFloat, wall_transition_length))
((ConfigOptionFloat, wall_transition_filter_distance))
((ConfigOptionFloat, wall_transition_angle))
((ConfigOptionInt, wall_distribution_count))
((ConfigOptionPercent, wall_split_middle_threshold))
((ConfigOptionPercent, wall_add_middle_threshold))
((ConfigOptionFloat, min_feature_size))
((ConfigOptionFloat, min_bead_width))
((ConfigOptionInts, slowdown_below_layer_time)) ((ConfigOptionInts, slowdown_below_layer_time))
((ConfigOptionBool, spiral_vase)) ((ConfigOptionBool, spiral_vase))
((ConfigOptionInt, standby_temperature_delta)) ((ConfigOptionInt, standby_temperature_delta))

View file

@ -661,6 +661,18 @@ bool PrintObject::invalidate_state_by_config_options(
steps.emplace_back(posInfill); steps.emplace_back(posInfill);
steps.emplace_back(posSupportMaterial); steps.emplace_back(posSupportMaterial);
} }
} else if (
opt_key == "slicing_engine"
|| opt_key == "beading_strategy_type"
|| opt_key == "wall_transition_length"
|| opt_key == "wall_transition_filter_distance"
|| opt_key == "wall_transition_angle"
|| opt_key == "wall_distribution_count"
|| opt_key == "wall_split_middle_threshold"
|| opt_key == "wall_add_middle_threshold"
|| opt_key == "min_feature_size"
|| opt_key == "min_bead_width") {
steps.emplace_back(posSlice);
} else if ( } else if (
opt_key == "seam_position" opt_key == "seam_position"
|| opt_key == "seam_preferred_direction" || opt_key == "seam_preferred_direction"