mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-28 19:21:20 -06:00
Merge remote-tracking branch 'origin/master' into tm_colldetection_upgr
This commit is contained in:
commit
30477c710c
32 changed files with 563 additions and 276 deletions
|
|
@ -71,8 +71,8 @@ add_library(libslic3r STATIC
|
|||
GCode/CoolingBuffer.hpp
|
||||
GCode/PostProcessor.cpp
|
||||
GCode/PostProcessor.hpp
|
||||
GCode/PressureEqualizer.cpp
|
||||
GCode/PressureEqualizer.hpp
|
||||
# GCode/PressureEqualizer.cpp
|
||||
# GCode/PressureEqualizer.hpp
|
||||
GCode/PreviewData.cpp
|
||||
GCode/PreviewData.hpp
|
||||
GCode/PrintExtents.cpp
|
||||
|
|
|
|||
|
|
@ -662,10 +662,14 @@ void GCode::_do_export(Print &print, FILE *file)
|
|||
m_cooling_buffer = make_unique<CoolingBuffer>(*this);
|
||||
if (print.config().spiral_vase.value)
|
||||
m_spiral_vase = make_unique<SpiralVase>(print.config());
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
if (print.config().max_volumetric_extrusion_rate_slope_positive.value > 0 ||
|
||||
print.config().max_volumetric_extrusion_rate_slope_negative.value > 0)
|
||||
m_pressure_equalizer = make_unique<PressureEqualizer>(&print.config());
|
||||
m_enable_extrusion_role_markers = (bool)m_pressure_equalizer;
|
||||
#else /* HAS_PRESSURE_EQUALIZER */
|
||||
m_enable_extrusion_role_markers = false;
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
|
||||
// Write information on the generator.
|
||||
_write_format(file, "; %s\n\n", Slic3r::header_slic3r_generated().c_str());
|
||||
|
|
@ -860,7 +864,7 @@ void GCode::_do_export(Print &print, FILE *file)
|
|||
if (! (has_wipe_tower && print.config().single_extruder_multi_material_priming)) {
|
||||
// Set initial extruder only after custom start G-code.
|
||||
// Ugly hack: Do not set the initial extruder if the extruder is primed using the MMU priming towers at the edge of the print bed.
|
||||
_write(file, this->set_extruder(initial_extruder_id));
|
||||
_write(file, this->set_extruder(initial_extruder_id, 0.));
|
||||
}
|
||||
|
||||
// Do all objects for each layer.
|
||||
|
|
@ -918,8 +922,10 @@ void GCode::_do_export(Print &print, FILE *file)
|
|||
this->process_layer(file, print, lrs, tool_ordering.tools_for_layer(ltp.print_z()), © - object.copies().data());
|
||||
print.throw_if_canceled();
|
||||
}
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
if (m_pressure_equalizer)
|
||||
_write(file, m_pressure_equalizer->process("", true));
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
++ finished_objects;
|
||||
// Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed.
|
||||
// Reset it when starting another object from 1st layer.
|
||||
|
|
@ -974,8 +980,10 @@ void GCode::_do_export(Print &print, FILE *file)
|
|||
this->process_layer(file, print, layer.second, layer_tools, size_t(-1));
|
||||
print.throw_if_canceled();
|
||||
}
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
if (m_pressure_equalizer)
|
||||
_write(file, m_pressure_equalizer->process("", true));
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
if (m_wipe_tower)
|
||||
// Purge the extruder, pull out the active filament.
|
||||
_write(file, m_wipe_tower->finalize(*this));
|
||||
|
|
@ -1533,15 +1541,13 @@ void GCode::process_layer(
|
|||
}
|
||||
} // for objects
|
||||
|
||||
|
||||
|
||||
// Extrude the skirt, brim, support, perimeters, infill ordered by the extruders.
|
||||
std::vector<std::unique_ptr<EdgeGrid::Grid>> lower_layer_edge_grids(layers.size());
|
||||
for (unsigned int extruder_id : layer_tools.extruders)
|
||||
{
|
||||
gcode += (layer_tools.has_wipe_tower && m_wipe_tower) ?
|
||||
m_wipe_tower->tool_change(*this, extruder_id, extruder_id == layer_tools.extruders.back()) :
|
||||
this->set_extruder(extruder_id);
|
||||
this->set_extruder(extruder_id, print_z);
|
||||
|
||||
// let analyzer tag generator aware of a role type change
|
||||
if (m_enable_analyzer && layer_tools.has_wipe_tower && m_wipe_tower)
|
||||
|
|
@ -1658,11 +1664,13 @@ void GCode::process_layer(
|
|||
if (m_cooling_buffer)
|
||||
gcode = m_cooling_buffer->process_layer(gcode, layer.id());
|
||||
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
// Apply pressure equalization if enabled;
|
||||
// printf("G-code before filter:\n%s\n", gcode.c_str());
|
||||
if (m_pressure_equalizer)
|
||||
gcode = m_pressure_equalizer->process(gcode.c_str(), false);
|
||||
// printf("G-code after filter:\n%s\n", out.c_str());
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
|
||||
_write(file, gcode);
|
||||
BOOST_LOG_TRIVIAL(trace) << "Exported layer " << layer.id() << " print_z " << print_z <<
|
||||
|
|
@ -2643,7 +2651,7 @@ std::string GCode::retract(bool toolchange)
|
|||
return gcode;
|
||||
}
|
||||
|
||||
std::string GCode::set_extruder(unsigned int extruder_id)
|
||||
std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
|
||||
{
|
||||
if (!m_writer.need_toolchange(extruder_id))
|
||||
return "";
|
||||
|
|
@ -2677,6 +2685,8 @@ std::string GCode::set_extruder(unsigned int extruder_id)
|
|||
DynamicConfig config;
|
||||
config.set_key_value("previous_extruder", new ConfigOptionInt((int)m_writer.extruder()->id()));
|
||||
config.set_key_value("next_extruder", new ConfigOptionInt((int)extruder_id));
|
||||
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
|
||||
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
|
||||
gcode += placeholder_parser_process("toolchange_gcode", m_config.toolchange_gcode.value, extruder_id, &config);
|
||||
check_add_eol(gcode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include "Print.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include "GCode/CoolingBuffer.hpp"
|
||||
#include "GCode/PressureEqualizer.hpp"
|
||||
#include "GCode/SpiralVase.hpp"
|
||||
#include "GCode/ToolOrdering.hpp"
|
||||
#include "GCode/WipeTower.hpp"
|
||||
|
|
@ -22,6 +21,10 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
#include "GCode/PressureEqualizer.hpp"
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// Forward declarations.
|
||||
|
|
@ -257,12 +260,12 @@ protected:
|
|||
bool needs_retraction(const Polyline &travel, ExtrusionRole role = erNone);
|
||||
std::string retract(bool toolchange = false);
|
||||
std::string unretract() { return m_writer.unlift() + m_writer.unretract(); }
|
||||
std::string set_extruder(unsigned int extruder_id);
|
||||
std::string set_extruder(unsigned int extruder_id, double print_z);
|
||||
|
||||
/* Origin of print coordinates expressed in unscaled G-code coordinates.
|
||||
This affects the input arguments supplied to the extrude*() and travel_to()
|
||||
methods. */
|
||||
Vec2d m_origin;
|
||||
Vec2d m_origin;
|
||||
FullPrintConfig m_config;
|
||||
GCodeWriter m_writer;
|
||||
PlaceholderParser m_placeholder_parser;
|
||||
|
|
@ -306,7 +309,9 @@ protected:
|
|||
|
||||
std::unique_ptr<CoolingBuffer> m_cooling_buffer;
|
||||
std::unique_ptr<SpiralVase> m_spiral_vase;
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
std::unique_ptr<PressureEqualizer> m_pressure_equalizer;
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
std::unique_ptr<WipeTowerIntegration> m_wipe_tower;
|
||||
|
||||
// Heights at which the skirt has already been extruded.
|
||||
|
|
|
|||
|
|
@ -479,14 +479,14 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
|||
}
|
||||
case Extrusion::ColorPrint:
|
||||
{
|
||||
const auto color_print_cnt = cp_values.size();
|
||||
const int color_cnt = (int)tool_colors.size()/4;
|
||||
|
||||
const auto color_print_cnt = (int)cp_values.size();
|
||||
for (int i = color_print_cnt; i >= 0 ; --i)
|
||||
{
|
||||
int val = i;
|
||||
while (val >= GCodePreviewData::Range::Colors_Count)
|
||||
val -= GCodePreviewData::Range::Colors_Count;
|
||||
GCodePreviewData::Color color = Range::Default_Colors[val];
|
||||
|
||||
GCodePreviewData::Color color;
|
||||
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (i % color_cnt) * 4), 4 * sizeof(float));
|
||||
|
||||
if (color_print_cnt == 0) {
|
||||
items.emplace_back(Slic3r::I18N::translate(L("Default print color")), color);
|
||||
break;
|
||||
|
|
@ -521,6 +521,12 @@ size_t GCodePreviewData::memory_used() const
|
|||
sizeof(shell) + sizeof(ranges);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& GCodePreviewData::ColorPrintColors()
|
||||
{
|
||||
static std::vector<std::string> color_print = {"#C0392B", "#E67E22", "#F1C40F", "#27AE60", "#1ABC9C", "#2980B9", "#9B59B6"};
|
||||
return color_print;
|
||||
}
|
||||
|
||||
GCodePreviewData::Color operator + (const GCodePreviewData::Color& c1, const GCodePreviewData::Color& c2)
|
||||
{
|
||||
return GCodePreviewData::Color(clamp(0.0f, 1.0f, c1.rgba[0] + c2.rgba[0]),
|
||||
|
|
|
|||
|
|
@ -216,6 +216,8 @@ public:
|
|||
|
||||
// Return an estimate of the memory consumed by the time estimator.
|
||||
size_t memory_used() const;
|
||||
|
||||
static const std::vector<std::string>& ColorPrintColors();
|
||||
};
|
||||
|
||||
GCodePreviewData::Color operator + (const GCodePreviewData::Color& c1, const GCodePreviewData::Color& c2);
|
||||
|
|
|
|||
|
|
@ -381,22 +381,7 @@ public:
|
|||
Writer& comment_material(WipeTowerPrusaMM::material_type material)
|
||||
{
|
||||
m_gcode += "; material : ";
|
||||
switch (material)
|
||||
{
|
||||
case WipeTowerPrusaMM::PVA:
|
||||
m_gcode += "#8 (PVA)";
|
||||
break;
|
||||
case WipeTowerPrusaMM::SCAFF:
|
||||
m_gcode += "#5 (Scaffold)";
|
||||
break;
|
||||
case WipeTowerPrusaMM::FLEX:
|
||||
m_gcode += "#4 (Flex)";
|
||||
break;
|
||||
default:
|
||||
m_gcode += "DEFAULT (PLA)";
|
||||
break;
|
||||
}
|
||||
m_gcode += "\n";
|
||||
m_gcode += WipeTowerPrusaMM::to_string(material) + "\n";
|
||||
return *this;
|
||||
};
|
||||
|
||||
|
|
@ -487,6 +472,23 @@ WipeTowerPrusaMM::material_type WipeTowerPrusaMM::parse_material(const char *nam
|
|||
return INVALID;
|
||||
}
|
||||
|
||||
std::string WipeTowerPrusaMM::to_string(material_type material)
|
||||
{
|
||||
switch (material) {
|
||||
case PLA: return "PLA";
|
||||
case ABS: return "ABS";
|
||||
case PET: return "PET";
|
||||
case HIPS: return "HIPS";
|
||||
case FLEX: return "FLEX";
|
||||
case SCAFF: return "SCAFF";
|
||||
case EDGE: return "EDGE";
|
||||
case NGEN: return "NGEN";
|
||||
case PVA: return "PVA";
|
||||
case INVALID:
|
||||
default: return "INVALID";
|
||||
}
|
||||
}
|
||||
|
||||
// Returns gcode to prime the nozzles at the front edge of the print bed.
|
||||
WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
|
||||
// print_z of the first layer.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
|
||||
// Parse material name into material_type.
|
||||
static material_type parse_material(const char *name);
|
||||
static std::string to_string(material_type material);
|
||||
|
||||
// x -- x coordinates of wipe tower in mm ( left bottom corner )
|
||||
// y -- y coordinates of wipe tower in mm ( left bottom corner )
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@
|
|||
#define HAS_INTRINSIC_128_TYPE
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_WIN64)
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(_mul128)
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Int128 class (enables safe math on signed 64bit integers)
|
||||
// eg Int128 val1((int64_t)9223372036854775807); //ie 2^63 -1
|
||||
|
|
|
|||
|
|
@ -489,6 +489,9 @@ void Model::convert_multipart_object(unsigned int max_extruders)
|
|||
{
|
||||
new_v->name = o->name;
|
||||
new_v->config.set_deserialize("extruder", get_auto_extruder_id_as_string(max_extruders));
|
||||
#if ENABLE_VOLUMES_CENTERING_FIXES
|
||||
new_v->translate(-o->origin_translation);
|
||||
#endif // ENABLE_VOLUMES_CENTERING_FIXES
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -549,7 +552,7 @@ std::string Model::propose_export_file_name() const
|
|||
for (const ModelObject *model_object : this->objects)
|
||||
for (ModelInstance *model_instance : model_object->instances)
|
||||
if (model_instance->is_printable())
|
||||
return model_object->input_file;
|
||||
return model_object->name.empty() ? model_object->input_file : model_object->name;
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
|
@ -1683,7 +1686,7 @@ bool model_volume_list_changed(const ModelObject &model_object_old, const ModelO
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
// Verify whether the IDs of Model / ModelObject / ModelVolume / ModelInstance / ModelMaterial are valid and unique.
|
||||
void check_model_ids_validity(const Model &model)
|
||||
{
|
||||
|
|
@ -1729,6 +1732,6 @@ void check_model_ids_equal(const Model &model1, const Model &model2)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
#endif /* NDEBUG */
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -629,11 +629,11 @@ extern bool model_object_list_extended(const Model &model_old, const Model &mode
|
|||
// than the old ModelObject.
|
||||
extern bool model_volume_list_changed(const ModelObject &model_object_old, const ModelObject &model_object_new, const ModelVolume::Type type);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
// Verify whether the IDs of Model / ModelObject / ModelVolume / ModelInstance / ModelMaterial are valid and unique.
|
||||
void check_model_ids_validity(const Model &model);
|
||||
void check_model_ids_equal(const Model &model1, const Model &model2);
|
||||
#endif /* _DEBUG */
|
||||
#endif /* NDEBUG */
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,8 +135,10 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
|||
"min_print_speed",
|
||||
"max_print_speed",
|
||||
"max_volumetric_speed",
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
"max_volumetric_extrusion_rate_slope_positive",
|
||||
"max_volumetric_extrusion_rate_slope_negative",
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
"notes",
|
||||
"only_retract_when_crossing_perimeters",
|
||||
"output_filename_format",
|
||||
|
|
@ -1908,7 +1910,7 @@ DynamicConfig PrintStatistics::config() const
|
|||
config.set_key_value("print_time", new ConfigOptionString(normal_print_time));
|
||||
config.set_key_value("normal_print_time", new ConfigOptionString(normal_print_time));
|
||||
config.set_key_value("silent_print_time", new ConfigOptionString(silent_print_time));
|
||||
config.set_key_value("used_filament", new ConfigOptionFloat (this->total_used_filament));
|
||||
config.set_key_value("used_filament", new ConfigOptionFloat (this->total_used_filament / 1000.));
|
||||
config.set_key_value("extruded_volume", new ConfigOptionFloat (this->total_extruded_volume));
|
||||
config.set_key_value("total_cost", new ConfigOptionFloat (this->total_cost));
|
||||
config.set_key_value("total_weight", new ConfigOptionFloat (this->total_weight));
|
||||
|
|
@ -1924,7 +1926,7 @@ DynamicConfig PrintStatistics::placeholders()
|
|||
"print_time", "normal_print_time", "silent_print_time",
|
||||
"used_filament", "extruded_volume", "total_cost", "total_weight",
|
||||
"total_wipe_tower_cost", "total_wipe_tower_filament"})
|
||||
config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}"));
|
||||
config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}"));
|
||||
return config;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1208,6 +1208,7 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comExpert;
|
||||
def->default_value = new ConfigOptionFloat(0);
|
||||
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat);
|
||||
def->label = L("Max volumetric slope positive");
|
||||
def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. "
|
||||
|
|
@ -1231,6 +1232,7 @@ void PrintConfigDef::init_fff_params()
|
|||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->default_value = new ConfigOptionFloat(0);
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
|
||||
def = this->add("min_fan_speed", coInts);
|
||||
def->label = L("Min");
|
||||
|
|
@ -2740,6 +2742,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
|||
"start_perimeters_at_concave_points", "start_perimeters_at_non_overhang", "randomize_start",
|
||||
"seal_position", "vibration_limit", "bed_size",
|
||||
"print_center", "g0", "threads", "pressure_advance", "wipe_tower_per_color_wipe"
|
||||
#ifndef HAS_PRESSURE_EQUALIZER
|
||||
, "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative"
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
};
|
||||
|
||||
if (ignore.find(opt_key) != ignore.end()) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#include "libslic3r.h"
|
||||
#include "Config.hpp"
|
||||
|
||||
// #define HAS_PRESSURE_EQUALIZER
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
enum PrinterTechnology
|
||||
|
|
@ -620,8 +622,10 @@ public:
|
|||
ConfigOptionString layer_gcode;
|
||||
ConfigOptionFloat max_print_speed;
|
||||
ConfigOptionFloat max_volumetric_speed;
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
ConfigOptionFloat max_volumetric_extrusion_rate_slope_positive;
|
||||
ConfigOptionFloat max_volumetric_extrusion_rate_slope_negative;
|
||||
#endif
|
||||
ConfigOptionPercents retract_before_wipe;
|
||||
ConfigOptionFloats retract_length;
|
||||
ConfigOptionFloats retract_length_toolchange;
|
||||
|
|
@ -689,8 +693,10 @@ protected:
|
|||
OPT_PTR(layer_gcode);
|
||||
OPT_PTR(max_print_speed);
|
||||
OPT_PTR(max_volumetric_speed);
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
OPT_PTR(max_volumetric_extrusion_rate_slope_positive);
|
||||
OPT_PTR(max_volumetric_extrusion_rate_slope_negative);
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
OPT_PTR(retract_before_wipe);
|
||||
OPT_PTR(retract_length);
|
||||
OPT_PTR(retract_length_toolchange);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue