mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-31 07:58:43 +03:00
PRUSA 2.7.0
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
#include "ExPolygon.hpp"
|
||||
#include "Exception.hpp"
|
||||
#include "Flow.hpp"
|
||||
#include "GCode/ExtrusionProcessor.hpp"
|
||||
#include "KDTreeIndirect.hpp"
|
||||
#include "Line.hpp"
|
||||
#include "Point.hpp"
|
||||
#include "Polygon.hpp"
|
||||
#include "Polyline.hpp"
|
||||
@@ -533,6 +535,64 @@ void PrintObject::estimate_curled_extrusions()
|
||||
}
|
||||
}
|
||||
|
||||
void PrintObject::calculate_overhanging_perimeters()
|
||||
{
|
||||
if (this->set_started(posCalculateOverhangingPerimeters)) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Calculating overhanging perimeters - start";
|
||||
m_print->set_status(89, _u8L("Calculating overhanging perimeters"));
|
||||
std::vector<unsigned int> extruders;
|
||||
std::unordered_set<const PrintRegion *> regions_with_dynamic_speeds;
|
||||
for (const PrintRegion *pr : this->print()->m_print_regions) {
|
||||
if (pr->config().enable_dynamic_overhang_speeds.getBool()) {
|
||||
regions_with_dynamic_speeds.insert(pr);
|
||||
}
|
||||
extruders.clear();
|
||||
pr->collect_object_printing_extruders(*this->print(), extruders);
|
||||
auto cfg = this->print()->config();
|
||||
if (std::any_of(extruders.begin(), extruders.end(),
|
||||
[&cfg](unsigned int extruder_id) { return cfg.enable_dynamic_fan_speeds.get_at(extruder_id); })) {
|
||||
regions_with_dynamic_speeds.insert(pr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!regions_with_dynamic_speeds.empty()) {
|
||||
std::unordered_map<size_t, AABBTreeLines::LinesDistancer<CurledLine>> curled_lines;
|
||||
std::unordered_map<size_t, AABBTreeLines::LinesDistancer<Linef>> unscaled_polygons_lines;
|
||||
for (const Layer *l : this->layers()) {
|
||||
curled_lines[l->id()] = AABBTreeLines::LinesDistancer<CurledLine>{l->curled_lines};
|
||||
unscaled_polygons_lines[l->id()] = AABBTreeLines::LinesDistancer<Linef>{to_unscaled_linesf(l->lslices)};
|
||||
}
|
||||
curled_lines[size_t(-1)] = {};
|
||||
unscaled_polygons_lines[size_t(-1)] = {};
|
||||
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, m_layers.size()), [this, &curled_lines, &unscaled_polygons_lines,
|
||||
®ions_with_dynamic_speeds](
|
||||
const tbb::blocked_range<size_t> &range) {
|
||||
PRINT_OBJECT_TIME_LIMIT_MILLIS(PRINT_OBJECT_TIME_LIMIT_DEFAULT);
|
||||
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {
|
||||
auto l = m_layers[layer_idx];
|
||||
if (l->id() == 0) { // first layer, do not split
|
||||
continue;
|
||||
}
|
||||
for (LayerRegion *layer_region : l->regions()) {
|
||||
if (regions_with_dynamic_speeds.find(layer_region->m_region) == regions_with_dynamic_speeds.end()) {
|
||||
continue;
|
||||
}
|
||||
size_t prev_layer_id = l->lower_layer ? l->lower_layer->id() : size_t(-1);
|
||||
layer_region->m_perimeters =
|
||||
ExtrusionProcessor::calculate_and_split_overhanging_extrusions(&layer_region->m_perimeters,
|
||||
unscaled_polygons_lines[prev_layer_id],
|
||||
curled_lines[l->id()]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
m_print->throw_if_canceled();
|
||||
BOOST_LOG_TRIVIAL(debug) << "Calculating overhanging perimeters - end";
|
||||
}
|
||||
this->set_done(posCalculateOverhangingPerimeters);
|
||||
}
|
||||
}
|
||||
std::pair<FillAdaptive::OctreePtr, FillAdaptive::OctreePtr> PrintObject::prepare_adaptive_infill_data(
|
||||
const std::vector<std::pair<const Surface *, float>> &surfaces_w_bottom_z) const
|
||||
{
|
||||
@@ -644,7 +704,8 @@ bool PrintObject::invalidate_state_by_config_options(
|
||||
|| opt_key == "first_layer_extrusion_width"
|
||||
|| opt_key == "perimeter_extrusion_width"
|
||||
|| opt_key == "infill_overlap"
|
||||
|| opt_key == "external_perimeters_first") {
|
||||
|| opt_key == "external_perimeters_first"
|
||||
|| opt_key == "arc_fitting") {
|
||||
steps.emplace_back(posPerimeters);
|
||||
} else if (
|
||||
opt_key == "gap_fill_enabled"
|
||||
@@ -848,7 +909,7 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
|
||||
|
||||
// propagate to dependent steps
|
||||
if (step == posPerimeters) {
|
||||
invalidated |= this->invalidate_steps({ posPrepareInfill, posInfill, posIroning, posSupportSpotsSearch, posEstimateCurledExtrusions });
|
||||
invalidated |= this->invalidate_steps({ posPrepareInfill, posInfill, posIroning, posSupportSpotsSearch, posEstimateCurledExtrusions, posCalculateOverhangingPerimeters });
|
||||
invalidated |= m_print->invalidate_steps({ psSkirtBrim });
|
||||
} else if (step == posPrepareInfill) {
|
||||
invalidated |= this->invalidate_steps({ posInfill, posIroning, posSupportSpotsSearch});
|
||||
@@ -857,7 +918,7 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
|
||||
invalidated |= m_print->invalidate_steps({ psSkirtBrim });
|
||||
} else if (step == posSlice) {
|
||||
invalidated |= this->invalidate_steps({posPerimeters, posPrepareInfill, posInfill, posIroning, posSupportSpotsSearch,
|
||||
posSupportMaterial, posEstimateCurledExtrusions});
|
||||
posSupportMaterial, posEstimateCurledExtrusions, posCalculateOverhangingPerimeters});
|
||||
invalidated |= m_print->invalidate_steps({ psSkirtBrim });
|
||||
m_slicing_params.valid = false;
|
||||
} else if (step == posSupportMaterial) {
|
||||
@@ -1554,7 +1615,7 @@ void PrintObject::discover_vertical_shells()
|
||||
to_polygons(m_layers[idx_layer + 1]->lslices) :
|
||||
Polygons{};
|
||||
object_volume = intersection(shrinked_bottom_slice, shrinked_upper_slice);
|
||||
internal_volume = closing(polygonsInternal, SCALED_EPSILON);
|
||||
internal_volume = closing(polygonsInternal, float(SCALED_EPSILON));
|
||||
}
|
||||
|
||||
// The regularization operation may cause scattered tiny drops on the smooth parts of the model, filter them out
|
||||
|
||||
Reference in New Issue
Block a user