Merge remote-tracking branch 'upstream/main' into libvgcode
# Conflicts: # src/libslic3r/GCode/GCodeProcessor.cpp # src/libslic3r/GCode/GCodeProcessor.hpp # src/slic3r/CMakeLists.txt # src/slic3r/GUI/GCodeViewer.cpp # src/slic3r/GUI/GCodeViewer.hpp # src/slic3r/GUI/GLCanvas3D.cpp # src/slic3r/GUI/GLCanvas3D.hpp # src/slic3r/GUI/GUI_Preview.cpp
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
// ORCA: post processor below used for Dynamic Pressure advance
|
||||
#include "GCode/AdaptivePAProcessor.hpp"
|
||||
|
||||
#include "GCode/TimelapsePosPicker.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <set>
|
||||
@@ -38,7 +40,7 @@ namespace Slic3r {
|
||||
// Forward declarations.
|
||||
class GCode;
|
||||
|
||||
namespace { struct Item; }
|
||||
namespace CustomGCode{ struct Item; }
|
||||
struct PrintInstance;
|
||||
class ConstPrintObjectPtrsAdaptor;
|
||||
|
||||
@@ -79,12 +81,12 @@ public:
|
||||
const Vec3d plate_origin,
|
||||
const std::vector<WipeTower::ToolChangeResult> &priming,
|
||||
const std::vector<std::vector<WipeTower::ToolChangeResult>> &tool_changes,
|
||||
const WipeTower::ToolChangeResult &final_purge) :
|
||||
const WipeTower::ToolChangeResult &final_purge,
|
||||
const std::vector<unsigned int> &slice_used_filaments) :
|
||||
m_left(/*float(print_config.wipe_tower_x.value)*/ 0.f),
|
||||
m_right(float(/*print_config.wipe_tower_x.value +*/ print_config.prime_tower_width.value)),
|
||||
m_wipe_tower_pos(float(print_config.wipe_tower_x.get_at(plate_idx)), float(print_config.wipe_tower_y.get_at(plate_idx))),
|
||||
m_wipe_tower_rotation(float(print_config.wipe_tower_rotation_angle)),
|
||||
m_extruder_offsets(print_config.extruder_offset.values),
|
||||
m_priming(priming),
|
||||
m_tool_changes(tool_changes),
|
||||
m_final_purge(final_purge),
|
||||
@@ -93,8 +95,16 @@ public:
|
||||
m_plate_origin(plate_origin),
|
||||
m_single_extruder_multi_material(print_config.single_extruder_multi_material),
|
||||
m_enable_timelapse_print(print_config.timelapse_type.value == TimelapseType::tlSmooth),
|
||||
m_is_first_print(true)
|
||||
{}
|
||||
m_enable_wrapping_detection(print_config.enable_wrapping_detection && (print_config.wrapping_exclude_area.values.size() > 2) && (slice_used_filaments.size() <= 1)),
|
||||
m_is_first_print(true),
|
||||
m_print_config(&print_config)
|
||||
{
|
||||
// initialize with the extruder offset of master extruder id
|
||||
m_extruder_offsets.resize(print_config.filament_map.size(), print_config.extruder_offset.get_at(print_config.master_extruder_id.value - 1));
|
||||
const auto& filament_map = print_config.filament_map.values; // 1 based idx
|
||||
for (size_t idx = 0; idx < filament_map.size(); ++idx)
|
||||
m_extruder_offsets[idx] = print_config.extruder_offset.get_at(filament_map[idx] - 1);
|
||||
}
|
||||
|
||||
std::string prime(GCode &gcodegen);
|
||||
void next_layer() { ++ m_layer_idx; m_tool_change_idx = 0; }
|
||||
@@ -107,10 +117,14 @@ public:
|
||||
void set_is_first_print(bool is) { m_is_first_print = is; }
|
||||
|
||||
bool enable_timelapse_print() const { return m_enable_timelapse_print; }
|
||||
void set_wipe_tower_depth(float depth) { m_wipe_tower_depth = depth; }
|
||||
void set_wipe_tower_bbx(const BoundingBoxf & bbx) { m_wipe_tower_bbx = bbx; }
|
||||
void set_rib_offset(const Vec2f &rib_offset) { m_rib_offset = rib_offset; }
|
||||
|
||||
private:
|
||||
WipeTowerIntegration& operator=(const WipeTowerIntegration&);
|
||||
std::string append_tcr(GCode &gcodegen, const WipeTower::ToolChangeResult &tcr, int new_extruder_id, double z = -1.) const;
|
||||
Polyline generate_path_to_wipe_tower(const Point &start_pos, const Point &end_pos, const BoundingBox &avoid_polygon, const BoundingBox &printer_bbx) const;
|
||||
std::string append_tcr2(GCode &gcodegen, const WipeTower::ToolChangeResult &tcr, int new_extruder_id, double z = -1.) const;
|
||||
|
||||
// Postprocesses gcode: rotates and moves G1 extrusions and returns result
|
||||
@@ -120,7 +134,7 @@ private:
|
||||
const float m_right;
|
||||
const Vec2f m_wipe_tower_pos;
|
||||
const float m_wipe_tower_rotation;
|
||||
const std::vector<Vec2d> m_extruder_offsets;
|
||||
std::vector<Vec2d> m_extruder_offsets;
|
||||
|
||||
// Reference to cached values at the Printer class.
|
||||
const std::vector<WipeTower::ToolChangeResult> &m_priming;
|
||||
@@ -135,7 +149,12 @@ private:
|
||||
Vec3d m_plate_origin;
|
||||
bool m_single_extruder_multi_material;
|
||||
bool m_enable_timelapse_print;
|
||||
bool m_enable_wrapping_detection;
|
||||
bool m_is_first_print;
|
||||
const PrintConfig * m_print_config;
|
||||
float m_wipe_tower_depth;
|
||||
BoundingBoxf m_wipe_tower_bbx;
|
||||
Vec2f m_rib_offset{Vec2f(0, 0)};
|
||||
};
|
||||
|
||||
class ColorPrintColors
|
||||
@@ -193,7 +212,7 @@ public:
|
||||
// throws std::runtime_exception on error,
|
||||
// throws CanceledException through print->throw_if_canceled().
|
||||
void do_export(Print* print, const char* path, GCodeProcessorResult* result = nullptr, ThumbnailsGeneratorCallback thumbnail_cb = nullptr);
|
||||
|
||||
void export_layer_filaments(GCodeProcessorResult* result);
|
||||
//BBS: set offset for gcode writer
|
||||
void set_gcode_offset(double x, double y) { m_writer.set_xy_offset(x, y); m_processor.set_xy_offset(x, y);}
|
||||
|
||||
@@ -213,10 +232,13 @@ public:
|
||||
const PlaceholderParser& placeholder_parser() const { return m_placeholder_parser_integration.parser; }
|
||||
// Process a template through the placeholder parser, collect error messages to be reported
|
||||
// inside the generated string and after the G-code export finishes.
|
||||
std::string placeholder_parser_process(const std::string &name, const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override = nullptr);
|
||||
std::string placeholder_parser_process(const std::string &name, const std::string &templ, unsigned int current_filament_id, const DynamicConfig *config_override = nullptr);
|
||||
bool enable_cooling_markers() const { return m_enable_cooling_markers; }
|
||||
std::string extrusion_role_to_string_for_parser(const ExtrusionRole &);
|
||||
|
||||
// Calculate the interpolated value for the current layer between start_value and end_value
|
||||
float interpolate_value_across_layers(float start_value, float end_value) const;
|
||||
|
||||
// For Perl bindings, to be used exclusively by unit tests.
|
||||
unsigned int layer_count() const { return m_layer_count; }
|
||||
void set_layer_count(unsigned int value) { m_layer_count = value; }
|
||||
@@ -228,6 +250,7 @@ public:
|
||||
std::string unretract() { return m_writer.unlift() + m_writer.unretract(); }
|
||||
std::string set_extruder(unsigned int extruder_id, double print_z, bool by_object=false);
|
||||
bool is_BBL_Printer();
|
||||
bool is_QIDI_Printer();
|
||||
|
||||
// SoftFever
|
||||
std::string set_object_info(Print* print);
|
||||
@@ -325,6 +348,8 @@ private:
|
||||
const bool last_layer,
|
||||
// Pairs of PrintObject index and its instance index.
|
||||
const std::vector<const PrintInstance*> *ordering,
|
||||
// idientiy timelapse pos
|
||||
const int most_used_extruder,
|
||||
// If set to size_t(-1), then print all copies of all objects.
|
||||
// Otherwise print a single copy of a single object.
|
||||
const size_t single_object_idx = size_t(-1),
|
||||
@@ -353,6 +378,7 @@ private:
|
||||
|
||||
//BBS
|
||||
void check_placeholder_parser_failed();
|
||||
size_t get_extruder_id(unsigned int filament_id) const;
|
||||
|
||||
void set_last_pos(const Point &pos) { m_last_pos = pos; m_last_pos_defined = true; }
|
||||
bool last_pos_defined() const { return m_last_pos_defined; }
|
||||
@@ -506,6 +532,7 @@ private:
|
||||
Wipe m_wipe;
|
||||
AvoidCrossingPerimeters m_avoid_crossing_perimeters;
|
||||
RetractWhenCrossingPerimeters m_retract_when_crossing_perimeters;
|
||||
TimelapsePosPicker m_timelapse_pos_picker;
|
||||
bool m_enable_loop_clipping;
|
||||
//resonance avoidance
|
||||
bool m_resonance_avoidance;
|
||||
@@ -577,11 +604,18 @@ private:
|
||||
// Index of a last object copy extruded.
|
||||
std::pair<const PrintObject*, Point> m_last_obj_copy;
|
||||
|
||||
// 1 << 0: A1 series cannot supprot traditional timelapse when printing by object (cannot turn on timelapse)
|
||||
// 1 << 1: A1 series cannot supprot traditional timelapse with spiral vase mode (cannot turn on timelapse)
|
||||
// 1 << 2: Timelapse in smooth mode without wipe tower (turn on with prompt)
|
||||
int m_timelapse_warning_code = 0;
|
||||
bool m_support_traditional_timelapse = true;
|
||||
|
||||
bool m_silent_time_estimator_enabled;
|
||||
|
||||
Print *m_print{nullptr};
|
||||
|
||||
std::vector<const PrintObject*> m_printed_objects;
|
||||
|
||||
// Processor
|
||||
GCodeProcessor m_processor;
|
||||
|
||||
@@ -596,12 +630,15 @@ private:
|
||||
int m_start_gcode_filament = -1;
|
||||
|
||||
std::set<unsigned int> m_initial_layer_extruders;
|
||||
std::vector<std::vector<unsigned int>> m_sorted_layer_filaments;
|
||||
// BBS
|
||||
int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const;
|
||||
int get_highest_bed_temperature(const bool is_first_layer,const Print &print) const;
|
||||
|
||||
double calc_max_volumetric_speed(const double layer_height, const double line_width, const std::string co_str);
|
||||
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
||||
bool _needSAFC(const ExtrusionPath &path);
|
||||
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
||||
void print_machine_envelope(GCodeOutputStream& file, Print& print, int extruder_id);
|
||||
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
// On the first printing layer. This flag triggers first layer speeds.
|
||||
|
||||
Reference in New Issue
Block a user