diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/AppConfig.cpp | 3 | ||||
-rw-r--r-- | src/libslic3r/Config.hpp | 4 | ||||
-rw-r--r-- | src/libslic3r/Fill/Fill.cpp | 4 | ||||
-rw-r--r-- | src/libslic3r/GCode.cpp | 308 | ||||
-rw-r--r-- | src/libslic3r/Preset.cpp | 23 | ||||
-rw-r--r-- | src/libslic3r/Print.cpp | 11 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 419 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.hpp | 46 | ||||
-rw-r--r-- | src/slic3r/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/CalibrationRetractionDialog.cpp | 14 | ||||
-rw-r--r-- | src/slic3r/GUI/ConfigManipulation.cpp | 23 | ||||
-rw-r--r-- | src/slic3r/GUI/Field.cpp | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/GLCanvas3D.cpp | 16 | ||||
-rw-r--r-- | src/slic3r/GUI/PhysicalPrinterDialog.cpp | 6 | ||||
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 32 | ||||
-rw-r--r-- | src/slic3r/GUI/Preferences.cpp | 8 | ||||
-rw-r--r-- | src/slic3r/GUI/PresetHints.cpp | 33 | ||||
-rw-r--r-- | src/slic3r/Utils/MPMDv2.cpp | 155 | ||||
-rw-r--r-- | src/slic3r/Utils/MPMDv2.hpp | 45 | ||||
-rw-r--r-- | src/slic3r/Utils/PrintHost.cpp | 2 |
20 files changed, 925 insertions, 231 deletions
diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index df0209bb0..60e02e626 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -167,6 +167,9 @@ void AppConfig::set_defaults() if (get("suppress_hyperlinks").empty()) set("suppress_hyperlinks", "1"); + if (get("focus_platter_on_mouse").empty()) + set("focus_platter_on_mouse", "1"); + if (get("custom_toolbar_size").empty()) set("custom_toolbar_size", "100"); diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index e2506060e..5c8058aef 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1845,7 +1845,9 @@ public: // By setting min=0, only nonnegative input is allowed. double min = INT_MIN; double max = INT_MAX; - // To check if it's not a typo and a % is missing + // To check if it's not a typo and a % is missing. Ask for confirmation if the value is higher than that. + // if negative, if it's lower than the opposite. + // if percentage, multiply by the nozzle_diameter. FloatOrPercent max_literal = FloatOrPercent{ 0., false }; // max precision after the dot, only for display int precision = 6; diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 0639f95ab..bbcc9d9bc 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -565,6 +565,10 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: } } + if (!surface_fill.params.flow.bridge && surface_fill.params.full_infill()) { + surface_fill.params.flow.spacing_ratio = surface_fill.params.config->solid_infill_overlap.get_abs_value(1.); + } + //make fill while ((size_t)surface_fill.params.priority >= fills_by_priority.size()) fills_by_priority.push_back(new ExtrusionEntityCollection()); diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 362127cc0..6a4b0a97a 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -524,6 +524,8 @@ std::string WipeTowerIntegration::post_process_wipe_tower_moves(const WipeTower: #define EXTRUDER_CONFIG_WITH_DEFAULT(OPT,DEF) (m_writer.tool_is_extruder()?m_config.OPT.get_at(m_writer.tool()->id()):DEF) #define BOOL_EXTRUDER_CONFIG(OPT) m_writer.tool_is_extruder() && m_config.OPT.get_at(m_writer.tool()->id()) +constexpr float SMALL_PERIMETER_SPEED_RATIO_OFFSET = (-10); + // Collect pairs of object_layer + support_layer sorted by print_z. // object_layer & support_layer are considered to be on the same print_z, if they are not further than EPSILON. std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObject& object) @@ -769,34 +771,31 @@ namespace DoExport { excluded.insert(erMixed); excluded.insert(erNone); excluded.insert(erWipeTower); - if (config->option("perimeter_speed") != nullptr && config->option("perimeter_speed")->getFloat() != 0 - && config->option("small_perimeter_speed") != nullptr && config->option("small_perimeter_speed")->getFloat() != 0) { + if (config->option("perimeter_speed") != nullptr && config->get_computed_value("perimeter_speed") != 0) { excluded.insert(erPerimeter); excluded.insert(erSkirt); } - if (config->option("external_perimeter_speed") != nullptr && config->option("external_perimeter_speed")->getFloat() != 0 - && config->option("small_perimeter_speed") != nullptr && config->option("small_perimeter_speed")->getFloat() != 0) + if (config->option("external_perimeter_speed") != nullptr && config->get_computed_value("external_perimeter_speed") != 0) excluded.insert(erExternalPerimeter); - if (config->option("overhangs_speed") != nullptr && config->option("overhangs_speed")->getFloat() != 0 - && config->option("small_perimeter_speed") != nullptr && config->option("small_perimeter_speed")->getFloat() != 0) + if (config->option("overhangs_speed") != nullptr && config->get_computed_value("overhangs_speed") != 0) excluded.insert(erOverhangPerimeter); - if (config->option("gap_fill_speed") != nullptr && config->option("gap_fill_speed")->getFloat() != 0) + if (config->option("gap_fill_speed") != nullptr && config->get_computed_value("gap_fill_speed") != 0) excluded.insert(erGapFill); - if (config->option("thin_walls_speed") != nullptr && config->option("thin_walls_speed")->getFloat() != 0) + if (config->option("thin_walls_speed") != nullptr && config->get_computed_value("thin_walls_speed") != 0) excluded.insert(erThinWall); - if (config->option("infill_speed") != nullptr && config->option("infill_speed")->getFloat() != 0) + if (config->option("infill_speed") != nullptr && config->get_computed_value("infill_speed") != 0) excluded.insert(erInternalInfill); - if (config->option("solid_infill_speed") != nullptr && config->option("solid_infill_speed")->getFloat() != 0) + if (config->option("solid_infill_speed") != nullptr && config->get_computed_value("solid_infill_speed") != 0) excluded.insert(erSolidInfill); - if (config->option("top_solid_infill_speed") != nullptr && config->option("top_solid_infill_speed")->getFloat() != 0) + if (config->option("top_solid_infill_speed") != nullptr && config->get_computed_value("top_solid_infill_speed") != 0) excluded.insert(erTopSolidInfill); - if (config->option("bridge_speed") != nullptr && config->option("bridge_speed")->getFloat() != 0) + if (config->option("bridge_speed") != nullptr && config->get_computed_value("bridge_speed") != 0) excluded.insert(erBridgeInfill); - if (config->option("bridge_speed_internal") != nullptr && config->option("bridge_speed_internal")->getFloat() != 0) + if (config->option("bridge_speed_internal") != nullptr && config->get_computed_value("bridge_speed_internal") != 0) excluded.insert(erInternalBridgeInfill); - if (config->option("support_material_speed") != nullptr && config->option("support_material_speed")->getFloat() != 0) + if (config->option("support_material_speed") != nullptr && config->get_computed_value("support_material_speed") != 0) excluded.insert(erSupportMaterial); - if (config->option("support_material_interface_speed") != nullptr && config->option("support_material_interface_speed")->getFloat() != 0) + if (config->option("support_material_interface_speed") != nullptr && config->get_computed_value("support_material_interface_speed") != 0) excluded.insert(erSupportMaterialInterface); } virtual void use(const ExtrusionPath& path) override { @@ -2970,16 +2969,16 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s if (paths.empty()) return ""; // apply the small/external? perimeter speed - if (speed == -1 && is_perimeter(paths.front().role())){ + if (speed == -1 && is_perimeter(paths.front().role()) && paths.front().role() != erThinWall){ coordf_t min_length = scale_d(this->m_config.small_perimeter_min_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0))); coordf_t max_length = scale_d(this->m_config.small_perimeter_max_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0))); max_length = std::max(min_length, max_length); if (loop.length() < max_length) { if (loop.length() <= min_length) { - speed = m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed); + speed = SMALL_PERIMETER_SPEED_RATIO_OFFSET; } else if (max_length > min_length) { //use a negative speed: it will be use as a ratio when computing the real speed - speed = -(loop.length() - min_length) / (max_length - min_length); + speed = SMALL_PERIMETER_SPEED_RATIO_OFFSET - (loop.length() - min_length) / (max_length - min_length); } } } @@ -3304,15 +3303,16 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s if (paths.empty()) return ""; // apply the small perimeter speed - if (speed == -1 && is_perimeter(paths.front().role()) && loop.length() <= - scale_(this->m_config.small_perimeter_max_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0)))) { + if (speed == -1 && is_perimeter(paths.front().role()) && paths.front().role() != erThinWall) { double min_length = scale_d(this->m_config.small_perimeter_min_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0))); double max_length = scale_d(this->m_config.small_perimeter_max_length.get_abs_value(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0))); - if (loop.length() <= min_length) { - speed = m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed); - } else { - //set speed between -1 and 0 you have to multiply the real peed by the opposite of that, and add the other part as small_perimeter_speed - speed = (min_length - loop.length()) / (max_length - min_length); + if (loop.length() < max_length) { + if (loop.length() <= min_length) { + speed = SMALL_PERIMETER_SPEED_RATIO_OFFSET; + } else if (max_length > min_length) { + //use a negative speed: it will be use as a ratio when computing the real speed + speed = SMALL_PERIMETER_SPEED_RATIO_OFFSET - (loop.length() - min_length) / (max_length - min_length); + } } } @@ -3940,8 +3940,10 @@ double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath& path, double spee float factor = 1; // set speed if (speed < 0) { - //if speed == -1, then it's means "choose yourself, but if it's -1 < speed <0 , then it's a scaling from small_perimeter. - factor = float(-speed); + //if speed == -1, then it's means "choose yourself, but if it's < SMALL_PERIMETER_SPEED_RATIO_OFFSET, then it's a scaling from small_perimeter. + if (speed <= SMALL_PERIMETER_SPEED_RATIO_OFFSET) { + factor = float(-speed + SMALL_PERIMETER_SPEED_RATIO_OFFSET); + } //it's a bit hacky, so if you want to rework it, help yourself. if (path.role() == erPerimeter) { speed = m_config.get_computed_value("perimeter_speed"); @@ -3976,30 +3978,43 @@ double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath& path, double spee if (m_volumetric_speed != 0. && speed == 0) { //if m_volumetric_speed, use the max size for thinwall & gapfill, to avoid variations double vol_speed = m_volumetric_speed / path.mm3_per_mm; - if (vol_speed > m_config.max_print_speed.value) - vol_speed = m_config.max_print_speed.value; + double max_print_speed = m_config.get_computed_value("max_print_speed"); + if (vol_speed > max_print_speed) + vol_speed = max_print_speed; // if using a % of an auto speed, use the % over the volumetric speed. - if (path.role() == erExternalPerimeter) { + if (path.role() == erPerimeter) { + speed = m_config.perimeter_speed.get_abs_value(vol_speed); + } else if (path.role() == erExternalPerimeter) { speed = m_config.external_perimeter_speed.get_abs_value(vol_speed); + } else if (path.role() == erBridgeInfill) { + speed = m_config.bridge_speed.get_abs_value(vol_speed); } else if (path.role() == erInternalBridgeInfill) { speed = m_config.bridge_speed_internal.get_abs_value(vol_speed); } else if (path.role() == erOverhangPerimeter) { speed = m_config.overhangs_speed.get_abs_value(vol_speed); + } else if (path.role() == erInternalInfill) { + speed = m_config.infill_speed.get_abs_value(vol_speed); } else if (path.role() == erSolidInfill) { speed = m_config.solid_infill_speed.get_abs_value(vol_speed); } else if (path.role() == erTopSolidInfill) { speed = m_config.top_solid_infill_speed.get_abs_value(vol_speed); + } else if (path.role() == erThinWall) { + speed = m_config.thin_walls_speed.get_abs_value(vol_speed); + } else if (path.role() == erGapFill) { + speed = m_config.gap_fill_speed.get_abs_value(vol_speed); + } else if (path.role() == erIroning) { + speed = m_config.ironing_speed.get_abs_value(vol_speed); } if (speed == 0) { speed = vol_speed; } } - if (speed == 0) // this code shouldn't trigger as if it's 0, you have to get a m_volumetric_speed + if (speed == 0) // if you don't have a m_volumetric_speed speed = m_config.max_print_speed.value; // Apply small perimeter 'modifier // don't modify bridge speed if (factor < 1 && !(is_bridge(path.role()))) { - float small_speed = (float)m_config.small_perimeter_speed.get_abs_value(m_config.perimeter_speed); + float small_speed = (float)m_config.small_perimeter_speed.get_abs_value(m_config.get_computed_value("perimeter_speed")); //apply factor between feature speed and small speed speed = (speed * factor) + double((1.f - factor) * small_speed); } @@ -4047,61 +4062,198 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string max_acceleration = m_config.machine_max_acceleration_extruding.get_at(0); double travel_acceleration = get_travel_acceleration(m_config); if(acceleration > 0){ + switch (path.role()){ + case erPerimeter: + perimeter: + if (m_config.perimeter_acceleration.value > 0) { + double perimeter_acceleration = m_config.get_computed_value("perimeter_acceleration"); + if (perimeter_acceleration > 0) + acceleration = perimeter_acceleration; + } + break; + case erExternalPerimeter: + externalPerimeter: + if (m_config.external_perimeter_acceleration.value > 0) { + double external_perimeter_acceleration = m_config.get_computed_value("external_perimeter_acceleration"); + if (external_perimeter_acceleration > 0) { + acceleration = external_perimeter_acceleration; + break; + } + } + goto perimeter; + case erSolidInfill: + solidInfill: + if (m_config.solid_infill_acceleration.value > 0) { + double solid_infill_acceleration = m_config.get_computed_value("solid_infill_acceleration"); + if (solid_infill_acceleration > 0) + acceleration = solid_infill_acceleration; + } + break; + case erInternalInfill: + internalInfill: + if (m_config.infill_acceleration.value > 0) { + double infill_acceleration = m_config.get_computed_value("infill_acceleration"); + if (infill_acceleration > 0) { + acceleration = infill_acceleration; + break; + } + } + goto solidInfill; + case erTopSolidInfill: + topSolidInfill: + if (m_config.top_solid_infill_acceleration.value > 0) { + double top_solid_infill_acceleration = m_config.get_computed_value("top_solid_infill_acceleration"); + if (top_solid_infill_acceleration > 0) { + acceleration = top_solid_infill_acceleration; + break; + } + } + goto solidInfill; + case erIroning: + if (m_config.ironing_acceleration.value > 0) { + double ironing_acceleration = m_config.get_computed_value("ironing_acceleration"); + if (ironing_acceleration > 0) { + acceleration = ironing_acceleration; + break; + } + } + goto topSolidInfill; + case erSupportMaterial: + case erSkirt: + case erWipeTower: + supportMaterial: + if (m_config.support_material_acceleration.value > 0) { + double support_material_acceleration = m_config.get_computed_value("support_material_acceleration"); + if (support_material_acceleration > 0) + acceleration = support_material_acceleration; + } + break; + case erSupportMaterialInterface: + if (m_config.support_material_interface_acceleration.value > 0) { + double support_material_interface_acceleration = m_config.get_computed_value("support_material_interface_acceleration"); + if (support_material_interface_acceleration > 0) { + acceleration = support_material_interface_acceleration; + break; + } + } + goto supportMaterial; + case erBridgeInfill: + bridgeInfill: + if (m_config.bridge_acceleration.value > 0) { + double bridge_acceleration = m_config.get_computed_value("bridge_acceleration"); + if (bridge_acceleration > 0) + acceleration = bridge_acceleration; + } + break; + case erInternalBridgeInfill: + if (m_config.bridge_internal_acceleration.value > 0) { + double bridge_internal_acceleration = m_config.get_computed_value("bridge_internal_acceleration"); + if (bridge_internal_acceleration > 0) { + acceleration = bridge_internal_acceleration; + break; + } + } + goto bridgeInfill; + case erOverhangPerimeter: + if (m_config.overhangs_acceleration.value > 0) { + double overhangs_acceleration = m_config.get_computed_value("overhangs_acceleration"); + if (overhangs_acceleration > 0) { + acceleration = overhangs_acceleration; + break; + } + } + goto bridgeInfill; + case erGapFill: + if (m_config.gap_fill_acceleration.value > 0) { + double gap_fill_acceleration = m_config.get_computed_value("gap_fill_acceleration"); + if (gap_fill_acceleration > 0) { + acceleration = gap_fill_acceleration; + break; + } + } + goto perimeter; + break; + case erThinWall: + if (m_config.thin_walls_acceleration.value > 0) { + double thin_walls_acceleration = m_config.get_computed_value("thin_walls_acceleration"); + if (thin_walls_acceleration > 0) { + acceleration = thin_walls_acceleration; + break; + } + } + goto externalPerimeter; + case erMilling: + case erCustom: + case erMixed: + case erCount: + case erNone: + default: + break; + } + if (this->on_first_layer() && m_config.first_layer_acceleration.value > 0) { - acceleration = std::min(max_acceleration, m_config.first_layer_acceleration.get_abs_value(acceleration)); - } else if (m_config.perimeter_acceleration.value > 0 && is_perimeter(path.role())) { - acceleration = std::min(max_acceleration, m_config.perimeter_acceleration.get_abs_value(acceleration)); - } else if (m_config.bridge_acceleration.value > 0 && is_bridge(path.role()) - && path.role() != erOverhangPerimeter) { - acceleration = std::min(max_acceleration, m_config.bridge_acceleration.get_abs_value(acceleration)); - } else if (m_config.infill_acceleration.value > 0 && is_infill(path.role())) { - acceleration = std::min(max_acceleration, m_config.infill_acceleration.get_abs_value(acceleration)); + acceleration = std::min(acceleration, m_config.first_layer_acceleration.get_abs_value(acceleration)); } + + acceleration = std::min(max_acceleration, acceleration); + } - if (travel_acceleration <= acceleration || travel_acceleration == 0 || acceleration == 0) { - m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); - // go to first point of extrusion path (stop at midpoint to let us set the decel speed) - if (!m_last_pos_defined || m_last_pos != path.first_point()) { - Polyline polyline = this->travel_to(gcode, path.first_point(), path.role()); - this->write_travel_to(gcode, polyline, "move to first " + description + " point (" + std::to_string(acceleration) +" == "+ std::to_string(travel_acceleration)+")"); - } - } else { - // go to midpoint to let us set the decel speed) - if (!m_last_pos_defined || m_last_pos != path.first_point()) { - Polyline poly_start = this->travel_to(gcode, path.first_point(), path.role()); - coordf_t length = poly_start.length(); - // if length is enough, it's not the hack for first move, and the travel accel is different than the normal accel - // then cut the travel in two to change the accel in-between - // TODO: compute the real point where it should be cut, considering an infinite max speed. - if (length > std::max(coordf_t(SCALED_EPSILON), scale_d(m_config.min_length)) && m_last_pos_defined) { - Polyline poly_end; - coordf_t min_length = scale_d(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0.5)) * 20; - if (poly_start.size() > 2 && length > min_length * 3) { - //if complex travel, try to deccelerate only at the end, unless it's less than ~ 20 nozzle - if (poly_start.lines().back().length() < min_length) { - poly_end = poly_start; - poly_start.clip_end(min_length); - poly_end.clip_start(length - min_length); + + if (m_config.travel_deceleration_use_target){ + if (travel_acceleration <= acceleration || travel_acceleration == 0 || acceleration == 0) { + m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); + // go to first point of extrusion path (stop at midpoint to let us set the decel speed) + if (!m_last_pos_defined || m_last_pos != path.first_point()) { + Polyline polyline = this->travel_to(gcode, path.first_point(), path.role()); + this->write_travel_to(gcode, polyline, "move to first " + description + " point (acceleration:" + std::to_string(acceleration) +" travel acceleration:"+ std::to_string(travel_acceleration)+")"); + } + } else { + // go to midpoint to let us set the decel speed) + if (!m_last_pos_defined || m_last_pos != path.first_point()) { + Polyline poly_start = this->travel_to(gcode, path.first_point(), path.role()); + coordf_t length = poly_start.length(); + // if length is enough, it's not the hack for first move, and the travel accel is different than the normal accel + // then cut the travel in two to change the accel in-between + // TODO: compute the real point where it should be cut, considering an infinite max speed. + if (length > std::max(coordf_t(SCALED_EPSILON), scale_d(m_config.min_length)) && m_last_pos_defined) { + Polyline poly_end; + coordf_t min_length = scale_d(EXTRUDER_CONFIG_WITH_DEFAULT(nozzle_diameter, 0.5)) * 20; + if (poly_start.size() > 2 && length > min_length * 3) { + //if complex travel, try to deccelerate only at the end, unless it's less than ~ 20 nozzle + if (poly_start.lines().back().length() < min_length) { + poly_end = poly_start; + poly_start.clip_end(min_length); + poly_end.clip_start(length - min_length); + } else { + poly_end.points.push_back(poly_start.points.back()); + poly_start.points.pop_back(); + poly_end.points.push_back(poly_start.points.back()); + poly_end.reverse(); + } } else { - poly_end.points.push_back(poly_start.points.back()); - poly_start.points.pop_back(); - poly_end.points.push_back(poly_start.points.back()); - poly_end.reverse(); + poly_end = poly_start; + poly_start.clip_end(length / 2); + poly_end.clip_start(length / 2); } + m_writer.set_acceleration((uint32_t)floor(travel_acceleration + 0.5)); + this->write_travel_to(gcode, poly_start, "move to first " + description + " point (acceleration)"); + //travel acceleration should be already set at startup via special gcode, and so it's automatically used by G0. + m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); + this->write_travel_to(gcode, poly_end, "move to first " + description + " point (deceleration)"); } else { - poly_end = poly_start; - poly_start.clip_end(length / 2); - poly_end.clip_start(length / 2); + m_writer.set_acceleration((uint32_t)floor(travel_acceleration + 0.5)); + this->write_travel_to(gcode, poly_start, "move to first " + description + " point (acceleration)"); } - m_writer.set_acceleration((uint32_t)floor(travel_acceleration + 0.5)); - this->write_travel_to(gcode, poly_start, "move to first " + description + " point (acceleration)"); - //travel acceleration should be already set at startup via special gcode, and so it's automatically used by G0. - m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); - this->write_travel_to(gcode, poly_end, "move to first " + description + " point (deceleration)"); } else { - m_writer.set_acceleration((uint32_t)floor(travel_acceleration + 0.5)); - this->write_travel_to(gcode, poly_start, "move to first " + description + " point (acceleration)"); + m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); } + } + } else { + if (!m_last_pos_defined || m_last_pos != path.first_point()) { + m_writer.set_acceleration((uint32_t)floor(travel_acceleration + 0.5)); + Polyline polyline = this->travel_to(gcode, path.first_point(), path.role()); + this->write_travel_to(gcode, polyline, "move to first " + description + " point"); + m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); } else { m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5)); } diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 7545b3074..eefb4f4bb 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -491,17 +491,16 @@ const std::vector<std::string>& Preset::print_options() "fill_angle_increment", "bridge_angle", "solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first", - "max_print_speed", - "max_volumetric_speed", "avoid_crossing_perimeters_max_detour", #ifdef HAS_PRESSURE_EQUALIZER "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", #endif /* HAS_PRESSURE_EQUALIZER */ "min_width_top_surface", + // speeds + "default_speed", "bridge_speed", "bridge_speed_internal", - // speeds - "external_perimeter_speed", + "external_perimeter_speed", "first_layer_speed", "first_layer_min_speed", "infill_speed", @@ -515,6 +514,8 @@ const std::vector<std::string>& Preset::print_options() "support_material_xy_spacing", "top_solid_infill_speed", "travel_speed", "travel_speed_z", + "max_print_speed", + "max_volumetric_speed", // gapfill "gap_fill", "gap_fill_last", @@ -523,11 +524,22 @@ const std::vector<std::string>& Preset::print_options() "gap_fill_speed", // acceleration "bridge_acceleration", + "bridge_internal_acceleration", "default_acceleration", + "external_perimeter_acceleration", "first_layer_acceleration", + "gap_fill_acceleration", "infill_acceleration", + "ironing_acceleration", + "overhangs_acceleration", "perimeter_acceleration", + "solid_infill_acceleration", + "support_material_acceleration", + "support_material_interface_acceleration", + "thin_walls_acceleration", + "top_solid_infill_acceleration", "travel_acceleration", + "travel_deceleration_use_target", // skirt "skirts", "skirt_distance", @@ -586,6 +598,7 @@ const std::vector<std::string>& Preset::print_options() "support_material_extrusion_width", // overlap, ratios "infill_overlap", "bridge_flow_ratio", + "solid_infill_overlap", "infill_anchor", "infill_anchor_max", "clip_multipart_objects", @@ -731,7 +744,7 @@ const std::vector<std::string>& Preset::printer_options() if (s_opts.empty()) { s_opts = { "printer_technology", - "bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset", + "bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset", "init_z_rotate", "fan_kickstart", "fan_speedup_overhangs", "fan_speedup_time", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 1132af8dd..2394adbb7 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -80,6 +80,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option "before_layer_gcode", "between_objects_gcode", "bridge_acceleration", + "bridge_internal_acceleration", "bridge_fan_speed", "bridge_internal_fan_speed", "colorprint_heights", @@ -91,6 +92,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option "duplicate_distance", "end_gcode", "end_filament_gcode", + "external_perimeter_acceleration", "external_perimeter_cut_corners", "external_perimeter_fan_speed", "extrusion_axis", @@ -121,6 +123,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option "first_layer_infill_speed", "first_layer_min_speed", "full_fan_speed_layer", + "gap_fill_acceleration", "gap_fill_speed", "gcode_comments", "gcode_filename_illegal_char", @@ -128,6 +131,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option "gcode_precision_xyz", "gcode_precision_e", "infill_acceleration", + "ironing_acceleration", "layer_gcode", "max_fan_speed", "max_gcode_per_second", @@ -149,6 +153,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option "notes", "only_retract_when_crossing_perimeters", "output_filename_format", + "overhangs_acceleration", "perimeter_acceleration", "post_process", "printer_notes", @@ -167,17 +172,23 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option "retract_speed", "single_extruder_multi_material_priming", "slowdown_below_layer_time", + "solid_infill_acceleration", + "support_material_acceleration", + "support_material_interface_acceleration", "standby_temperature_delta", "start_gcode", "start_gcode_manual", "start_filament_gcode", + "thin_walls_acceleration", "thin_walls_speed", "time_estimation_compensation", "tool_name", "toolchange_gcode", "top_fan_speed", + "top_solid_infill_acceleration", "threads", "travel_acceleration", + "travel_deceleration_use_target", "travel_speed", "travel_speed_z", "use_firmware_retraction", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a707ab94c..de22a6689 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -310,17 +310,30 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0.)); def = this->add("bridge_acceleration", coFloatOrPercent); - def->label = L("Bridge"); + def->label = L("Bridges"); def->full_label = L("Bridge acceleration"); def->category = OptionCategory::speed; def->tooltip = L("This is the acceleration your printer will use for bridges." "\nCan be a % of the default acceleration" - "\nSet zero to disable acceleration control for bridges." - "\nNote that it won't be applied to overhangs, they still use the perimeter acceleration."); + "\nSet zero to use default acceleration for bridges."); def->sidetext = L("mm/s² or %"); def->ratio_over = "default_acceleration"; def->min = 0; def->max_literal = { -220, false }; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + + def = this->add("bridge_internal_acceleration", coFloatOrPercent); + def->label = L("Internal bridges "); + def->full_label = L("Internal bridges acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for internal bridges. " + "\nCan be a % of the default acceleration" + "\nSet zero to use bridge acceleration for internal bridges."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "bridge_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; def->mode = comExpert; def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); @@ -385,7 +398,8 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("This factor affects the amount of plastic for bridging. " "You can decrease it slightly to pull the extrudates and prevent sagging, " "although default settings are usually good and you should experiment " - "with cooling (use a fan) before tweaking this."); + "with cooling (use a fan) before tweaking this." + "\nFor reference, the default bridge flow is (in mm3/mm): (nozzle diameter) * (nozzle diameter) * PI/4"); def->min = 1; def->max = 200; def->mode = comAdvanced; @@ -429,16 +443,19 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionPercent(90)); - def = this->add("bridge_speed", coFloat); + def = this->add("bridge_speed", coFloatOrPercent); def->label = L("Bridges"); def->full_label = L("Bridge speed"); def->category = OptionCategory::speed; - def->tooltip = L("Speed for printing bridges."); - def->sidetext = L("mm/s"); + def->tooltip = L("Speed for printing bridges." + "\nThis can be expressed as a percentage (for example: 60%) over the Default speed." + "\nSet zero to use the autospeed for this feature"); + def->sidetext = L("mm/s or %"); def->aliases = { "bridge_feed_rate" }; + def->ratio_over = "default_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(60)); + def->set_default_value(new ConfigOptionFloatOrPercent(60, true)); def = this->add("bridge_speed_internal", coFloatOrPercent); def->label = L("Internal bridges"); @@ -448,7 +465,7 @@ void PrintConfigDef::init_fff_params() def->sidetext = L("mm/s or %"); def->ratio_over = "bridge_speed"; def->min = 0; - def->mode = comAdvanced; + def->mode = comExpert; def->set_default_value(new ConfigOptionFloatOrPercent(150,true)); def = this->add("brim_inside_holes", coBool); @@ -672,15 +689,15 @@ void PrintConfigDef::init_fff_params() def->category = OptionCategory::speed; def->full_label = L("Default acceleration"); def->tooltip = L("This is the acceleration your printer will be reset to after " - "the role-specific acceleration values are used (perimeter/infill). " - "\nYou can set it as a % of the max of the X machine acceleration limit." - "\nSet zero to prevent resetting acceleration at all."); + "the role-specific acceleration values are used (perimeter/infill). " + "\nThis can be expressed as a percentage (for example: 80%) over the machine Max Acceleration for X axis." + "\nSet zero to prevent resetting acceleration at all."); def->sidetext = L("mm/s² or %"); def->ratio_over = "machine_max_acceleration_x"; def->min = 0; def->max_literal = { -200, false }; - def->mode = comExpert; - def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); def = this->add("default_filament_profile", coStrings); def->label = L("Default filament profile"); @@ -696,6 +713,19 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionString()); def->cli = ConfigOptionDef::nocli; + def = this->add("default_speed", coFloatOrPercent); + def->label = L("Default"); + def->category = OptionCategory::speed; + def->full_label = L("Default speed"); + def->tooltip = L("This is the reference speed that other 'main' speed can reference to by a %. This setting doesn't do anythign by itself" + "\nThis can be expressed as a percentage (for example: 80%) over the machine Max Feedrate for X axis." + "\nSet zero to use autospeed for speed fields using a % of this setting."); + def->sidetext = L("mm/s or %"); + def->ratio_over = "machine_max_feedrate_x"; + def->min = 0; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(100, false)); + def = this->add("disable_fan_first_layers", coInts); def->label = L("Disable fan for the first"); def->category = OptionCategory::cooling; @@ -991,17 +1021,31 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionPercent(0)); + def = this->add("external_perimeter_acceleration", coFloatOrPercent); + def->label = L("External"); + def->full_label = L("External Perimeter acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for external perimeters. " + "\nCan be a % of the internal perimeter acceleration" + "\nSet zero to use internal perimeter acceleration for external perimeters."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "perimeter_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("external_perimeter_speed", coFloatOrPercent); def->label = L("External"); def->full_label = L("External perimeters speed"); def->category = OptionCategory::speed; def->tooltip = L("This separate setting will affect the speed of external perimeters (the visible ones). " - "If expressed as percentage (for example: 80%) it will be calculated " - "on the perimeters speed setting above. Set zero for auto."); + "\nIf expressed as percentage (for example: 80%) it will be calculated over the Internal Perimeters speed setting." + "\nSet zero to use autospeed for this feature."); def->sidetext = L("mm/s or %"); def->ratio_over = "perimeter_speed"; def->min = 0; - def->mode = comAdvanced; + def->mode = comExpert; def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); def = this->add("external_perimeters_first", coBool); @@ -1903,14 +1947,14 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionPercent(10)); def = this->add("first_layer_acceleration", coFloatOrPercent); - def->label = L("First layer"); + def->label = L("Max"); def->full_label = L("First layer acceleration"); def->category = OptionCategory::speed; - def->tooltip = L("This is the acceleration your printer will use for first layer." - "\nCan be a % of the default acceleration" + def->tooltip = L("This is the maximum acceleration your printer will use for first layer." + "\nIf set to %, all accelerations will be reduced by that ratio." "\nSet zero to disable acceleration control for first layer."); def->sidetext = L("mm/s² or %"); - def->ratio_over = "default_acceleration"; + def->ratio_over = "depends"; def->min = 0; def->max_literal = { -200, false }; def->mode = comExpert; @@ -2048,6 +2092,20 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionBool(true)); + def = this->add("gap_fill_acceleration", coFloatOrPercent); + def->label = L("Gap fill"); + def->full_label = L("Gap fill acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for gap fills. " + "\nThis can be expressed as a percentage over the perimeter acceleration." + "\nSet zero to use perimeter acceleration for gap fills."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "perimeter_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("gap_fill_last", coBool); def->label = L("after last perimeter"); def->full_label = L("Gapfill after last perimeter"); @@ -2079,17 +2137,19 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionPercent(100)); - def = this->add("gap_fill_speed", coFloat); + def = this->add("gap_fill_speed", coFloatOrPercent); def->label = L("Gap fill"); def->full_label = L("Gap fill speed"); def->category = OptionCategory::speed; def->tooltip = L("Speed for filling small gaps using short zigzag moves. Keep this reasonably low " "to avoid too much shaking and resonance issues." - "\nGap fill extrusions are ignored from the automatic volumetric speed computation, unless you set it to 0."); - def->sidetext = L("mm/s"); + "\nGap fill extrusions are ignored from the automatic volumetric speed computation, unless you set it to 0." + "\nThis can be expressed as a percentage (for example: 80%) over the Internal Perimeter speed."); + def->sidetext = L("mm/s or %"); + def->ratio_over = "perimeter_speed"; def->min = 0; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(20)); + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(50,true)); def = this->add("gcode_comments", coBool); def->label = L("Verbose G-code"); @@ -2188,17 +2248,17 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionBool(0)); def = this->add("infill_acceleration", coFloatOrPercent); - def->label = L("Infill"); + def->label = L("Sparse"); def->full_label = L("Infill acceleration"); def->category = OptionCategory::speed; - def->tooltip = L("This is the acceleration your printer will use for infill." - "\nCan be a % of the default acceleration" - "\nSet zero to disable acceleration control for infill."); + def->tooltip = L("This is the acceleration your printer will use for Sparse infill." + "\nCan be a % of the solid infill acceleration" + "\nSet zero to use solid infill acceleration for infill."); def->sidetext = L("mm/s² or %"); - def->ratio_over = "default_acceleration"; + def->ratio_over = "solid_infill_acceleration"; def->min = 0; def->max_literal = { -200, false }; - def->mode = comExpert; + def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); def = this->add("infill_every_layers", coInt); @@ -2435,16 +2495,19 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloatOrPercent(25, true)); - def = this->add("infill_speed", coFloat); + def = this->add("infill_speed", coFloatOrPercent); def->label = L("Sparse"); def->full_label = L("Sparse infill speed"); def->category = OptionCategory::speed; - def->tooltip = L("Speed for printing the internal fill. Set zero for auto."); - def->sidetext = L("mm/s"); + def->tooltip = L("Speed for printing the internal fill." + "\nThis can be expressed as a percentage (for example: 80%) over the Solid Infill speed." + "\nSet zero to use autospeed for this feature."); + def->sidetext = L("mm/s or %"); + def->ratio_over = "solid_infill_speed"; def->aliases = { "print_feed_rate", "infill_feed_rate" }; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(80)); + def->set_default_value(new ConfigOptionFloatOrPercent(300, true)); def = this->add("inherits", coString); def->label = L("Inherits profile"); @@ -2476,6 +2539,20 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); + def = this->add("ironing_acceleration", coFloatOrPercent); + def->label = L("Ironing"); + def->full_label = L("Ironing acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for ironing. " + "\nCan be a % of the top solid infill acceleration" + "\nSet zero to use top solid infill acceleration for ironing."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "top_solid_infill_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("ironing_angle", coFloat); def->label = L("Ironing angle"); def->category = OptionCategory::ironing; @@ -2521,15 +2598,16 @@ void PrintConfigDef::init_fff_params() def = this->add("ironing_speed", coFloatOrPercent); def->label = L("Ironing"); + def->full_label = L("Ironing speed"); def->category = OptionCategory::ironing; def->tooltip = L("Ironing speed. Used for the ironing pass of the ironing infill pattern, and the post-process infill." - " Can be defined as mm.s, or a % of the top solid infill speed." + "\nThis can be expressed as a percentage (for example: 80%) over the Top Solid Infill speed." "\nIroning extrusions are ignored from the automatic volumetric speed computation."); def->sidetext = L("mm/s"); def->ratio_over = "top_solid_infill_speed"; def->min = 0.1; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(15, false)); + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); def = this->add("layer_gcode", coString); def->label = L("After layer change G-code"); @@ -2822,16 +2900,19 @@ void PrintConfigDef::init_fff_params() def->is_vector_extruder = true; def->set_default_value(new ConfigOptionFloatsOrPercents{ FloatOrPercent{ 75, true} }); - def = this->add("max_print_speed", coFloat); + def = this->add("max_print_speed", coFloatOrPercent); def->label = L("Max print speed"); + def->full_label = L("Max print speed for Autospeed"); def->category = OptionCategory::speed; def->tooltip = L("When setting other speed settings to 0, Slic3r will autocalculate the optimal speed " "in order to keep constant extruder pressure. This experimental setting is used " - "to set the highest print speed you want to allow."); - def->sidetext = L("mm/s"); + "to set the highest print speed you want to allow." + "\nThis can be expressed as a percentage (for example: 100%) over the machine Max Feedrate for X axis."); + def->sidetext = L("mm/s or %"); + def->ratio_over = "machine_max_acceleration_x"; def->min = 1; def->mode = comExpert; - def->set_default_value(new ConfigOptionFloat(80)); + def->set_default_value(new ConfigOptionFloatOrPercent(80, false)); def = this->add("max_speed_reduction", coPercents); def->label = L("Max speed reduction"); @@ -2848,10 +2929,12 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionPercents{ 90 }); def = this->add("max_volumetric_speed", coFloat); - def->label = L("Max volumetric speed"); + def->label = L("Volumetric speed"); + def->full_label = L("Volumetric speed for Autospeed"); def->category = OptionCategory::extruders; - def->tooltip = L("This experimental setting is used to set the maximum volumetric speed your " - "extruder supports."); + def->tooltip = L("This setting allow you to set the desired flow rate for the autospeed algorithm. It tries to keep a constant feedrate for the entire object." + "\nThe autospeed is only enable on speed field that have a value of 0. If a speed field is a % of a 0 field, then it will be a % of the value it should have got from the autospeed." + "\nIf this field is set to 0, then there is no autospeed. If a speed value i still set to 0, it will get the max speed"); def->sidetext = L("mm³/s"); def->min = 0; def->mode = comExpert; @@ -2997,6 +3080,7 @@ void PrintConfigDef::init_fff_params() def->enum_values.push_back("astrobox"); def->enum_values.push_back("repetier"); def->enum_values.push_back("klipper"); + def->enum_values.push_back("mpmdv2"); def->enum_labels.push_back("PrusaLink"); def->enum_labels.push_back("OctoPrint"); def->enum_labels.push_back("Duet"); @@ -3004,6 +3088,7 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back("AstroBox"); def->enum_labels.push_back("Repetier"); def->enum_labels.push_back("Klipper"); + def->enum_labels.push_back("MPMDv2"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint)); @@ -3075,15 +3160,31 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionString("[input_filename_base].gcode")); + def = this->add("overhangs_acceleration", coFloatOrPercent); + def->label = L("Overhangs"); + def->full_label = L("Overhang acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for overhangs." + "\nCan be a % of the bridge acceleration" + "\nSet zero to to use bridge acceleration for overhangs."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "bridge_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("overhangs_speed", coFloatOrPercent); def->label = L("Overhangs"); def->full_label = L("Overhangs speed"); def->category = OptionCategory::speed; - def->tooltip = L("Speed for printing overhangs.\nCan be a % of the bridge speed."); + def->tooltip = L("Speed for printing overhangs." + "\nCan be a % of the bridge speed." + "\nSet zero to use autospeed for this feature."); def->sidetext = L("mm/s"); def->ratio_over = "bridge_speed"; def->min = 0; - def->mode = comAdvanced; + def->mode = comExpert; def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); def = this->add("overhangs_width_speed", coFloatOrPercent); @@ -3174,17 +3275,17 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(-2.f)); def = this->add("perimeter_acceleration", coFloatOrPercent); - def->label = L("Perimeters"); - def->full_label = L("Perimeter acceleration"); + def->label = L("Internal"); + def->full_label = L("Internal Perimeter acceleration"); def->category = OptionCategory::speed; - def->tooltip = L("This is the acceleration your printer will use for perimeters. " + def->tooltip = L("This is the acceleration your printer will use for internal perimeters. " "\nCan be a % of the default acceleration" - "\nSet zero to disable acceleration control for perimeters."); + "\nSet zero to use default acceleration for internal perimeters."); def->sidetext = L("mm/s² or %"); def->ratio_over = "default_acceleration"; def->min = 0; def->max_literal = { -200, false }; - def->mode = comExpert; + def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); def = this->add("perimeter_round_corners", coBool); @@ -3241,16 +3342,19 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(100, true, false)); - def = this->add("perimeter_speed", coFloat); + def = this->add("perimeter_speed", coFloatOrPercent); def->label = L("Internal"); def->full_label = L("Internal perimeters speed"); def->category = OptionCategory::speed; - def->tooltip = L("Speed for perimeters (contours, aka vertical shells). Set zero for auto."); - def->sidetext = L("mm/s"); + def->tooltip = L("Speed for perimeters (contours, aka vertical shells)." + "\nThis can be expressed as a percentage (for example: 80%) over the Default speed." + "\nSet zero to use autospeed for this feature."); + def->sidetext = L("mm/s or %"); def->aliases = { "perimeter_feed_rate" }; + def->ratio_over = "default_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(60)); + def->set_default_value(new ConfigOptionFloatOrPercent(60, true)); def = this->add("perimeters", coInt); def->label = L("Perimeters"); @@ -3692,14 +3796,13 @@ void PrintConfigDef::init_fff_params() def->label = L("Speed"); def->full_label = L("Small perimeters speed"); def->category = OptionCategory::speed; - def->tooltip = L("This separate setting will affect the speed of perimeters having radius <= 6.5mm " - "(usually holes). If expressed as percentage (for example: 80%) it will be calculated " - "on the perimeters speed setting above. Set zero for auto."); + def->tooltip = L("This separate setting will affect the speed of perimeters having radius <= 6.5mm (usually holes)." + "\nIf expressed as percentage (for example: 80%) it will be calculated on the Internal Perimeters speed setting above. Set zero for auto."); def->sidetext = L("mm/s or %"); def->ratio_over = "perimeter_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(15, false)); + def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); def = this->add("small_perimeter_min_length", coFloatOrPercent); def->label = L("Min length"); @@ -3794,6 +3897,16 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(70)); + def = this->add("solid_infill_overlap", coPercent); + def->label = L("Solid fill overlap"); + def->category = OptionCategory::infill; + def->tooltip = L("Overlap."); + def->sidetext = L("%"); + def->min = 0; + def->max = 100; + def->mode = comExpert; + def->set_default_value(new ConfigOptionPercent(100)); + def = this->add("solid_infill_extruder", coInt); def->label = L("Solid infill extruder"); def->category = OptionCategory::extruders; @@ -3853,14 +3966,14 @@ void PrintConfigDef::init_fff_params() def->full_label = L("Solid infill speed"); def->category = OptionCategory::speed; def->tooltip = L("Speed for printing solid regions (top/bottom/internal horizontal shells). " - "This can be expressed as a percentage (for example: 80%) over the default infill speed." - " Set zero for auto."); + "\nThis can be expressed as a percentage (for example: 80%) over the Default speed." + "\nSet zero to use autospeed for this feature."); def->sidetext = L("mm/s or %"); - def->ratio_over = "infill_speed"; + def->ratio_over = "default_speed"; def->aliases = { "solid_infill_feed_rate" }; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(20, false)); + def->set_default_value(new ConfigOptionFloatOrPercent(30, true)); def = this->add("solid_layers", coInt); def->label = L("Solid layers"); @@ -4004,6 +4117,20 @@ void PrintConfigDef::init_fff_params() "User is responsible for ensuring there is no collision with the print."); def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); + + def = this->add("solid_infill_acceleration", coFloatOrPercent); + def->label = L("Solid "); + def->full_label = L("Solid acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for solid infills. " + "\nCan be a % of the default acceleration" + "\nSet zero to use default acceleration for solid infills."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "default_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); def = this->add("solid_over_perimeters", coInt); def->label = L("No solid infill over"); @@ -4031,6 +4158,20 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("Enable support material generation."); def->set_default_value(new ConfigOptionBool(false)); + def = this->add("support_material_acceleration", coFloatOrPercent); + def->label = L("Default"); + def->full_label = L("Support acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for support material. " + "\nCan be a % of the default acceleration" + "\nSet zero to use default acceleration for support material."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "default_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("support_material_auto", coBool); def->label = L("Auto generated supports"); def->category = OptionCategory::support; @@ -4039,6 +4180,20 @@ void PrintConfigDef::init_fff_params() def->mode = comSimple; def->set_default_value(new ConfigOptionBool(true)); + def = this->add("support_material_interface_acceleration", coFloatOrPercent); + def->label = L("Interface"); + def->full_label = L("Support interface acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for support material interfaces. " + "\nCan be a % of the support material acceleration" + "\nSet zero to use support acceleration for support material interfaces."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "support_material_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("support_material_xy_spacing", coFloatOrPercent); def->label = L("XY separation between an object and its support"); def->category = OptionCategory::support; @@ -4193,13 +4348,14 @@ void PrintConfigDef::init_fff_params() def->label = L("Interface"); def->full_label = L("Support interface speed"); def->category = OptionCategory::support; - def->tooltip = L("Speed for printing support material interface layers. If expressed as percentage " - "(for example 50%) it will be calculated over support material speed."); + def->tooltip = L("Speed for printing support material interface layers." + "\nIf expressed as percentage (for example 50%) it will be calculated over support material speed." + "\nSet zero to use autospeed for this feature."); def->sidetext = L("mm/s or %"); def->ratio_over = "support_material_speed"; def->min = 0; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); def = this->add("support_material_pattern", coEnum); def->label = L("Pattern"); @@ -4248,15 +4404,18 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(2.5)); - def = this->add("support_material_speed", coFloat); + def = this->add("support_material_speed", coFloatOrPercent); def->label = L("Default"); def->full_label = L("Support speed"); def->category = OptionCategory::support; - def->tooltip = L("Speed for printing support material."); - def->sidetext = L("mm/s"); + def->tooltip = L("Speed for printing support material." + "\nThis can be expressed as a percentage (for example: 80%) over the Default speed." + "\nSet zero to use autospeed for this feature."); + def->sidetext = L("mm/s or %"); + def->ratio_over = "default_speed"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(60)); + def->set_default_value(new ConfigOptionFloatOrPercent(60, true)); def = this->add("support_material_synchronize_layers", coBool); def->label = L("Synchronize with object layers"); @@ -4375,15 +4534,32 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionBool(true)); - def = this->add("thin_walls_speed", coFloat); + def = this->add("thin_walls_acceleration", coFloatOrPercent); + def->label = L("Thin Walls"); + def->full_label = L("Thin walls acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for thin walls. " + "\nCan be a % of the external perimeter acceleration" + "\nSet zero to use external perimeter acceleration for thin walls."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "external_perimeter_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + + def = this->add("thin_walls_speed", coFloatOrPercent); def->label = L("Thin walls"); def->full_label = L("Thin walls speed"); def->category = OptionCategory::speed; - def->tooltip = L("Speed for thin walls (external extrusions that are alone because the obect is too thin at these places)."); - def->sidetext = L("mm/s"); + def->tooltip = L("Speed for thin walls (external extrusions that are alone because the obect is too thin at these places)." + "\nThis can be expressed as a percentage (for example: 80%) over the External Perimeter speed." + "\nSet zero to use autospeed for this feature."); + def->sidetext = L("mm/s or %"); + def->ratio_over = "external_perimeter_speed"; def->min = 0; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(30)); + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); def = this->add("threads", coInt); def->label = L("Threads"); @@ -4461,20 +4637,34 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(0, false, true)); + def = this->add("top_solid_infill_acceleration", coFloatOrPercent); + def->label = L("Top solid "); + def->full_label = L("Top solid acceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("This is the acceleration your printer will use for top solid infills. " + "\nCan be a % of the solid infill acceleration" + "\nSet zero to use solid infill acceleration for top solid infills."); + def->sidetext = L("mm/s² or %"); + def->ratio_over = "solid_infill_acceleration"; + def->min = 0; + def->max_literal = { -200, false }; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(0,false)); + def = this->add("top_solid_infill_speed", coFloatOrPercent); def->label = L("Top solid"); def->full_label = L("Top solid speed"); def->category = OptionCategory::speed; def->tooltip = L("Speed for printing top solid layers (it only applies to the uppermost " "external layers and not to their internal solid layers). You may want " - "to slow down this to get a nicer surface finish. This can be expressed " - "as a percentage (for example: 80%) over the solid infill speed above. " - "Set zero for auto."); + "to slow down this to get a nicer surface finish." + "\nThis can be expressed as a percentage (for example: 80%) over the Solid Infill speed." + "\nSet zero to use autospeed for this feature."); def->sidetext = L("mm/s or %"); def->ratio_over = "solid_infill_speed"; def->min = 0; - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(15, false)); + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); def = this->add("top_solid_layers", coInt); //TRN To be shown in Print Settings "Top solid layers" @@ -4503,14 +4693,23 @@ void PrintConfigDef::init_fff_params() def->full_label = L("Travel acceleration"); def->category = OptionCategory::speed; def->tooltip = L("Acceleration for travel moves (jumps between distant extrusion points)." - "\nNote that the deceleration of a travel will use the acceleration value of the extrusion that will be printed after it (if any)"); + "\nCan be a % of the default acceleration" + "\nSet zero to use default acceleration for travel moves."); def->sidetext = L("mm/s² or %"); def->ratio_over = "default_acceleration"; def->min = 0; def->max_literal = { -200, false }; - def->mode = comExpert; + def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatOrPercent(1500, false)); + def = this->add("travel_deceleration_use_target", coBool); + def->label = L("Decelerate with target acceleration"); + def->full_label = L("Use target acceleration for travel deceleration"); + def->category = OptionCategory::speed; + def->tooltip = L("If selected, the deceleration of a travel will use the acceleration value of the extrusion that will be printed after it (if any) "); + def->mode = comExpert; + def->set_default_value(new ConfigOptionBool(true)); + def = this->add("travel_speed", coFloat); def->label = L("Travel"); def->full_label = L("Travel speed"); @@ -4845,6 +5044,16 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0.005)); + def = this->add("init_z_rotate", coFloat); + def->label = L("Preferred orientation"); + def->category = OptionCategory::general; + def->tooltip = L("Rotate stl around z axes while adding them to the bed."); + def->sidetext = L("°"); + def->min = -360; + def->max = 360; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(0.0)); + // Declare retract values for filament profile, overriding the printer's extruder profile. for (const char *opt_key : { // floats @@ -5964,6 +6173,7 @@ void ModelConfig::convert_from_prusa(const DynamicPrintConfig& global_config) { std::unordered_set<std::string> prusa_export_to_remove_keys = { "allow_empty_layers", "avoid_crossing_not_first_layer", +"bridge_internal_acceleration", "bridge_internal_fan_speed", "bridge_overlap", "bridge_overlap_min", @@ -5984,9 +6194,11 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "curve_smoothing_angle_convex", "curve_smoothing_cutoff_dist", "curve_smoothing_precision", +"default_speed", "enforce_full_fill_volume", "exact_last_layer_height", "external_infill_margin", +"external_perimeter_acceleration", "external_perimeter_cut_corners", "external_perimeter_extrusion_spacing", "external_perimeter_fan_speed", @@ -6030,6 +6242,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "first_layer_infill_speed", "first_layer_min_speed", "first_layer_size_compensation_layers", +"gap_fill_acceleration", "gap_fill_infill", "gap_fill_min_area", "gap_fill_overlap", @@ -6044,6 +6257,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "infill_dense_algo", "infill_dense", "infill_extrusion_spacing", +"ironing_acceleration", "lift_min", "machine_max_acceleration_travel", "max_speed_reduction", @@ -6066,6 +6280,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "only_one_perimeter_top", "only_one_perimeter_first_layer", "over_bridge_flow_ratio", +"overhangs_acceleration", "overhangs_reverse_threshold", "overhangs_reverse", "overhangs_speed", @@ -6094,14 +6309,18 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "small_perimeter_max_length", "small_perimeter_min_length", "solid_fill_pattern", +"solid_infill_acceleration", "solid_infill_extrusion_spacing", "start_gcode_manual", +"support_material_acceleration", "support_material_contact_distance_bottom", "support_material_contact_distance_type", +"support_material_interface_acceleration", "support_material_interface_pattern", "support_material_solid_first_layer", "thin_perimeters_all", "thin_perimeters", +"thin_walls_acceleration", "thin_walls_merge", "thin_walls_min_width", "thin_walls_overlap", @@ -6115,7 +6334,9 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "tool_name", "top_fan_speed", "top_infill_extrusion_spacing", +"top_solid_infill_acceleration", "travel_acceleration", +"travel_deceleration_use_target", "travel_speed_z", "wipe_advanced_algo", "wipe_advanced_multiplier", @@ -6156,8 +6377,10 @@ void PrintConfigDef::to_prusa(t_config_option_key& opt_key, std::string& value, } } else if ("elephant_foot_min_width" == opt_key) { opt_key = "elefant_foot_min_width"; - } else if("first_layer_acceleration" == opt_key || "infill_acceleration" == opt_key || "bridge_acceleration" == opt_key || "default_acceleration" == opt_key || "perimeter_acceleration" == opt_key - || "overhangs_speed" == opt_key || "ironing_speed" == opt_key){ + } else if ("first_layer_acceleration" == opt_key || "infill_acceleration" == opt_key || "bridge_acceleration" == opt_key || "default_acceleration" == opt_key || "perimeter_acceleration" == opt_key + || "overhangs_speed" == opt_key || "ironing_speed" == opt_key || "perimeter_speed" == opt_key || "infill_speed" == opt_key || "bridge_speed" == opt_key || "support_material_speed" == opt_key + || "max_print_speed" == opt_key + ) { // remove '%' if (value.find("%") != std::string::npos) { value = std::to_string(all_conf.get_computed_value(opt_key)); @@ -6550,7 +6773,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if (spacing_value == 0) width_option->value = 0; else - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); width_option->percent = spacing_option->percent; something_changed = true; } @@ -6563,7 +6786,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if (spacing_value == 0) width_option->value = 0; else - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); width_option->percent = spacing_option->percent; something_changed = true; } @@ -6577,9 +6800,9 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if(spacing_value == 0) width_option->value = 0; else { - flow.spacing_ratio = std::min(flow.spacing_ratio, float(perimeter_overlap_option->get_abs_value(1))); - flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio; - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + flow.spacing_ratio = std::min(flow.spacing_ratio, float(perimeter_overlap_option->get_abs_value(1))); + flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio; + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); } width_option->percent = spacing_option->percent; something_changed = true; @@ -6595,9 +6818,9 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if (spacing_value == 0) width_option->value = 0; else { - flow.spacing_ratio = std::min(flow.spacing_ratio * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.25) + perimeter_overlap_option->get_abs_value(0.25))); - flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio; - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + flow.spacing_ratio = std::min(flow.spacing_ratio * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.25) + perimeter_overlap_option->get_abs_value(0.25))); + flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio; + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); } width_option->percent = spacing_option->percent; something_changed = true; @@ -6611,7 +6834,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if (spacing_value == 0) width_option->value = 0; else - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); width_option->percent = spacing_option->percent; something_changed = true; } @@ -6624,7 +6847,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if (spacing_value == 0) width_option->value = 0; else - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); width_option->percent = spacing_option->percent; something_changed = true; } @@ -6637,7 +6860,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co if (spacing_value == 0) width_option->value = 0; else - width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); + width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); width_option->percent = spacing_option->percent; something_changed = true; } diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 1c37e9189..faa733bae 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -79,6 +79,7 @@ enum PrintHostType { htAstroBox, htRepetier, htKlipper, + htMPMDv2, }; enum AuthorizationType { @@ -242,6 +243,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<PrintHostType>::g {"astrobox", htAstroBox}, {"repetier", htRepetier}, {"klipper", htKlipper}, + {"mpmdv2", htMPMDv2}, }; return keys_map; } @@ -700,7 +702,7 @@ public: ConfigOptionEnum<SupportMaterialPattern> support_material_pattern; // Spacing between support material lines (the hatching distance). ConfigOptionFloat support_material_spacing; - ConfigOptionFloat support_material_speed; + ConfigOptionFloatOrPercent support_material_speed; ConfigOptionBool support_material_solid_first_layer; ConfigOptionBool support_material_synchronize_layers; // Overhang angle threshold. @@ -791,12 +793,13 @@ public: ConfigOptionPercent bridge_overlap_min; ConfigOptionEnum<InfillPattern> bottom_fill_pattern; ConfigOptionFloatOrPercent bridged_infill_margin; - ConfigOptionFloat bridge_speed; + ConfigOptionFloatOrPercent bridge_speed; ConfigOptionFloatOrPercent bridge_speed_internal; ConfigOptionFloat curve_smoothing_precision; ConfigOptionFloat curve_smoothing_cutoff_dist; ConfigOptionFloat curve_smoothing_angle_convex; ConfigOptionFloat curve_smoothing_angle_concave; + ConfigOptionFloatOrPercent default_speed; ConfigOptionBool ensure_vertical_shell_thickness; ConfigOptionBool enforce_full_fill_volume; ConfigOptionFloatOrPercent external_infill_margin; @@ -824,7 +827,7 @@ public: ConfigOptionBool gap_fill_last; ConfigOptionFloatOrPercent gap_fill_min_area; ConfigOptionPercent gap_fill_overlap; - ConfigOptionFloat gap_fill_speed; + ConfigOptionFloatOrPercent gap_fill_speed; ConfigOptionFloatOrPercent infill_anchor; ConfigOptionFloatOrPercent infill_anchor_max; ConfigOptionBool hole_to_polyhole; @@ -834,7 +837,7 @@ public: ConfigOptionFloatOrPercent infill_extrusion_width; ConfigOptionInt infill_every_layers; ConfigOptionFloatOrPercent infill_overlap; - ConfigOptionFloat infill_speed; + ConfigOptionFloatOrPercent infill_speed; ConfigOptionEnum<InfillConnection> infill_connection; ConfigOptionEnum<InfillConnection> infill_connection_solid; ConfigOptionEnum<InfillConnection> infill_connection_top; @@ -868,7 +871,7 @@ public: ConfigOptionBool perimeter_loop; ConfigOptionEnum<SeamPosition> perimeter_loop_seam; ConfigOptionPercent perimeter_overlap; - ConfigOptionFloat perimeter_speed; + ConfigOptionFloatOrPercent perimeter_speed; // Total number of perimeters. ConfigOptionInt perimeters; ConfigOptionPercent print_extrusion_multiplier; @@ -883,6 +886,7 @@ public: ConfigOptionFloatOrPercent solid_infill_extrusion_width; ConfigOptionInt solid_infill_every_layers; ConfigOptionFloatOrPercent solid_infill_speed; + ConfigOptionPercent solid_infill_overlap; ConfigOptionInt solid_over_perimeters; ConfigOptionInt print_temperature; ConfigOptionBool thin_perimeters; @@ -890,7 +894,7 @@ public: ConfigOptionBool thin_walls; ConfigOptionFloatOrPercent thin_walls_min_width; ConfigOptionFloatOrPercent thin_walls_overlap; - ConfigOptionFloat thin_walls_speed; + ConfigOptionFloatOrPercent thin_walls_speed; ConfigOptionEnum<InfillPattern> top_fill_pattern; ConfigOptionFloatOrPercent top_infill_extrusion_width; ConfigOptionInt top_solid_layers; @@ -916,6 +920,7 @@ protected: OPT_PTR(curve_smoothing_cutoff_dist); OPT_PTR(curve_smoothing_angle_convex); OPT_PTR(curve_smoothing_angle_concave); + OPT_PTR(default_speed); OPT_PTR(ensure_vertical_shell_thickness); OPT_PTR(enforce_full_fill_volume); OPT_PTR(external_infill_margin); @@ -998,6 +1003,7 @@ protected: OPT_PTR(solid_infill_extrusion_width); OPT_PTR(solid_infill_every_layers); OPT_PTR(solid_infill_speed); + OPT_PTR(solid_infill_overlap); OPT_PTR(solid_over_perimeters); OPT_PTR(print_temperature); OPT_PTR(thin_perimeters); @@ -1131,7 +1137,7 @@ public: ConfigOptionString layer_gcode; ConfigOptionString feature_gcode; ConfigOptionFloat max_gcode_per_second; - ConfigOptionFloat max_print_speed; + ConfigOptionFloatOrPercent max_print_speed; ConfigOptionFloat max_volumetric_speed; #ifdef HAS_PRESSURE_EQUALIZER ConfigOptionFloat max_volumetric_extrusion_rate_slope_positive; @@ -1320,6 +1326,7 @@ public: ConfigOptionPoints bed_shape; ConfigOptionInts bed_temperature; ConfigOptionFloatOrPercent bridge_acceleration; + ConfigOptionFloatOrPercent bridge_internal_acceleration; ConfigOptionInts bridge_fan_speed; ConfigOptionInts bridge_internal_fan_speed; ConfigOptionInts chamber_temperature; @@ -1332,6 +1339,7 @@ public: ConfigOptionFloatOrPercent default_acceleration; ConfigOptionInts disable_fan_first_layers; ConfigOptionFloat duplicate_distance; + ConfigOptionFloatOrPercent external_perimeter_acceleration; ConfigOptionInts external_perimeter_fan_speed; ConfigOptionFloat extruder_clearance_height; ConfigOptionFloat extruder_clearance_radius; @@ -1352,7 +1360,9 @@ public: ConfigOptionFloat first_layer_min_speed; ConfigOptionInts first_layer_temperature; ConfigOptionInts full_fan_speed_layer; + ConfigOptionFloatOrPercent gap_fill_acceleration; ConfigOptionFloatOrPercent infill_acceleration; + ConfigOptionFloatOrPercent ironing_acceleration; ConfigOptionFloat lift_min; ConfigOptionInts max_fan_speed; ConfigOptionFloatsOrPercents max_layer_height; @@ -1372,6 +1382,7 @@ public: ConfigOptionBool only_retract_when_crossing_perimeters; ConfigOptionBool ooze_prevention; ConfigOptionString output_filename_format; + ConfigOptionFloatOrPercent overhangs_acceleration; ConfigOptionFloatOrPercent perimeter_acceleration; ConfigOptionStrings post_process; ConfigOptionString print_custom_variables; @@ -1392,8 +1403,12 @@ public: ConfigOptionInt skirts; ConfigOptionInts slowdown_below_layer_time; ConfigOptionBool spiral_vase; + ConfigOptionFloatOrPercent solid_infill_acceleration; ConfigOptionInt standby_temperature_delta; + ConfigOptionFloatOrPercent support_material_acceleration; + ConfigOptionFloatOrPercent support_material_interface_acceleration; ConfigOptionInts temperature; + ConfigOptionFloatOrPercent thin_walls_acceleration; ConfigOptionInt threads; ConfigOptionPoints thumbnails; ConfigOptionString thumbnails_color; @@ -1402,7 +1417,9 @@ public: ConfigOptionBool thumbnails_with_bed; ConfigOptionPercent time_estimation_compensation; ConfigOptionInts top_fan_speed; + ConfigOptionFloatOrPercent top_solid_infill_acceleration; ConfigOptionFloatOrPercent travel_acceleration; + ConfigOptionBool travel_deceleration_use_target; ConfigOptionBools wipe; ConfigOptionBool wipe_tower; ConfigOptionFloatOrPercent wipe_tower_brim; @@ -1415,6 +1432,7 @@ public: ConfigOptionFloats wiping_volumes_matrix; ConfigOptionFloats wiping_volumes_extruders; ConfigOptionFloat z_offset; + ConfigOptionFloat init_z_rotate; protected: PrintConfig(int) : MachineEnvelopeConfig(1), GCodeConfig(1) {} @@ -1429,6 +1447,7 @@ protected: OPT_PTR(bed_shape); OPT_PTR(bed_temperature); OPT_PTR(bridge_acceleration); + OPT_PTR(bridge_internal_acceleration); OPT_PTR(bridge_fan_speed); OPT_PTR(bridge_internal_fan_speed); OPT_PTR(chamber_temperature); @@ -1441,6 +1460,7 @@ protected: OPT_PTR(default_acceleration); OPT_PTR(disable_fan_first_layers); OPT_PTR(duplicate_distance); + OPT_PTR(external_perimeter_acceleration); OPT_PTR(external_perimeter_fan_speed); OPT_PTR(extruder_clearance_height); OPT_PTR(extruder_clearance_radius); @@ -1461,7 +1481,9 @@ protected: OPT_PTR(first_layer_min_speed); OPT_PTR(first_layer_temperature); OPT_PTR(full_fan_speed_layer); + OPT_PTR(gap_fill_acceleration); OPT_PTR(infill_acceleration); + OPT_PTR(ironing_acceleration); OPT_PTR(lift_min); OPT_PTR(max_fan_speed); OPT_PTR(max_layer_height); @@ -1481,6 +1503,7 @@ protected: OPT_PTR(only_retract_when_crossing_perimeters); OPT_PTR(ooze_prevention); OPT_PTR(output_filename_format); + OPT_PTR(overhangs_acceleration); OPT_PTR(perimeter_acceleration); OPT_PTR(post_process); OPT_PTR(print_custom_variables); @@ -1492,6 +1515,7 @@ protected: OPT_PTR(retract_before_travel); OPT_PTR(retract_layer_change); OPT_PTR(seam_gap); + OPT_PTR(solid_infill_acceleration); OPT_PTR(skirt_brim); OPT_PTR(skirt_distance); OPT_PTR(skirt_distance_from_brim); @@ -1502,7 +1526,10 @@ protected: OPT_PTR(slowdown_below_layer_time); OPT_PTR(spiral_vase); OPT_PTR(standby_temperature_delta); + OPT_PTR(support_material_acceleration); + OPT_PTR(support_material_interface_acceleration); OPT_PTR(temperature); + OPT_PTR(thin_walls_acceleration); OPT_PTR(threads); OPT_PTR(thumbnails); OPT_PTR(thumbnails_color); @@ -1511,7 +1538,9 @@ protected: OPT_PTR(thumbnails_with_bed); OPT_PTR(time_estimation_compensation); OPT_PTR(top_fan_speed); + OPT_PTR(top_solid_infill_acceleration); OPT_PTR(travel_acceleration); + OPT_PTR(travel_deceleration_use_target); OPT_PTR(wipe); OPT_PTR(wipe_tower); OPT_PTR(wipe_tower_brim); @@ -1524,6 +1553,7 @@ protected: OPT_PTR(wiping_volumes_matrix); OPT_PTR(wiping_volumes_extruders); OPT_PTR(z_offset); + OPT_PTR(init_z_rotate); } }; @@ -1810,6 +1840,7 @@ public: ConfigOptionBool thumbnails_custom_color; ConfigOptionBool thumbnails_with_bed; ConfigOptionBool thumbnails_with_support; + ConfigOptionFloat z_rotate; protected: void initialize(StaticCacheBase &cache, const char *base_ptr) { @@ -1841,6 +1872,7 @@ protected: OPT_PTR(thumbnails_custom_color); OPT_PTR(thumbnails_with_bed); OPT_PTR(thumbnails_with_support); + OPT_PTR(z_rotate); } }; diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 3beacae68..820171ae1 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -238,6 +238,8 @@ set(SLIC3R_GUI_SOURCES Utils/UndoRedo.hpp Utils/HexFile.cpp Utils/HexFile.hpp + Utils/MPMDv2.cpp + Utils/MPMDv2.hpp ) if (APPLE) diff --git a/src/slic3r/GUI/CalibrationRetractionDialog.cpp b/src/slic3r/GUI/CalibrationRetractionDialog.cpp index 1de3f179c..53d63cf5a 100644 --- a/src/slic3r/GUI/CalibrationRetractionDialog.cpp +++ b/src/slic3r/GUI/CalibrationRetractionDialog.cpp @@ -139,6 +139,10 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { const DynamicPrintConfig* print_config = this->gui_app->get_tab(Preset::TYPE_FFF_PRINT)->get_config(); const DynamicPrintConfig* printer_config = this->gui_app->get_tab(Preset::TYPE_PRINTER)->get_config(); const DynamicPrintConfig* filament_config = this->gui_app->get_tab(Preset::TYPE_FFF_FILAMENT)->get_config(); + DynamicPrintConfig full_print_config; + full_print_config.apply(*print_config); + full_print_config.apply(*printer_config); + full_print_config.apply(*filament_config); double retraction_start = 0; std::string str = temp_start->GetValue().ToStdString(); @@ -208,8 +212,8 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { /// --- custom config --- for (size_t i = 0; i < nb_items; i++) { //speed - double perimeter_speed = print_config->option<ConfigOptionFloat>("perimeter_speed")->value; - double external_perimeter_speed = print_config->option<ConfigOptionFloatOrPercent>("external_perimeter_speed")->get_abs_value(perimeter_speed); + double perimeter_speed = full_print_config.get_computed_value("perimeter_speed"); + double external_perimeter_speed = full_print_config.get_computed_value("external_perimeter_speed"); //brim to have some time to build up pressure in the nozzle model.objects[objs_idx[i]]->config.set_key_value("brim_width", new ConfigOptionFloat(0)); model.objects[objs_idx[i]]->config.set_key_value("perimeters", new ConfigOptionInt(2)); @@ -236,10 +240,10 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) { for (ModelObject* part : part_tower[i]) { model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("print_retract_length", new ConfigOptionFloat(retraction_start + num_part * retraction_steps)); model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false)); - model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("perimeter_speed", new ConfigOptionFloat(std::min(external_perimeter_speed, perimeter_speed))); + model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("perimeter_speed", new ConfigOptionFloatOrPercent(std::min(external_perimeter_speed, perimeter_speed), false)); model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("external_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false)); - model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false)); - //model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("infill_speed", new ConfigOptionFloat(std::min(print_config->option<ConfigOptionFloat>("infill_speed")->value, 10.*scale))); + //model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("small_perimeter_speed", new ConfigOptionFloatOrPercent(external_perimeter_speed, false)); + //model.objects[objs_idx[i]]->volumes[num_part + extra_vol]->config.set_key_value("infill_speed", new ConfigOptionFloatOrPercent(std::min(print_config->option<ConfigOptionFloatOrPercent>("infill_speed")->value, 10.*scale)), false); num_part++; } } diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 0a1f2ae1a..2dabd7dc4 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -408,11 +408,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) for (auto el : { "hole_to_polyhole_threshold", "hole_to_polyhole_twisted" }) toggle_field(el, config->opt_bool("hole_to_polyhole")); - bool have_default_acceleration = config->option<ConfigOptionFloatOrPercent>("default_acceleration")->value > 0; - for (auto el : { "perimeter_acceleration", "infill_acceleration", - "bridge_acceleration", "first_layer_acceleration", "travel_acceleration" }) - toggle_field(el, have_default_acceleration); - bool have_skirt = config->opt_int("skirts") > 0; toggle_field("skirt_height", have_skirt && !config->opt_bool("draft_shield")); toggle_field("skirt_width", have_skirt); @@ -503,6 +498,24 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) for (auto el : { "milling_after_z", "milling_extra_size", "milling_speed" }) toggle_field(el, config->opt_bool("milling_post_process")); + bool have_default_acceleration = config->option<ConfigOptionFloatOrPercent>("default_acceleration")->value > 0; + for (auto el : { "perimeter_acceleration", "external_perimeter_acceleration", "thin_walls_acceleration" }) + toggle_field(el, have_default_acceleration && have_perimeters); + toggle_field("infill_acceleration", have_default_acceleration && have_infill); + toggle_field("solid_infill_acceleration", have_default_acceleration && has_solid_infill); + toggle_field("top_solid_infill_acceleration", have_default_acceleration && has_top_solid_infill); + toggle_field("ironing_acceleration", have_default_acceleration && has_ironing); + toggle_field("support_material_acceleration", have_default_acceleration && (have_support_material || have_brim || have_skirt)); + toggle_field("support_material_interface_acceleration", have_default_acceleration && have_support_material && have_support_interface); + for (auto el : { "bridge_acceleration", "bridge_internal_acceleration", "overhangs_acceleration", "gap_fill_acceleration", "travel_acceleration", "travel_deceleration_use_target", "first_layer_acceleration" }) + toggle_field(el, have_default_acceleration); + + // for default speed, it needs at least a dependent field with a % + toggle_field("default_speed", config->option<ConfigOptionFloatOrPercent>("perimeter_speed")->percent || + config->option<ConfigOptionFloatOrPercent>("solid_infill_speed")->percent || + config->option<ConfigOptionFloatOrPercent>("bridge_speed")->percent || + config->option<ConfigOptionFloatOrPercent>("support_material_speed")->percent); + toggle_field("max_print_speed", config->opt_float("max_volumetric_speed") != 0); } void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 0bc236e43..6854ce05c 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -482,7 +482,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true set_value(double_to_string(val, m_opt.precision), true); } else if (m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)) { bool not_ok = (m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max); - if (!not_ok && m_opt.max_literal.value != 0) { + if (!not_ok && m_opt.max_literal.value != 0 && val != 0) { if (m_opt.max_literal.percent) { const DynamicPrintConfig& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config; const std::vector<double>& nozzle_diameters = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->values; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d28a999ec..3df34db8a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3224,10 +3224,14 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) return; } + auto* app_config = GUI::wxGetApp().app_config; + bool focus_platter_on_mouse = app_config->get("focus_platter_on_mouse") == "1"; if (m_gizmos.on_mouse(evt)) { - if (wxWindow::FindFocus() != this->m_canvas) - // Grab keyboard focus for input in gizmo dialogs. - m_canvas->SetFocus(); + if (focus_platter_on_mouse) { + if (wxWindow::FindFocus() != this->m_canvas) + // Grab keyboard focus for input in gizmo dialogs. + m_canvas->SetFocus(); + } if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) mouse_up_cleanup(); @@ -3262,8 +3266,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) while (p->GetParent()) p = p->GetParent(); auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p); - if (top_level_wnd && top_level_wnd->IsActive()) - m_canvas->SetFocus(); + if (focus_platter_on_mouse) { + if (top_level_wnd && top_level_wnd->IsActive()) + m_canvas->SetFocus(); + } m_mouse.position = pos.cast<double>(); m_tooltip_enabled = false; // 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 387a3e8fb..91be4c917 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -529,6 +529,12 @@ void PhysicalPrinterDialog::update(bool printer_change) if (opt && opt->value == htKlipper) { m_optgroup->hide_field("printhost_apikey"); } + + // hide api key and ca file for MPMDv2 + if (opt && opt->value == htMPMDv2) { + m_optgroup->hide_field("printhost_apikey"); + m_optgroup->hide_field("printhost_cafile"); + } } else { m_optgroup->set_value("host_type", int(PrintHostType::htOctoPrint), false); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f00244f50..256779c4f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2012,24 +2012,29 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) , config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({ // These keys are used by (at least) printconfig::min_object_distance "bed_shape", "bed_custom_texture", "bed_custom_model", + "brim_width", "complete_objects", "complete_objects_sort", "complete_objects_one_skirt", - "complete_objects_one_brim", - "duplicate_distance", "extruder_clearance_radius", - "skirt_extrusion_width", + "complete_objects_one_brim", + "duplicate_distance", + "draft_shield", + "extruder_clearance_radius", "first_layer_extrusion_width", + "init_z_rotate", + "max_print_height", "perimeter_extrusion_width", "extrusion_width", - "skirts", "skirt_brim", "skirt_distance", "skirt_distance_from_brim", "skirt_height", "draft_shield", - "brim_width", "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material", - "wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", - "wipe_tower_brim", - "extruder_colour", "filament_colour", "max_print_height", "printer_model", "printer_technology", + "skirts", "skirt_brim", "skirt_distance", "skirt_distance_from_brim", + "skirt_extrusion_width", "skirt_height", + "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material", + "wipe_tower", "wipe_tower_brim", "wipe_tower_rotation_angle", "wipe_tower_width", "wipe_tower_x", "wipe_tower_y", + "extruder_colour", "filament_colour", + "printer_model", "printer_technology", // These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor. "layer_height", "first_layer_height", "min_layer_height", "max_layer_height", - "brim_width", "perimeters", "perimeter_extruder", "fill_density", "infill_extruder", "top_solid_layers", - "support_material", "support_material_extruder", "support_material_interface_extruder", "support_material_contact_distance", "raft_layers", + "brim_width", "perimeters", "perimeter_extruder", "fill_density", "infill_extruder", "raft_layers", + "support_material", "support_material_extruder", "support_material_interface_extruder", "support_material_contact_distance", "top_solid_layers", "z_step" })) , sidebar(new Sidebar(q)) @@ -2486,9 +2491,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_ } else { model = Slic3r::Model::read_from_file(path.string(), nullptr, nullptr, only_if(load_config, Model::LoadAttribute::CheckVersion)); - for (auto obj : model.objects) - if (obj->name.empty()) + for (auto obj : model.objects) { + if (obj->name.empty()) { obj->name = fs::path(obj->input_file).filename().string(); + } + obj->rotate(Geometry::deg2rad(config->opt_float("init_z_rotate")), Axis::Z); + } } } catch (const ConfigurationError &e) { std::string message = GUI::format(_L("Failed loading file \"%1%\" due to an invalid configuration."), filename.string()) + "\n\n" + e.what(); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index dcbd277f7..25941120a 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -454,6 +454,14 @@ void PreferencesDialog::build() option = Option(def, "suppress_hyperlinks"); m_optgroups_gui.back()->append_single_option_line(option); + def.label = L("Focusing platter on mouse over"); + def.type = coBool; + def.tooltip = L("If disabled, moving the mouse over the platter panel will not change the focus but some shortcuts from the platter may not work. " + "If enabled, moving the mouse over the platter panel will move focus there, and away from the current control."); + def.set_default_value(new ConfigOptionBool{ app_config->get("focus_platter_on_mouse") == "1" }); + option = Option(def, "focus_platter_on_mouse"); + m_optgroups_gui.back()->append_single_option_line(option); + activate_options_tab(m_optgroups_gui.back(), 3); m_optgroups_gui.emplace_back(create_gui_options_group(_L("Appearance"), tabs)); diff --git a/src/slic3r/GUI/PresetHints.cpp b/src/slic3r/GUI/PresetHints.cpp index 11931d155..e46589b97 100644 --- a/src/slic3r/GUI/PresetHints.cpp +++ b/src/slic3r/GUI/PresetHints.cpp @@ -184,22 +184,27 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle float nozzle_diameter = (float)printer_config.opt_float("nozzle_diameter", idx_extruder); // Print config values + DynamicPrintConfig full_print_config; + full_print_config.apply(print_config); + full_print_config.apply(filament_config); + full_print_config.apply(printer_config); + if(full_print_config.option("extruder") == nullptr) full_print_config.set("extruder", 0, true); // hint for first extruder if not present double layer_height = print_config.opt_float("layer_height"); - double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height); - double support_material_speed = print_config.opt_float("support_material_speed"); - double support_material_interface_speed = print_config.get_abs_value("support_material_interface_speed", support_material_speed); - double bridge_speed = print_config.opt_float("bridge_speed"); - double bridge_flow_ratio = print_config.opt_float("bridge_flow_ratio"); - double over_bridge_flow_ratio = print_config.opt_float("over_bridge_flow_ratio"); - double perimeter_speed = print_config.opt_float("perimeter_speed"); - double external_perimeter_speed = print_config.get_abs_value("external_perimeter_speed", perimeter_speed); - // double gap_fill_speed = print_config.opt_float("gap_fill_speed"); - double infill_speed = print_config.opt_float("infill_speed"); - double small_perimeter_speed = print_config.get_abs_value("small_perimeter_speed", perimeter_speed); - double solid_infill_speed = print_config.get_abs_value("solid_infill_speed", infill_speed); - double top_solid_infill_speed = print_config.get_abs_value("top_solid_infill_speed", solid_infill_speed); + double first_layer_height = full_print_config.get_computed_value("first_layer_height"); + double support_material_speed = full_print_config.get_computed_value("support_material_speed"); + double support_material_interface_speed = full_print_config.get_computed_value("support_material_interface_speed"); + double bridge_speed = full_print_config.get_computed_value("bridge_speed"); + double bridge_flow_ratio = full_print_config.get_computed_value("bridge_flow_ratio"); + double over_bridge_flow_ratio = full_print_config.get_computed_value("over_bridge_flow_ratio"); + double perimeter_speed = full_print_config.get_computed_value("perimeter_speed"); + double external_perimeter_speed = full_print_config.get_computed_value("external_perimeter_speed"); + // double gap_fill_speed = full_print_config.get_computed_value("gap_fill_speed"); + double infill_speed = full_print_config.get_computed_value("infill_speed"); + double small_perimeter_speed = full_print_config.get_computed_value("small_perimeter_speed"); + double solid_infill_speed = full_print_config.get_computed_value("solid_infill_speed"); + double top_solid_infill_speed = full_print_config.get_computed_value("top_solid_infill_speed"); // Maximum print speed when auto-speed is enabled by setting any of the above speed values to zero. - double max_print_speed = print_config.opt_float("max_print_speed"); + double max_print_speed = full_print_config.get_computed_value("max_print_speed"); // Maximum volumetric speed allowed for the print profile. double max_volumetric_speed = print_config.opt_float("max_volumetric_speed"); diff --git a/src/slic3r/Utils/MPMDv2.cpp b/src/slic3r/Utils/MPMDv2.cpp new file mode 100644 index 000000000..e6b3c3da3 --- /dev/null +++ b/src/slic3r/Utils/MPMDv2.cpp @@ -0,0 +1,155 @@ +#include "MPMDv2.hpp" + +#include <algorithm> +#include <sstream> +#include <exception> +#include <boost/format.hpp> +#include <boost/log/trivial.hpp> +#include <boost/property_tree/ptree.hpp> +#include <boost/property_tree/json_parser.hpp> +#include <boost/algorithm/string/predicate.hpp> + +#include <wx/progdlg.h> + +#include "slic3r/GUI/I18N.hpp" +#include "slic3r/GUI/GUI.hpp" +#include "Http.hpp" + + +namespace fs = boost::filesystem; +namespace pt = boost::property_tree; + + +namespace Slic3r { + +MPMDv2::MPMDv2(DynamicPrintConfig *config) : + host(config->opt_string("print_host")) +{} + +const char* MPMDv2::get_name() const { return "MPMDv2"; } + +bool MPMDv2::test(wxString &msg) const +{ + // Since the request is performed synchronously here, + // it is ok to refer to `msg` from within the closure + + const char *name = get_name(); + + bool res = true; + auto url = make_url("api/version"); + + BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Get version at: %2%") % name % url; + + auto http = Http::get(std::move(url)); + http.on_error([&](std::string body, std::string error, unsigned status) { + BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; + res = false; + msg = format_error(body, error, status); + }) + .on_complete([&, this](std::string body, unsigned) { + BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got version: %2%") % name % body; + + try { + std::stringstream ss(body); + pt::ptree ptree; + pt::read_json(ss, ptree); + + if (! ptree.get_optional<std::string>("api")) { + res = false; + return; + } + + const auto text = ptree.get_optional<std::string>("text"); + res = validate_version_text(text); + if (! res) { + msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "MiniDeltaLCD")).str()); + } + } + catch (const std::exception &) { + res = false; + msg = "Could not parse server response"; + } + }) + .perform_sync(); + + return res; +} + +bool MPMDv2::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const +{ + const char *name = get_name(); + + const auto upload_filename = upload_data.upload_path.filename(); + const auto upload_parent_path = upload_data.upload_path.parent_path(); + + wxString test_msg; + if (! test(test_msg)) { + error_fn(std::move(test_msg)); + return false; + } + + bool res = true; + + auto url = make_url("api/files/local"); + + BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Uploading file %2% at %3%, filename: %4%, path: %5%, print: %6%") + % name + % upload_data.source_path + % url + % upload_filename.string() + % upload_parent_path.string() + % upload_data.start_print; + + auto http = Http::post(std::move(url)); + http.form_add("path", upload_parent_path.string()) // XXX: slashes on windows ??? + .form_add_file("file", upload_data.source_path.string(), upload_filename.string()) + .form_add("print", upload_data.start_print ? "true" : "false") + .on_complete([&](std::string body, unsigned status) { + BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body; + }) + .on_error([&](std::string body, std::string error, unsigned status) { + BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading file: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; + error_fn(format_error(body, error, status)); + res = false; + }) + .on_progress([&](Http::Progress progress, bool &cancel) { + prorgess_fn(std::move(progress), cancel); + if (cancel) { + // Upload was canceled + BOOST_LOG_TRIVIAL(info) << get_name() << ": Upload canceled"; + res = false; + } + }) + .perform_sync(); + + return res; +} + +bool MPMDv2::validate_version_text(const boost::optional<std::string> &version_text) const +{ + return version_text ? boost::starts_with(*version_text, "MiniDeltaLCD") : true; +} + +wxString MPMDv2::get_test_failed_msg (wxString &msg) const +{ + return GUI::from_u8((boost::format("%s: %s\n\n%s") + % (boost::format(_u8L("Could not connect to %s")) % get_name()) + % std::string(msg.ToUTF8()) + % _u8L("Note: MiniDeltaLCD version at least 1.0 is required.") + ).str()); +} + +std::string MPMDv2::make_url(const std::string &path) const +{ + if (host.find("http://") == 0 || host.find("https://") == 0) { + if (host.back() == '/') { + return (boost::format("%1%%2%") % host % path).str(); + } else { + return (boost::format("%1%/%2%") % host % path).str(); + } + } else { + return (boost::format("http://%1%/%2%") % host % path).str(); + } +} + +} diff --git a/src/slic3r/Utils/MPMDv2.hpp b/src/slic3r/Utils/MPMDv2.hpp new file mode 100644 index 000000000..d103b0ef8 --- /dev/null +++ b/src/slic3r/Utils/MPMDv2.hpp @@ -0,0 +1,45 @@ +#ifndef slic3r_MPMDv2_hpp_ +#define slic3r_MPMDv2_hpp_ + +#include <string> +#include <wx/string.h> +#include <wx/arrstr.h> +#include <boost/optional.hpp> + +#include "PrintHost.hpp" +#include "libslic3r/PrintConfig.hpp" + + +namespace Slic3r { + +class DynamicPrintConfig; +class Http; + +class MPMDv2 : public PrintHost +{ +public: + MPMDv2(DynamicPrintConfig *config); + ~MPMDv2() override = default; + + const char* get_name() const; + + bool test(wxString &curl_msg) const override; + wxString get_test_failed_msg (wxString &msg) const override; + bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const override; + bool has_auto_discovery() const override { return false; } + bool can_test() const override { return true; } + bool can_start_print() const override { return true; } + std::string get_host() const override { return host; } + +protected: + virtual bool validate_version_text(const boost::optional<std::string> &version_text) const; + +private: + std::string host; + + std::string make_url(const std::string &path) const; +}; + +} + +#endif diff --git a/src/slic3r/Utils/PrintHost.cpp b/src/slic3r/Utils/PrintHost.cpp index 52ec8bbfe..4eb6a9a29 100644 --- a/src/slic3r/Utils/PrintHost.cpp +++ b/src/slic3r/Utils/PrintHost.cpp @@ -19,6 +19,7 @@ #include "AstroBox.hpp" #include "Repetier.hpp" #include "Klipper.hpp" +#include "MPMDv2.hpp" #include "../GUI/PrintHostDialogs.hpp" #include "slic3r/GUI/I18N.hpp" @@ -67,6 +68,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config) case htAstroBox: return new AstroBox(config); case htRepetier: return new Repetier(config); case htKlipper: return new Klipper(config); + case htMPMDv2: return new MPMDv2(config); default: return nullptr; } } else { |