Merge branch 'main' into main

This commit is contained in:
Rodrigo Faselli
2026-10-03 14:41:20 -03:00
committed by GitHub
892 changed files with 7766 additions and 368 deletions
@@ -4,10 +4,16 @@
// Implementation file for the AdaptivePAInterpolator class, providing methods to parse data and perform PA interpolation.
#include "AdaptivePAInterpolator.hpp"
#include <map>
#include "libslic3r/GCode/PchipInterpolatorHelper.hpp"
#include <exception>
#include <stdexcept>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <utility>
/**
* @brief Parses the input data and sets up the interpolators.
@@ -4,11 +4,20 @@
// Implementation of the AdaptivePAProcessor class, responsible for processing G-code layers with adaptive pressure advance.
#include "../GCode.hpp"
#include "libslic3r/GCode/AdaptivePAInterpolator.hpp"
#include "libslic3r/libslic3r.h"
#include "AdaptivePAProcessor.hpp"
#include <memory>
#include <cstddef>
#include <regex>
#include <iosfwd>
#include <algorithm>
#include <exception>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cctype>
#include <string>
namespace Slic3r {
@@ -32,6 +41,9 @@ AdaptivePAProcessor::AdaptivePAProcessor(GCode &gcodegen)
m_pa_change_pattern(R"(; PA_CHANGE:T(\d+) MM3MM:([0-9]*\.[0-9]+) ACCEL:(\d+) BR:(\d+) RC:(\d+) OV:(\d+))"),
m_g1_f_pattern(R"(G1 F([0-9]+))")
{
const size_t indices = std::max(m_config.adaptive_pressure_advance.size(), m_config.enable_pressure_advance.size());
for (size_t i = 0; i < indices && !m_enabled; ++i)
m_enabled = m_config.adaptive_pressure_advance.get_at(i) && m_config.enable_pressure_advance.get_at(i);
}
// Method to get the interpolator for a specific filament config index.
@@ -57,6 +69,12 @@ AdaptivePAInterpolator* AdaptivePAProcessor::getInterpolator(unsigned int config
* @return A string containing the processed G-code with adaptive pressure advance applied.
*/
std::string AdaptivePAProcessor::process_layer(std::string &&gcode) {
// Without PA_CHANGE tags the loop below would only terminate the layer's last line.
if (!m_enabled && gcode.find("; PA_CHANGE") == std::string::npos) {
if (!gcode.empty() && gcode.back() != '\n')
gcode += '\n';
return std::move(gcode);
}
std::istringstream stream(gcode);
std::string line;
std::ostringstream output;
@@ -11,12 +11,14 @@
#include <regex>
#include <memory>
#include <map>
#include <unordered_map>
#include "AdaptivePAInterpolator.hpp"
namespace Slic3r {
// Forward declaration of GCode class
class GCode;
class PrintConfig;
/**
* @brief Class for processing G-code layers with adaptive pressure advance.
@@ -76,6 +78,7 @@ private:
double m_next_feedrate; ///< First feed rate (speed) for the upcomming island.
double m_current_feedrate; ///< Current, latest feedrate.
int m_last_config_index; ///< Filament config index of the last PA_CHANGE tag.
bool m_enabled{false}; ///< Whether any filament config index has both PA and adaptive PA on, the only ones that emit PA_CHANGE tags.
std::regex m_pa_change_pattern; ///< Regular expression to detect PA_CHANGE pattern.
std::regex m_g1_f_pattern; ///< Regular expression to detect G1 F pattern.
@@ -7,11 +7,30 @@
#include "../Geometry.hpp"
#include "../ClipperUtils.hpp"
#include "../SVG.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/Flow.hpp"
#include "libslic3r/Surface.hpp"
#include "libslic3r/Config.hpp"
#include "AvoidCrossingPerimeters.hpp"
#include <cstddef>
#include <boost/container_hash/hash.hpp>
#include <cassert>
#include <limits>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <math.h>
#include <numeric>
#include <unordered_set>
#include <boost/range/adaptor/reversed.hpp>
#include <vector>
#include <utility>
namespace Slic3r {
@@ -4,6 +4,10 @@
#include "../libslic3r.h"
#include "../ExPolygon.hpp"
#include "../EdgeGrid.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/BoundingBox.hpp"
#include <vector>
namespace Slic3r {
+17
View File
@@ -1,11 +1,28 @@
#include "ConflictChecker.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/ExtrusionEntityCollection.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Layer.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/GCode/GCodeProcessor.hpp"
#include <cstdint>
#include <cstdlib>
#include <cfloat>
#include <cassert>
#include <optional>
#include <cstddef>
#include <algorithm>
#include <tbb/parallel_for.h>
#include <tbb/concurrent_vector.h>
#include <map>
#include <functional>
#include <atomic>
#include <utility>
#include <vector>
namespace Slic3r {
+10
View File
@@ -5,8 +5,18 @@
#include "../Model.hpp"
#include "../Print.hpp"
#include "../Layer.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/ExtrusionEntityCollection.hpp"
#include "libslic3r/GCode/GCodeProcessor.hpp"
#include <queue>
#include <utility>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <optional>
+19 -5
View File
@@ -1,12 +1,27 @@
#include "../GCode.hpp"
#include "../LocalesUtils.hpp"
#include "libslic3r/Extruder.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Circle.hpp"
#include "CoolingBuffer.hpp"
#include <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/log/trivial.hpp>
#include <cstddef>
#include <cstdlib>
#include <cmath>
#include <charconv>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <float.h>
#include <string>
#include <system_error>
#include <unordered_map>
#include <vector>
#include <utility>
#if 0
#define DEBUG
@@ -394,13 +409,13 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
if (*c == 0 || *c == ';')
break;
assert(is_decimal_separator_point()); // for atof
//BBS: Parse the axis.
size_t axis = (*c >= 'X' && *c <= 'Z') ? (*c - 'X') :
(*c == 'E') ? 3 : (*c == 'F') ? 4 :
(*c == 'I') ? 5 : (*c == 'J') ? 6 : size_t(-1);
if (axis != size_t(-1)) {
new_pos[axis] = float(atof(++c));
++ c;
new_pos[axis] = float(atof_decimal_point(std::string_view(c, sline.data() + sline.size() - c)));
if (axis == 4) {
// Convert mm/min to mm/sec.
new_pos[4] /= 60.f;
@@ -536,10 +551,9 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
line.type = CoolingLine::TYPE_G4;
size_t pos_S = sline.find('S', 3);
size_t pos_P = sline.find('P', 3);
assert(is_decimal_separator_point()); // for atof
line.time = line.time_max = float(
(pos_S > 0) ? atof(sline.c_str() + pos_S + 1) :
(pos_P > 0) ? atof(sline.c_str() + pos_P + 1) * 0.001 : 0.);
(pos_S > 0) ? atof_decimal_point(sline.c_str() + pos_S + 1) :
(pos_P > 0) ? atof_decimal_point(sline.c_str() + pos_P + 1) * 0.001 : 0.);
} else if (boost::starts_with(sline, ";_FORCE_RESUME_FAN_SPEED")) {
line.type = CoolingLine::TYPE_FORCE_RESUME_FAN;
}
+4
View File
@@ -2,14 +2,18 @@
#define slic3r_CoolingBuffer_hpp_
#include "../libslic3r.h"
#include "../Point.hpp"
#include <cstddef>
#include <map>
#include <string>
#include <cfloat>
#include <vector>
namespace Slic3r {
class GCode;
class Layer;
class PrintConfig;
struct PerExtruderAdjustments;
// A standalone G-code filter, to control cooling of the print.
@@ -1,10 +1,13 @@
#include "GCodeProcessor.hpp"
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/libslic3r.h"
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstddef>
#include <math.h>
#include <string_view>
namespace Slic3r {
+131 -22
View File
@@ -15,12 +15,16 @@
#include "../ClipperUtils.hpp"
#include "../Flow.hpp"
#include "../Config.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/ExPolygon.hpp"
#include <Eigen/Core>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <functional>
#include <limits>
#include <memory>
#include <numeric>
#include <unordered_map>
#include <utility>
@@ -35,7 +39,14 @@ template<int Dim> struct ExtendedPoint
float curvature;
};
template<bool SCALED_INPUT, bool ADD_INTERSECTIONS, bool PREV_LAYER_BOUNDARY_OFFSET, bool SIGNED_DISTANCE, typename POINTS, typename L>
// A KNOWN_DISTANCES functor that knows no distances, so every input point is queried.
struct NoKnownDistances
{
template<typename P> const double *operator()(const P &) const { return nullptr; }
};
template<bool SCALED_INPUT, bool ADD_INTERSECTIONS, bool PREV_LAYER_BOUNDARY_OFFSET, bool SIGNED_DISTANCE, bool CURVATURE = true,
typename POINTS, typename L, typename KNOWN_DISTANCES = NoKnownDistances>
std::vector<ExtendedPoint<L::Dim>> estimate_points_properties(const POINTS& input_points,
const AABBTreeLines::LinesDistancer<L>& unscaled_prev_layer,
float flow_width,
@@ -46,7 +57,9 @@ std::vector<ExtendedPoint<L::Dim>> estimate_points_properties(const POINTS&
const std::function<float(float)>& distance_to_speed = {},
// Overlap (1 - distance / flow_width) at or below which the overhang
// fan switches on; negative when the fan does not depend on overlap.
float fan_overlap_threshold = -1.0f)
float fan_overlap_threshold = -1.0f,
// Returns an input point's signed distance if already known, else nullptr.
const KNOWN_DISTANCES& known_distance = KNOWN_DISTANCES{})
{
bool looped = input_points.front() == input_points.back();
std::function<size_t(size_t,size_t)> get_prev_index = [](size_t idx, size_t count) {
@@ -91,21 +104,26 @@ std::vector<ExtendedPoint<L::Dim>> estimate_points_properties(const POINTS&
float boundary_offset = PREV_LAYER_BOUNDARY_OFFSET ? 0.5 * flow_width : 0.0f;
auto maybe_unscale = [](const P& p) -> Vec { return SCALED_INPUT ? unscaled(p) : p.template cast<double>(); };
using Distance = typename AABBTreeLines::LinesDistancer<L>::Floating;
auto input_distance = [&unscaled_prev_layer, &known_distance](const P &input, const Vec &position) -> Distance {
if (const double *known = known_distance(input))
return Distance(*known);
auto [distance, nearest_line, x] = unscaled_prev_layer.template distance_from_lines_extra<SIGNED_DISTANCE>(
position.template cast<AABBScalar>());
return distance;
};
std::vector<ExtendedPoint<L::Dim>> points;
points.reserve(input_points.size() * (ADD_INTERSECTIONS ? 1.5 : 1));
{
ExtendedPoint<L::Dim> start_point{maybe_unscale(input_points.front())};
auto [distance, nearest_line, x] = unscaled_prev_layer.template distance_from_lines_extra<SIGNED_DISTANCE>(
start_point.position.template cast<AABBScalar>());
start_point.distance = distance + boundary_offset;
start_point.distance = input_distance(input_points.front(), start_point.position) + boundary_offset;
points.push_back(start_point);
}
for (size_t i = 1; i < input_points.size(); i++) {
ExtendedPoint<L::Dim> next_point{maybe_unscale(input_points[i])};
auto [distance, nearest_line,
x] = unscaled_prev_layer.template distance_from_lines_extra<SIGNED_DISTANCE>(next_point.position.template cast<AABBScalar>());
next_point.distance = distance + boundary_offset;
next_point.distance = input_distance(input_points[i], next_point.position) + boundary_offset;
// Intersection handling
if (ADD_INTERSECTIONS &&
@@ -346,6 +364,9 @@ std::vector<ExtendedPoint<L::Dim>> estimate_points_properties(const POINTS&
points = std::move(new_points);
}
if constexpr (!CURVATURE)
return points;
// Curvature calculation
float accumulated_distance = 0;
std::vector<float> distances_for_curvature(points.size());
@@ -414,6 +435,49 @@ std::vector<ExtendedPoint<L::Dim>> estimate_points_properties(const POINTS&
return points;
}
struct Point3Hash
{
size_t operator()(const Vec3crd &pt) const noexcept { return size_t(((89 * 31 + int64_t(pt.x())) * 31 + pt.y()) * 31 + pt.z()); }
};
// The trees of the layer below an object layer, and the signed distances from the layer's perimeter and bridge
// vertices to that layer's outline, computed for ExtrusionQualityEstimator ahead of the G-code generator.
struct PrecomputedOverhangLayer
{
const PrintObject *object{nullptr};
const Layer *layer{nullptr};
std::shared_ptr<const AABBTreeLines::LinesDistancer<Linef3>> lower_boundaries;
std::shared_ptr<const AABBTreeLines::LinesDistancer<CurledLine>> lower_curled_lines;
std::unordered_map<Point3, double, Point3Hash> distances;
};
// `layer` must have a layer below it; leave out `curled_lines` only when no region of `layer` slows down for curled
// perimeters.
inline PrecomputedOverhangLayer precompute_overhang_layer(const PrintObject *object, const Layer &layer, bool curled_lines = true)
{
PrecomputedOverhangLayer out{object, &layer,
std::make_shared<const AABBTreeLines::LinesDistancer<Linef3>>(to_unscaled_linesf3(layer.lower_layer->lslices)),
curled_lines ? std::make_shared<const AABBTreeLines::LinesDistancer<CurledLine>>(layer.lower_layer->curled_lines) :
nullptr,
{}};
const AABBTreeLines::LinesDistancer<Linef3> &lower = *out.lower_boundaries;
auto add_path = [&out, &lower](const ExtrusionPath &path) {
if (!is_bridge(path.role()) && !is_perimeter(path.role()))
return;
for (const Point3 &point : path.polyline.points)
if (auto [it, inserted] = out.distances.try_emplace(point, 0.); inserted) {
const Eigen::Matrix<double, 3, 1, Eigen::DontAlign> position = unscaled(point);
auto [distance, nearest_line, x] = lower.distance_from_lines_extra<true>(position.cast<double>());
it->second = distance;
}
};
for (const LayerRegion *region : layer.regions()) {
for_each_extrusion_path(region->perimeters, add_path);
for_each_extrusion_path(region->fills, add_path);
}
return out;
}
struct ProcessedPoint
{
Point3 p;
@@ -423,23 +487,53 @@ struct ProcessedPoint
class ExtrusionQualityEstimator
{
std::unordered_map<const PrintObject*, AABBTreeLines::LinesDistancer<Linef3>> prev_layer_boundaries;
std::unordered_map<const PrintObject*, AABBTreeLines::LinesDistancer<Linef3>> next_layer_boundaries;
std::unordered_map<const PrintObject *, AABBTreeLines::LinesDistancer<CurledLine>> prev_curled_extrusions;
std::unordered_map<const PrintObject *, AABBTreeLines::LinesDistancer<CurledLine>> next_curled_extrusions;
const PrintObject *current_object;
using Boundaries = AABBTreeLines::LinesDistancer<Linef3>;
using CurledLines = AABBTreeLines::LinesDistancer<CurledLine>;
std::unordered_map<const PrintObject*, std::shared_ptr<const Boundaries>> prev_layer_boundaries;
std::unordered_map<const PrintObject*, std::shared_ptr<const CurledLines>> prev_curled_extrusions;
// The layers the trees above are built from, and the layers prepared last.
std::unordered_map<const PrintObject*, const Layer*> prev_layer_sources;
std::unordered_map<const PrintObject*, const Layer*> last_prepared_layers;
std::vector<PrecomputedOverhangLayer> precomputed_layers;
const PrintObject *current_object;
const PrecomputedOverhangLayer *precomputed_for(const PrintObject *object) const
{
auto it = std::find_if(precomputed_layers.begin(), precomputed_layers.end(),
[object](const PrecomputedOverhangLayer &layer) { return layer.object == object; });
return it == precomputed_layers.end() ? nullptr : &*it;
}
template<typename T> static const T &or_empty(const std::shared_ptr<const T> &tree)
{
static const T empty;
return tree ? *tree : empty;
}
public:
void set_current_object(const PrintObject *object) { current_object = object; }
// Takes the data computed ahead for the layer about to be generated, replacing the previous layer's.
void set_precomputed_layers(std::vector<PrecomputedOverhangLayer> &&layers) { precomputed_layers = std::move(layers); }
// Measures the layer against the layer prepared before it.
void prepare_for_new_layer(const PrintObject * obj, const Layer *layer)
{
if (layer == nullptr) return;
const PrintObject *object = obj;
prev_layer_boundaries[object] = next_layer_boundaries[object];
next_layer_boundaries[object] = AABBTreeLines::LinesDistancer<Linef3>{to_unscaled_linesf3(layer->lslices)};
prev_curled_extrusions[object] = next_curled_extrusions[object];
next_curled_extrusions[object] = AABBTreeLines::LinesDistancer<CurledLine>{layer->curled_lines};
const Layer *prev = std::exchange(last_prepared_layers[object], layer);
prev_layer_sources[object] = prev;
const PrecomputedOverhangLayer *precomputed = precomputed_for(object);
if (prev == nullptr) {
prev_layer_boundaries[object] = nullptr;
prev_curled_extrusions[object] = nullptr;
} else if (precomputed != nullptr && precomputed->layer == layer && layer->lower_layer == prev) {
prev_layer_boundaries[object] = precomputed->lower_boundaries;
prev_curled_extrusions[object] = precomputed->lower_curled_lines;
} else {
prev_layer_boundaries[object] = std::make_shared<const Boundaries>(to_unscaled_linesf3(prev->lslices));
prev_curled_extrusions[object] = std::make_shared<const CurledLines>(prev->curled_lines);
}
}
std::vector<ProcessedPoint> estimate_extrusion_quality(const ExtrusionPath &path,
@@ -523,9 +617,24 @@ public:
return std::min(calculate_speed(distance), original_speed);
};
// Precomputed distances hold only if they were measured against the layer prev_layer_boundaries is built from.
const std::unordered_map<Point3, double, Point3Hash> *known = nullptr;
if (const PrecomputedOverhangLayer *precomputed = precomputed_for(current_object);
precomputed != nullptr && precomputed->layer->lower_layer == prev_layer_sources[current_object])
known = &precomputed->distances;
const Boundaries &prev_boundaries = or_empty(prev_layer_boundaries[current_object]);
const CurledLines &prev_curled = or_empty(prev_curled_extrusions[current_object]);
auto known_distance = [known](const Point3 &point) -> const double * {
if (known == nullptr)
return nullptr;
auto it = known->find(point);
return it == known->end() ? nullptr : &it->second;
};
std::vector<ExtendedPoint<3>> extended_points =
estimate_points_properties<true, true, true, true>(path.polyline.points, prev_layer_boundaries[current_object], path.width, -1,
smallest_distance_with_lower_speed, effective_speed, fan_overlap_threshold);
estimate_points_properties<true, true, true, true, false>(path.polyline.points, prev_boundaries, path.width, -1,
smallest_distance_with_lower_speed, effective_speed, fan_overlap_threshold,
known_distance);
const auto width_inv = 1.0f / path.width;
std::vector<ProcessedPoint> processed_points;
processed_points.reserve(extended_points.size());
@@ -539,7 +648,7 @@ public:
const double dist_limit = 10.0 * path.width;
{
Vec3d middle = 0.5 * (curr.position + next.position);
auto line_indices = prev_curled_extrusions[current_object].all_lines_in_radius(Point::new_scale(middle),
auto line_indices = prev_curled.all_lines_in_radius(Point::new_scale(middle),
scale_(dist_limit));
if (!line_indices.empty()) {
double len = (next.position - curr.position).norm();
@@ -560,7 +669,7 @@ public:
double projected_lengths_sum = 0;
for (size_t idx : line_indices) {
const CurledLine& line = prev_curled_extrusions[current_object].get_line(idx);
const CurledLine& line = prev_curled.get_line(idx);
Lines inside = intersection_ln({{line.a, line.b}}, {box_of_influence});
if (inside.empty())
continue;
@@ -573,7 +682,7 @@ public:
}
for (size_t idx : line_indices) {
const CurledLine &line = prev_curled_extrusions[current_object].get_line(idx);
const CurledLine &line = prev_curled.get_line(idx);
float distance_from_curled = unscaled(line_alg::distance_to(line, Point::new_scale(middle)));
float dist = path.width * (1.0 - (distance_from_curled / dist_limit)) *
(1.0 - (distance_from_curled / dist_limit)) *
+19
View File
@@ -1,10 +1,25 @@
#include "FanMover.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/ExtrusionEntity.hpp"
#include "GCodeReader.hpp"
#include <cstddef>
#include <cerrno>
#include <cstdlib>
#include <algorithm>
#include <cstdint>
#include <cmath>
#include <cassert>
#include <cctype>
#include <iomanip>
/*
#include <ios>
#include <list>
#include <iterator>
#include <memory.h>
#include <sstream>
#include <string.h>
#include <float.h>
@@ -12,8 +27,12 @@
#include "../PrintConfig.hpp"
#include "../Utils.hpp"
#include "Print.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/libslic3r.h"
#include <boost/log/trivial.hpp>
#include <string>
#include <string_view>
*/
+5
View File
@@ -9,7 +9,12 @@
#include "../Point.hpp"
#include "../GCodeReader.hpp"
#include "../GCodeWriter.hpp"
#include <cstdint>
#include <list>
#include <algorithm>
#include <regex>
#include <string>
#include <string_view>
namespace Slic3r {
+105 -42
View File
@@ -1,14 +1,30 @@
#include "libslic3r/Config.hpp"
#include "libslic3r/CustomGCode.hpp"
#include "libslic3r/Exception.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/CommonDefs.hpp"
#include "libslic3r/ArcFitter.hpp"
#include "ExtrusionEntity.hpp"
#include "libslic3r/GCodeReader.hpp"
#include "GCodeWriter.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/PrintBase.hpp"
#include "libslic3r/Polygon.hpp"
#include "PrintConfig.hpp"
#include "libslic3r/TriangleSelector.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/LocalesUtils.hpp"
#include "libslic3r/format.hpp"
#include "libslic3r_version.h"
#include "GCodeProcessor.hpp"
#include <algorithm>
#include <array>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/constants.hpp>
#include <boost/log/trivial.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/split.hpp>
@@ -16,15 +32,38 @@
#include <boost/nowide/cstdio.hpp>
#include <boost/filesystem/path.hpp>
#include <cstddef>
#include <cmath>
#include <exception>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <climits>
#include <fast_float/fast_float.h>
#include <float.h>
#include <assert.h>
#include <memory>
#include <optional>
#include <iterator>
#include <functional>
#include <math.h>
#include <map>
#include <limits>
#include <fstream>
#include <regex>
#include <set>
#include <sstream>
#include <charconv>
#include <string>
#include <string_view>
#include <system_error>
#include <vector>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#if __has_include(<charconv>)
#include <charconv>
@@ -870,8 +909,8 @@ public:
{
// Orca: find start pos by seaching G28/G29/PRINT_START/START_PRINT commands
auto is_start_pos = [](const std::string& curr_cmd) {
return boost::iequals(curr_cmd, "G28") || boost::iequals(curr_cmd, "G29") || boost::iequals(curr_cmd, "PRINT_START") ||
boost::iequals(curr_cmd, "START_PRINT");
return ascii_iequals(curr_cmd, "G28") || ascii_iequals(curr_cmd, "G29") || ascii_iequals(curr_cmd, "PRINT_START") ||
ascii_iequals(curr_cmd, "START_PRINT");
};
assert(!m_lines.empty());
const float time_step = backtrace.time_step();
@@ -1226,6 +1265,9 @@ void GCodeProcessor::run_post_process()
// Process inline placeholders (print_time_total_sec, print_time_day, print_time_hour, print_time_minute, print_time_sec and used_filament_length)
auto process_inline_placeholders = [&](std::string& gcode_line) {
bool processed = false;
// Every inline placeholder contains '@', so a line without one has nothing to replace.
if (gcode_line.find('@') == std::string::npos)
return processed;
const std::string& print_time_total_placeholder = reserved_tag(ETags::Print_Time_Total_Sec_Placeholder);
const std::string& print_time_day_placeholder = reserved_tag(ETags::Print_Time_Day_Placeholder);
@@ -3968,13 +4010,13 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool
const std::string_view cmd = line.cmd();
if (m_flavor == gcfKlipper)
{
if (boost::iequals(cmd, "SET_VELOCITY_LIMIT"))
if (ascii_iequals(cmd, "SET_VELOCITY_LIMIT"))
{
process_SET_VELOCITY_LIMIT(line);
return;
}
// ORCA: Add Pressure Advance visualization support
if (boost::iequals(cmd, "SET_PRESSURE_ADVANCE"))
if (ascii_iequals(cmd, "SET_PRESSURE_ADVANCE"))
{
process_SET_PRESSURE_ADVANCE(line);
return;
@@ -7512,51 +7554,72 @@ void GCodeProcessor::calculate_time(GCodeProcessorResult& result, size_t keep_la
actual_speed_moves = std::move(machine.actual_speed_moves);
}
// insert actual speed moves into the move list
unsigned int inserted_actual_speed_moves_count = 0;
std::vector<GCodeProcessorResult::MoveVertex> new_moves;
std::map<unsigned int, unsigned int> id_map;
for (auto it = actual_speed_moves.begin(); it != actual_speed_moves.end(); ++it) {
const unsigned int base_id = it->move_id + inserted_actual_speed_moves_count;
if (it->position.has_value()) {
// insert actual speed move into the move list
// clone from existing move
GCodeProcessorResult::MoveVertex new_move = result.moves[base_id];
// override modified parameters
new_move.time = { 0.0f, 0.0f };
new_move.position = *it->position;
new_move.actual_feedrate = it->actual_feedrate;
new_move.delta_extruder = *it->delta_extruder;
new_move.feedrate = *it->feedrate;
new_move.width = *it->width;
new_move.height = *it->height;
new_move.mm3_per_mm = *it->mm3_per_mm;
new_move.fan_speed = *it->fan_speed;
new_move.temperature = *it->temperature;
new_move.internal_only = true;
new_moves.push_back(new_move);
// actual_speed_moves holds, per block in move order, the moves to insert before the block's move and then an
// entry without a position for that move; positioned entries after the last such entry are dropped.
std::vector<GCodeProcessorResult::MoveVertex>& moves = result.moves;
size_t inserted_actual_speed_moves_count = 0;
size_t kept = 0;
size_t group_start = 0;
for (size_t i = 0; i < actual_speed_moves.size(); ++i) {
if (actual_speed_moves[i].position.has_value())
continue;
const unsigned int move_id = actual_speed_moves[i].move_id;
// A VG1 block has no move of its own, so its id can fall behind the previous block's or point past the list.
if (move_id < moves.size() && (kept == 0 || move_id > actual_speed_moves[kept - 1].move_id)) {
inserted_actual_speed_moves_count += i - group_start;
moves[move_id].actual_feedrate = actual_speed_moves[i].actual_feedrate;
// A seam vertex right after a block's move shares its actual speed.
if (move_id + 1 < moves.size() && moves[move_id + 1].type == EMoveType::Seam)
moves[move_id + 1].actual_feedrate = actual_speed_moves[i].actual_feedrate;
for (size_t j = group_start; j <= i; ++j, ++kept)
if (kept != j)
actual_speed_moves[kept] = std::move(actual_speed_moves[j]);
}
else {
result.moves.insert(result.moves.begin() + base_id, new_moves.begin(), new_moves.end());
id_map[it->move_id] = base_id + new_moves.size();
// update move actual speed
result.moves[base_id + new_moves.size()].actual_feedrate = it->actual_feedrate;
inserted_actual_speed_moves_count += new_moves.size();
// synchronize seams actual speed
if (base_id + new_moves.size() + 1 < result.moves.size()) {
GCodeProcessorResult::MoveVertex& move = result.moves[base_id + new_moves.size() + 1];
if (move.type == EMoveType::Seam)
move.actual_feedrate = it->actual_feedrate;
}
new_moves.clear();
group_start = i + 1;
}
actual_speed_moves.erase(actual_speed_moves.begin() + kept, actual_speed_moves.end());
// Walks the blocks back to front, so each shifted move is moved once, into its final slot.
size_t read = moves.size(); // one past the last move not yet placed
moves.resize(moves.size() + inserted_actual_speed_moves_count);
size_t write = moves.size(); // one past the last free slot
m_actual_speed_id_map.clear();
size_t entry = actual_speed_moves.size();
while (entry > 0) {
const unsigned int block_id = actual_speed_moves[--entry].move_id;
assert(block_id < read);
while (read > block_id + 1)
moves[--write] = moves[--read];
const GCodeProcessorResult::MoveVertex block_move = moves[--read];
moves[--write] = block_move;
m_actual_speed_id_map.emplace_back(block_id, (unsigned int)write);
for (; entry > 0 && actual_speed_moves[entry - 1].position.has_value(); --entry) {
const TimeMachine::ActualSpeedMove& it = actual_speed_moves[entry - 1];
GCodeProcessorResult::MoveVertex new_move = block_move;
new_move.time = { 0.0f, 0.0f };
new_move.position = *it.position;
new_move.actual_feedrate = it.actual_feedrate;
new_move.delta_extruder = *it.delta_extruder;
new_move.feedrate = *it.feedrate;
new_move.width = *it.width;
new_move.height = *it.height;
new_move.mm3_per_mm = *it.mm3_per_mm;
new_move.fan_speed = *it.fan_speed;
new_move.temperature = *it.temperature;
new_move.internal_only = true;
moves[--write] = new_move;
}
}
assert(read == write);
// synchronize blocks' move_ids with after moves for actual speed insertion
std::reverse(m_actual_speed_id_map.begin(), m_actual_speed_id_map.end());
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
for (GCodeProcessor::TimeBlock& block : m_time_processor.machines[i].blocks) {
auto it = id_map.find(block.move_id);
block.move_id = (it != id_map.end()) ? it->second : block.move_id + inserted_actual_speed_moves_count;
auto it = std::lower_bound(m_actual_speed_id_map.begin(), m_actual_speed_id_map.end(), block.move_id,
[](const std::pair<unsigned int, unsigned int>& entry, unsigned int id) { return entry.first < id; });
block.move_id = (it != m_actual_speed_id_map.end() && it->first == block.move_id) ?
it->second : block.move_id + (unsigned int)inserted_actual_speed_moves_count;
}
}
}
+61 -41
View File
@@ -1,6 +1,11 @@
#ifndef slic3r_GCodeProcessor_hpp_
#define slic3r_GCodeProcessor_hpp_
#include "libslic3r/CommonDefs.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/ArcFitter.hpp"
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
@@ -8,8 +13,17 @@
#include "libslic3r/CustomGCode.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include <cstddef>
#include <cassert>
#include <cstdint>
#include <array>
#include <unordered_map>
#include <utility>
#include <map>
#include <memory>
#include <functional>
#include <cstdlib>
#include <set>
#include <vector>
#include <mutex>
#include <string>
@@ -323,54 +337,57 @@ class Print;
//BBS: add mutex for protection of gcode result
mutable std::mutex result_mutex;
GCodeProcessorResult& operator=(const GCodeProcessorResult &other)
GCodeProcessorResult& operator=(const GCodeProcessorResult &other) { assign(other); return *this; }
// Declared because the user-declared copy assignment suppresses the implicit move.
GCodeProcessorResult& operator=(GCodeProcessorResult &&other) { assign(std::move(other)); return *this; }
// Add a new member here, or neither assignment transfers it.
template<class Other> void assign(Other &&other)
{
filename = other.filename;
id = other.id;
moves = other.moves;
lines_ends = other.lines_ends;
printable_area = other.printable_area;
bed_exclude_area = other.bed_exclude_area;
wrapping_exclude_area = other.wrapping_exclude_area;
toolpath_outside = other.toolpath_outside;
label_object_enabled = other.label_object_enabled;
long_retraction_when_cut = other.long_retraction_when_cut;
timelapse_warning_code = other.timelapse_warning_code;
printable_height = other.printable_height;
settings_ids = other.settings_ids;
filaments_count = other.filaments_count;
extruder_colors = other.extruder_colors;
filament_diameters = other.filament_diameters;
filament_densities = other.filament_densities;
filament_costs = other.filament_costs;
print_statistics = other.print_statistics;
custom_gcode_per_print_z = other.custom_gcode_per_print_z;
spiral_vase_mode = other.spiral_vase_mode;
warnings = other.warnings;
bed_type = other.bed_type;
gcode_check_result = other.gcode_check_result;
limit_filament_maps = other.limit_filament_maps;
filament_printable_reuslt = other.filament_printable_reuslt;
filename = std::forward<Other>(other).filename;
id = std::forward<Other>(other).id;
moves = std::forward<Other>(other).moves;
lines_ends = std::forward<Other>(other).lines_ends;
printable_area = std::forward<Other>(other).printable_area;
bed_exclude_area = std::forward<Other>(other).bed_exclude_area;
wrapping_exclude_area = std::forward<Other>(other).wrapping_exclude_area;
toolpath_outside = std::forward<Other>(other).toolpath_outside;
label_object_enabled = std::forward<Other>(other).label_object_enabled;
long_retraction_when_cut = std::forward<Other>(other).long_retraction_when_cut;
timelapse_warning_code = std::forward<Other>(other).timelapse_warning_code;
printable_height = std::forward<Other>(other).printable_height;
settings_ids = std::forward<Other>(other).settings_ids;
filaments_count = std::forward<Other>(other).filaments_count;
extruder_colors = std::forward<Other>(other).extruder_colors;
filament_diameters = std::forward<Other>(other).filament_diameters;
filament_densities = std::forward<Other>(other).filament_densities;
filament_costs = std::forward<Other>(other).filament_costs;
print_statistics = std::forward<Other>(other).print_statistics;
custom_gcode_per_print_z = std::forward<Other>(other).custom_gcode_per_print_z;
spiral_vase_mode = std::forward<Other>(other).spiral_vase_mode;
warnings = std::forward<Other>(other).warnings;
bed_type = std::forward<Other>(other).bed_type;
gcode_check_result = std::forward<Other>(other).gcode_check_result;
limit_filament_maps = std::forward<Other>(other).limit_filament_maps;
filament_printable_reuslt = std::forward<Other>(other).filament_printable_reuslt;
// Orca: copy the shared grouping result so a copied result keeps it (shared_ptr =>
// memory-safe), rather than leaving a stale pointer on the target. No g-code effect either way.
nozzle_group_result = other.nozzle_group_result;
nozzle_group_result = std::forward<Other>(other).nozzle_group_result;
// Keep the per-extruder hotend types on a copied result (injector input).
extruder_types = other.extruder_types;
printer_extruder_variant = other.printer_extruder_variant;
printer_extruder_id = other.printer_extruder_id;
layer_filaments = other.layer_filaments;
filament_change_sequence = other.filament_change_sequence;
used_mixed_filaments = other.used_mixed_filaments;
nozzle_change_sequence = other.nozzle_change_sequence;
optimal_assignment = other.optimal_assignment;
filament_change_count_map = other.filament_change_count_map;
extruder_types = std::forward<Other>(other).extruder_types;
printer_extruder_variant = std::forward<Other>(other).printer_extruder_variant;
printer_extruder_id = std::forward<Other>(other).printer_extruder_id;
layer_filaments = std::forward<Other>(other).layer_filaments;
filament_change_sequence = std::forward<Other>(other).filament_change_sequence;
used_mixed_filaments = std::forward<Other>(other).used_mixed_filaments;
nozzle_change_sequence = std::forward<Other>(other).nozzle_change_sequence;
optimal_assignment = std::forward<Other>(other).optimal_assignment;
filament_change_count_map = std::forward<Other>(other).filament_change_count_map;
// Keep the SKIPPABLE per-type time on a copied result.
skippable_part_time = other.skippable_part_time;
initial_layer_time = other.initial_layer_time;
skippable_part_time = std::forward<Other>(other).skippable_part_time;
initial_layer_time = std::forward<Other>(other).initial_layer_time;
#if ENABLE_GCODE_VIEWER_STATISTICS
time = other.time;
time = std::forward<Other>(other).time;
#endif
return *this;
}
void lock() const { result_mutex.lock(); }
void unlock() const { result_mutex.unlock(); }
@@ -1202,6 +1219,9 @@ class Print;
EProducer m_producer;
TimeProcessor m_time_processor;
// calculate_time()'s map from each block's move id to its index after the actual speed moves are inserted,
// a member to reuse its capacity.
std::vector<std::pair<unsigned int, unsigned int>> m_actual_speed_id_map;
UsedFilaments m_used_filaments;
Print* m_print{ nullptr };
@@ -4,9 +4,14 @@
#include "OrderingStrategies.hpp"
#include "../Geometry.hpp"
#include "../ShortestPath.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <limits>
#include <numeric>
#include <unordered_map>
@@ -5,6 +5,8 @@
#include "../libslic3r.h"
#include "../Point.hpp"
#include <cstddef>
#include "libslic3r/PrintConfig.hpp"
#ifndef SLIC3R_TEST_HARNESS
#include "../Print.hpp"
@@ -4,9 +4,13 @@
// Implementation file for the PchipInterpolatorHelper class
#include "PchipInterpolatorHelper.hpp"
#include <cstddef>
#include <iterator>
#include <stdexcept>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
/**
* @brief Constructs the PCHIP interpolator with given data points.
+14
View File
@@ -1,9 +1,23 @@
#include "PreciseSeam.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "SeamPlacer.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/BoundingBox.hpp"
#include <algorithm>
#include <atomic>
#include <boost/log/trivial.hpp>
#include <optional>
#include <cstddef>
#include <limits>
#include <iterator>
#include <cassert>
#include <cmath>
#include <tbb/parallel_for.h>
#include <vector>
#include <utility>
namespace Slic3r {
namespace PreciseSeam {
+2
View File
@@ -2,9 +2,11 @@
#define slic3r_PreciseSeam_hpp_
#include <atomic>
#include <cstddef>
#include <optional>
#include <vector>
#include <unordered_map>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/Model.hpp"
+11
View File
@@ -1,8 +1,17 @@
#include <cassert>
#include <cstdlib>
#include <boost/algorithm/string/predicate.hpp>
#include <cctype>
#include <cmath>
#include <array>
#include <iostream>
#include <math.h>
#include <limits>
#include <memory.h>
#include <cstring>
#include <cfloat>
#include <algorithm>
#include <string>
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
@@ -10,6 +19,8 @@
#include "../GCode.hpp"
#include "PressureEqualizer.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Exception.hpp"
#include "fast_float/fast_float.h"
#include "GCodeWriter.hpp"
@@ -2,7 +2,14 @@
#define slic3r_GCode_PressureEqualizer_hpp_
#include "../libslic3r.h"
#include "../ExtrusionEntity.hpp"
#include "../PrintConfig.hpp"
#include <string>
#include <cstddef>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <queue>
+9
View File
@@ -10,7 +10,16 @@
#include "../Print.hpp"
#include "PrintExtents.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Exception.hpp"
#include "libslic3r/Geometry.hpp"
#include "WipeTower.hpp"
#include "libslic3r/libslic3r.h"
#include <algorithm>
#include <Eigen/Geometry>
#include <vector>
#include <cstddef>
namespace Slic3r {
@@ -1,6 +1,15 @@
#include "../ClipperUtils.hpp"
#include "../Layer.hpp"
#include "../Polyline.hpp"
#include "libslic3r/Surface.hpp"
#include <vector>
#include "libslic3r/AABBTreeIndirect.hpp"
#include <cstddef>
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/libslic3r.h"
#include <cassert>
#include "libslic3r/Polygon.hpp"
#include "RetractWhenCrossingPerimeters.hpp"
@@ -4,6 +4,7 @@
#include <vector>
#include "../AABBTreeIndirect.hpp"
#include "libslic3r/libslic3r.h"
namespace Slic3r {
+23
View File
@@ -1,15 +1,38 @@
#include "SeamPlacer.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/AABBTreeIndirect.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Flow.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "Polygon.hpp"
#include "libslic3r/PrintBase.hpp"
#include "PrintConfig.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/TriangleSelector.hpp"
#include "tbb/parallel_for.h"
#include "tbb/blocked_range.h"
#include "tbb/parallel_reduce.h"
#include <atomic>
#include <boost/log/trivial.hpp>
#include <cmath>
#include <cstdlib>
#include <cstddef>
#include <igl/Hit.h>
#include <optional>
#include <cassert>
#include <functional>
#include <numeric>
#include <memory>
#include <random>
#include <algorithm>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
#include <utility>
#include "libslic3r/AABBTreeLines.hpp"
#include "libslic3r/KDTreeIndirect.hpp"
+5
View File
@@ -1,12 +1,17 @@
#ifndef libslic3r_SeamPlacer_hpp_
#define libslic3r_SeamPlacer_hpp_
#include <cstddef>
#include <functional>
#include <limits>
#include <optional>
#include <unordered_map>
#include <utility>
#include <vector>
#include <memory>
#include <atomic>
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Polygon.hpp"
@@ -6,16 +6,26 @@
// Based on original work by Alexander Þór licensed under the GPLv3:
// https://github.com/Alexander-T-Moss/Small-Area-Flow-Comp
#include <cmath>
#include <limits>
#include <exception>
#include <math.h>
#include <cstring>
#include <cfloat>
#include <ostream>
#include <memory>
#include <regex>
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
#include "libslic3r/Exception.hpp"
#include "libslic3r/GCode/PchipInterpolatorHelper.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "SmallAreaInfillFlowCompensator.hpp"
#include <boost/log/trivial.hpp>
#include <sstream>
#include <string>
namespace Slic3r {
@@ -6,6 +6,7 @@
#include "../ExtrusionEntity.hpp"
#include "PchipInterpolatorHelper.hpp"
#include <memory>
#include <vector>
namespace Slic3r {
+5
View File
@@ -1,8 +1,13 @@
#include "SpiralVase.hpp"
#include "GCode.hpp"
#include "libslic3r/libslic3r.h"
#include <algorithm>
#include <cstddef>
#include <sstream>
#include <cmath>
#include <limits>
#include <vector>
#include <string>
namespace Slic3r {
+4
View File
@@ -3,6 +3,10 @@
#include "../libslic3r.h"
#include "../GCodeReader.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <cstddef>
#include <string>
#include <vector>
namespace Slic3r {
+1
View File
@@ -1,4 +1,5 @@
#include "ThumbnailData.hpp"
#include <vector>
namespace Slic3r {
+3
View File
@@ -1,7 +1,10 @@
#ifndef slic3r_ThumbnailData_hpp_
#define slic3r_ThumbnailData_hpp_
#include <functional>
#include <string>
#include <vector>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "nlohmann/json.hpp"
+16
View File
@@ -1,11 +1,27 @@
#include "Thumbnails.hpp"
#include "../miniz_extension.hpp"
#include "libslic3r/GCode/ThumbnailData.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/enum_bitmask.hpp"
#include "format.hpp"
#include <boost/algorithm/string/case_conv.hpp>
#include <qoi/qoi.h>
#include <cstdlib>
#include <cstring>
#include <cstddef>
#include <cstdint>
#include <ios>
#include <jpeglib.h>
#include <jerror.h>
#include <miniz.h>
#include <string_view>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <boost/algorithm/string.hpp>
+4
View File
@@ -4,9 +4,13 @@
#include "../Point.hpp"
#include "../PrintConfig.hpp"
#include "../enum_bitmask.hpp"
#include "libslic3r/Config.hpp"
#include "ThumbnailData.hpp"
#include "../enum_bitmask.hpp"
#include <cstddef>
#include <string>
#include <utility>
#include <vector>
#include <memory>
#include <string_view>
@@ -1,6 +1,23 @@
#include "ClipperUtils.hpp"
#include "TimelapsePosPicker.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "Layer.hpp"
#include "libslic3r/Point.hpp"
#include <cstdlib>
#include "libslic3r/PrintConfig.hpp"
#include <optional>
#include <vector>
#include <cstddef>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Polygon.hpp"
#include <utility>
#include <algorithm>
#include "libslic3r/Print.hpp"
#include <cmath>
#include <queue>
#include <limits>
#include "libslic3r/Utils.hpp"
#include "libslic3r/Polyline.hpp"
constexpr int FILTER_THRESHOLD = 5;
constexpr int MAX_CANDIDATE_SIZE = 5;
@@ -1,7 +1,11 @@
#ifndef TIMELAPSE_POS_PICKER_HPP
#define TIMELAPSE_POS_PICKER_HPP
#include <optional>
#include <unordered_map>
#include <vector>
#include "libslic3r/Polygon.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/Print.hpp"
+14
View File
@@ -1,9 +1,23 @@
#include "ToolOrderUtils.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include <queue>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <optional>
#include <memory>
#include <limits>
#include <functional>
#include <boost/multiprecision/fwd.hpp>
#include <iterator>
#include <set>
#include <map>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
#include <vector>
#include <unordered_map>
#include <utility>
#include <unordered_set>
namespace Slic3r
{
+1
View File
@@ -1,6 +1,7 @@
#ifndef TOOL_ORDER_UTILS_HPP
#define TOOL_ORDER_UTILS_HPP
#include <utility>
#include <vector>
#include <optional>
#include <functional>
+17
View File
@@ -1,4 +1,9 @@
#include "libslic3r/Exception.hpp"
#include "libslic3r/CustomGCode.hpp"
#include "libslic3r/Config.hpp"
#include "ExtrusionEntity.hpp"
#include "libslic3r/ObjectID.hpp"
#include "libslic3r/FilamentGroup.hpp"
#include "Print.hpp"
#include "ToolOrdering.hpp"
#include "Layer.hpp"
@@ -9,11 +14,23 @@
#include "MultiNozzleUtils.hpp"
#include "FilamentMixer.hpp"
#include "LocalesUtils.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "Utils.hpp"
#include "format.hpp"
#include "I18N.hpp"
#include <boost/log/trivial.hpp>
#include <vector>
#include <string>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <optional>
#include <functional>
#include <exception>
#include <memory>
#include <tuple>
#include <iostream>
// #define SLIC3R_DEBUG
+8
View File
@@ -5,11 +5,19 @@
#include "../libslic3r.h"
#include <cstdint>
#include <cstddef>
#include <algorithm>
#include <functional>
#include <map>
#include <tuple>
#include <set>
#include <unordered_map>
#include <string>
#include <utility>
#include <boost/container/small_vector.hpp>
#include <vector>
#include "../FilamentGroup.hpp"
#include "../FilamentMixer.hpp"
#include "../MultiNozzleUtils.hpp"
+7
View File
@@ -1,12 +1,19 @@
#include "WipePathHelpers.hpp"
#include "../AABBTreeLines.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <limits>
#include <optional>
#include <tuple>
#include <utility>
namespace Slic3r {
+1
View File
@@ -5,6 +5,7 @@
#include "../ExtrusionEntity.hpp"
#include "../Polyline.hpp"
#include "../Line.hpp"
#include "libslic3r/Point.hpp"
namespace Slic3r {
+23
View File
@@ -1,16 +1,39 @@
#include "WipeTower.hpp"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <limits>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <numeric>
#include <sstream>
#include <iomanip>
#include "libslic3r/Circle.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/ArcFitter.hpp"
#include "GCodeProcessor.hpp"
#include "BoundingBox.hpp"
#include "ClipperUtils.hpp"
#include "libslic3r/Line.hpp"
#include "LocalesUtils.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "Triangulation.hpp"
#include "libslic3r/libslic3r.h"
namespace Slic3r
+7
View File
@@ -2,16 +2,23 @@
#define WipeTower_
#include <cmath>
#include <map>
#include <cstddef>
#include <math.h>
#include <limits>
#include <string>
#include <sstream>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include <unordered_set>
#include <vector>
#include "libslic3r/MultiNozzleUtils.hpp"
namespace Slic3r
{
+22
View File
@@ -1,22 +1,44 @@
// Orca: WipeTower2 for all non bbl printers, support all MMU device and toolchanger.
#include "WipeTower2.hpp"
#include <algorithm>
#include <Eigen/Geometry>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstddef>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <math.h>
#include <limits>
#include <utility>
#include <vector>
#include <numeric>
#include <memory>
#include <sstream>
#include <iomanip>
#include "libslic3r/Circle.hpp"
#include "libslic3r/ArcFitter.hpp"
#include "ClipperUtils.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/GCode/WipeTower.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/Fill/FillBase.hpp"
#include "GCodeProcessor.hpp"
#include "BoundingBox.hpp"
#include "libslic3r/Line.hpp"
#include "LocalesUtils.hpp"
#include "Geometry.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Polyline.hpp"
#include "PrintConfig.hpp"
#include "Surface.hpp"
#include "Fill/FillRectilinear.hpp"
#include "libslic3r/libslic3r.h"
#include <boost/algorithm/string/predicate.hpp>
+4
View File
@@ -4,10 +4,14 @@
#define WipeTower2_
#include <cmath>
#include <cstddef>
#include <limits>
#include <math.h>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
@@ -1,5 +1,6 @@
#include "WipeTowerEstimate.hpp"
#include "libslic3r/Polygon.hpp"
#include "WipeTower.hpp"
#include "WipeTower2.hpp"
#include "../Config.hpp"
@@ -8,7 +9,9 @@
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <set>
#include <vector>
namespace Slic3r {