diff --git a/src/libslic3r/ContourZ.cpp b/src/libslic3r/ContourZ.cpp index ee4f8d1dbd..dc6cc08f46 100644 --- a/src/libslic3r/ContourZ.cpp +++ b/src/libslic3r/ContourZ.cpp @@ -38,7 +38,7 @@ static bool contour_extrusion_path(LayerRegion *region, const sla::IndexedMesh & Layer *layer = region->layer(); coordf_t mesh_z = layer->print_z + mesh.ground_level(); - coordf_t min_z = layer->object()->config().zaa_min_z; + coordf_t min_z = region->region().config().zaa_min_z; const Points3 &points = path.polyline.points; double resolution_mm = 0.1; diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 59b926e370..2b1a5d86cf 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -1218,7 +1218,10 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: std::unique_ptr f = std::unique_ptr(Fill::new_from_type(surface_fill.params.pattern)); f->set_bounding_box(bbox); f->layer_id = this->id(); - f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction; + { + const auto &rcfg = m_regions[surface_fill.region_id]->region().config(); + f->dont_alternate_fill_direction = rcfg.zaa_enabled && rcfg.zaa_dont_alternate_fill_direction; + } f->z = this->print_z; f->angle = surface_fill.params.angle; f->fixed_angle = surface_fill.params.fixed_angle; @@ -1419,7 +1422,10 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc std::unique_ptr f = std::unique_ptr(Fill::new_from_type(surface_fill.params.pattern)); f->set_bounding_box(bbox); f->layer_id = this->id() - this->object()->get_layer(0)->id(); // We need to subtract raft layers. - f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction; + { + const auto &rcfg = m_regions[surface_fill.region_id]->region().config(); + f->dont_alternate_fill_direction = rcfg.zaa_enabled && rcfg.zaa_dont_alternate_fill_direction; + } f->z = this->print_z; f->angle = surface_fill.params.angle; f->fixed_angle = surface_fill.params.fixed_angle; @@ -1592,12 +1598,12 @@ void Layer::make_ironing() std::unique_ptr f = std::unique_ptr(Fill::new_from_type(f_pattern)); f->set_bounding_box(this->object()->bounding_box()); f->layer_id = this->id(); - f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction; f->z = this->print_z; f->overlap = 0; for (size_t i = 0; i < by_extruder.size();) { // Find span of regions equivalent to the ironing operation. IroningParams &ironing_params = by_extruder[i]; + f->dont_alternate_fill_direction = ironing_params.layerm->region().config().zaa_enabled && ironing_params.layerm->region().config().zaa_dont_alternate_fill_direction; // Create the filler object. if( f_pattern != ironing_params.pattern ) { @@ -1605,7 +1611,6 @@ void Layer::make_ironing() f = std::unique_ptr(Fill::new_from_type(f_pattern)); f->set_bounding_box(this->object()->bounding_box()); f->layer_id = this->id(); - f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction; f->z = this->print_z; f->overlap = 0; } diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 8da739a9d5..55586a8adb 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1036,11 +1036,6 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, interlocking_depth)) ((ConfigOptionInt, interlocking_boundary_avoidance)) - // Z Anti-Aliasing (aka Z Contouring) - ((ConfigOptionBool, zaa_enabled)) - ((ConfigOptionBool, zaa_dont_alternate_fill_direction)) - ((ConfigOptionFloat, zaa_min_z)) - // Orca: internal use only ((ConfigOptionBool, calib_flowrate_topinfill_special_order)) // ORCA: special flag for flow rate calibration ) @@ -1203,8 +1198,13 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloatOrPercent, scarf_joint_speed)) ((ConfigOptionFloat, scarf_joint_flow_ratio)) ((ConfigOptionPercent, scarf_overhang_threshold)) + // Orca: Z Anti-Aliasing (aka Z Contouring) - ((ConfigOptionBool, zaa_enabled))((ConfigOptionFloat, zaa_minimize_perimeter_height))) + ((ConfigOptionBool, zaa_enabled)) + ((ConfigOptionBool, zaa_dont_alternate_fill_direction)) + ((ConfigOptionFloat, zaa_min_z)) + ((ConfigOptionFloat, zaa_minimize_perimeter_height)) + ) PRINT_CONFIG_CLASS_DEFINE( MachineEnvelopeConfig, diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index b67f8a7ced..4e41fa7151 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -718,10 +718,6 @@ void PrintObject::ironing() bool PrintObject::need_z_contouring() const { - if (this->config().zaa_enabled) { - return true; - } - size_t num_regions = this->num_printing_regions(); for (size_t region_id = 0; region_id < num_regions; region_id++) { if (this->printing_region(region_id).config().zaa_enabled) diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index a30a95fc7e..abeb420e00 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -35,8 +35,18 @@ LayerPtrs new_layers( coordf_t lo = object_layers[i_layer]; coordf_t hi = object_layers[i_layer + 1]; coordf_t slice_z = 0.5 * (lo + hi); - if (print_object->config().zaa_enabled) { - coordf_t z_offset = print_object->config().zaa_min_z; + bool zaa_active = false; + coordf_t z_offset = 0.0; + size_t num_regions = print_object->num_printing_regions(); + for (size_t rid = 0; rid < num_regions; ++rid) { + const auto &rcfg = print_object->printing_region(rid).config(); + if (rcfg.zaa_enabled) { + if (!zaa_active || rcfg.zaa_min_z < z_offset) + z_offset = rcfg.zaa_min_z; + zaa_active = true; + } + } + if (zaa_active) { slice_z = lo + z_offset; if (slice_z < lo || slice_z > hi) { throw RuntimeError("Bad min Z value");