mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
ENH: calib support multi_extruder
1. backend support multi_extrude data structure 2. Compatible with third-party calibration 3. fix bug when get extruder in gocde export process Change-Id: I5dac9abdd9907a521a1ba9b480f9e05640591bc1 (cherry picked from commit 21e6271e59ea8e4924866275566617d14a4b2b6e)
This commit is contained in:
@@ -3097,7 +3097,7 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc
|
||||
// Do not process this piece of G-code by the time estimator, it already knows the values through another sources.
|
||||
void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print, int extruder_id)
|
||||
{
|
||||
int matched_machine_limit_idx = extruder_id * 2;
|
||||
int matched_machine_limit_idx = get_extruder_id(extruder_id) * 2;
|
||||
const auto flavor = print.config().gcode_flavor.value;
|
||||
if ((flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware) &&
|
||||
print.config().emit_machine_limits_to_gcode.value == true) {
|
||||
|
||||
@@ -1195,7 +1195,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume()
|
||||
return;
|
||||
|
||||
size_t nozzle_nums = print_config->nozzle_diameter.values.size();
|
||||
if (nozzle_nums > 1) {
|
||||
if (nozzle_nums > 1 && print_config->option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value == FilamentMapMode::fmmAuto) {
|
||||
std::vector<int> filament_maps = m_print->get_filament_maps();
|
||||
|
||||
if (print_config->print_sequence != PrintSequence::ByObject) {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
namespace Slic3r {
|
||||
|
||||
// Calculate the optimal Pressure Advance speed
|
||||
float CalibPressureAdvance::find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, int filament_idx)
|
||||
float CalibPressureAdvance::find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, int extruder_id, int filament_idx)
|
||||
{
|
||||
const double general_suggested_min_speed = 100.0;
|
||||
double filament_max_volumetric_speed = config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(filament_idx);
|
||||
// todo multi_extruders:
|
||||
const float nozzle_diameter = config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0/*get_extruder_index(filament_idx)*/);
|
||||
const float nozzle_diameter = config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(extruder_id);
|
||||
if (line_width <= 0.) line_width = Flow::auto_extrusion_width(frPerimeter, nozzle_diameter);
|
||||
Flow pattern_line = Flow(line_width, layer_height, nozzle_diameter);
|
||||
auto pa_speed = std::min(std::max(general_suggested_min_speed, config.option<ConfigOptionFloat>("outer_wall_speed")->value),
|
||||
|
||||
@@ -177,7 +177,7 @@ struct DrawBoxOptArgs
|
||||
class CalibPressureAdvance
|
||||
{
|
||||
public:
|
||||
static float find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, int filament_idx = 0);
|
||||
static float find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, int extruder_id = 0, int filament_idx = 0);
|
||||
|
||||
protected:
|
||||
CalibPressureAdvance() = default;
|
||||
|
||||
@@ -541,6 +541,7 @@ public:
|
||||
|
||||
std::string product_name; // set by iot service, get /user/print
|
||||
|
||||
|
||||
std::string bind_user_name;
|
||||
std::string bind_user_id;
|
||||
std::string bind_state; /* free | occupied */
|
||||
|
||||
@@ -9817,7 +9817,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
double speed = CalibPressureAdvance::find_optimal_PA_speed(
|
||||
wxGetApp().preset_bundle->full_config(),
|
||||
print_config.get_abs_value("line_width", nozzle_diameter),
|
||||
print_config.get_abs_value("layer_height"), 0);
|
||||
print_config.get_abs_value("layer_height"), 0, 0);
|
||||
print_config.set_key_value("outer_wall_speed", new ConfigOptionFloat(speed));
|
||||
|
||||
speeds.assign({speed});
|
||||
@@ -10006,7 +10006,7 @@ void Plater::_calib_pa_tower(const Calib_Params& params) {
|
||||
auto full_config = wxGetApp().preset_bundle->full_config();
|
||||
auto wall_speed = CalibPressureAdvance::find_optimal_PA_speed(
|
||||
full_config, full_config.get_abs_value("line_width", nozzle_diameter),
|
||||
full_config.get_abs_value("layer_height"), 0);
|
||||
full_config.get_abs_value("layer_height"), 0, 0);
|
||||
obj_cfg.set_key_value("outer_wall_speed", new ConfigOptionFloat(wall_speed));
|
||||
obj_cfg.set_key_value("inner_wall_speed", new ConfigOptionFloat(wall_speed));
|
||||
obj_cfg.set_key_value("seam_position", new ConfigOptionEnum<SeamPosition>(spRear));
|
||||
|
||||
@@ -614,7 +614,7 @@ void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model)
|
||||
print_config.set_key_value("outer_wall_speed",
|
||||
new ConfigOptionFloat(CalibPressureAdvance::find_optimal_PA_speed(
|
||||
full_config, print_config.get_abs_value("line_width"),
|
||||
print_config.get_abs_value("layer_height"), 0)));
|
||||
print_config.get_abs_value("layer_height"), calib_info.extruder_id, 0)));
|
||||
|
||||
for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
|
||||
print_config.set_key_value(opt.first, new ConfigOptionFloatOrPercent(nozzle_diameter * opt.second / 100, false));
|
||||
|
||||
Reference in New Issue
Block a user