diff --git a/docs/HLSD/volumetric-speeds.md b/docs/HLSD/volumetric-speeds.md new file mode 100644 index 0000000000..243154e713 --- /dev/null +++ b/docs/HLSD/volumetric-speeds.md @@ -0,0 +1,106 @@ +# Volumetric speeds — High Level Design + +## Purpose + +A linear speed (mm/s) extrudes a different flow on every line whose cross section +differs: a wide gap fill line, an Arachne wall that widens, a thicker first layer +or an adaptive layer height all push more plastic at the same feed rate. Users who +tune a profile around the hotend's melting capacity think in mm³/s instead. + +Volumetric speeds let a process profile set the speed of each feature as a flow. +Each line is printed at that flow divided by its own cross section, so every line +of a feature extrudes the same flow whatever its width or height. + +## Settings + +`enable_volumetric_speeds` switches every feature at once. It is a global +`PrintConfig` option and is off by default, so existing profiles and projects +slice exactly as before. + +Each feature whose linear speed is an absolute value has a volumetric alternative, +`_volumetric_flow`: first layer, first layer infill, outer and inner +wall, sparse infill, internal solid infill, top surface, gap infill, support, +support interface, and external and internal bridges. Each one is a nullable +per-nozzle-variant vector in the same config class as its linear counterpart, so +the wall, infill, bridge and support flows can be overridden per object like +their speeds. A value is either absolute (mm³/s) or a percentage of the +`filament_max_volumetric_speed` of the filament printing the line. The filament +limit still caps the result, whichever form is used. + +The keys end in `_volumetric_flow` because `outer_wall_volumetric_speed` is +already a custom G-code placeholder that vendor change-filament G-code reads. + +Some speeds have no volumetric alternative and apply over the resolved speeds: + +- Small perimeter, small support perimeter, overhang and scarf joint speeds are + modifiers. A percentage is taken of the resolved feature speed, which is the + same as a percentage of its flow; an absolute value stays in mm/s. +- Ironing extrudes a small fraction of a full line, so a flow target would give + meaningless feed rates. +- Travel speeds and the skirt speed override do not extrude, or override the + feature speed outright. + +## Speed resolution + +`GCode::_extrude` resolves every feature speed through `GCode::feature_speed`, +which returns the linear speed, or with volumetric speeds the configured flow +divided by the path's flow. That flow is `GCode::extrusion_mm3_per_mm`: the +geometric flow times the print, filament and role flow ratios and the mixed-colour +sub-layer ratio. The E values and the filament limit use the same flow, so the +configured flow is the flow the printer extrudes. A path that extrudes nothing, +such as the move inward before an outer wall seam, keeps the linear speed. + +Speeds derived from a feature speed follow it: the first-layer speeds and the +interpolation over the slow-down layers, the overhang reference speeds, small +perimeters (resolved per path in `extrude_loop`), small support perimeters +(from the first path of each support entity) and the skirt and brim, which +`_extrude` prints at the support speed by role. + +Calibration prints set linear speeds, some of them per layer through the +calibration config, so `feature_speed` ignores volumetric speeds whenever +`Print::calib_mode()` is set. The flow rate calibration sets no calibration mode, +so its setup turns the option off in the print preset instead. + +## Max external volumetric speed + +`filament_max_external_volumetric_speed` is a per-variant filament option, 0 by +default, that caps the flow of the visible features below the filament's max +volumetric speed, with or without volumetric speeds. It applies to outer walls, +to what prints at the external bridge speed (bridge infill and overhang walls), +and to top surfaces on a layer where their region is not ironed. + +`GCode::volumetric_speed_limit` returns the flow limit of a path's role, and +`_extrude` uses it everywhere the filament limit used to cap a speed, including +the resonance-avoidance re-cap and the overhang reference speed. Resonance +avoidance moves an outer wall in the upper half of its band up to the band's top; +when the limit keeps the wall below that top, the wall drops to the band's bottom +instead, so the boost never exceeds the limit. Whether a top +surface is ironed follows `Layer::choose_ironing_extruder`, the rule the ironing +generator uses, so an ironed top surface keeps the higher limit. Calibration prints +ignore the option, as they do volumetric speeds. A volumetric speed in percent is +still a share of the filament's max volumetric speed, not of this limit. + +## Outside the G-code generator + +- Fill grouping and perimeter merging: `SurfaceFillParams` compares the + volumetric flow of the infill role next to its linear speed, and + `Layer::is_perimeter_compatible` compares the wall and gap fill flows. Both + compare them whether or not the option is on; that can only keep apart regions + whose volumetric values were overridden per object. +- Wipe towers borrow feature speeds: `WipeTower2` the sparse infill, inner wall and + first layer speeds, `WipeTower` the first layer speed. With volumetric speeds, + `set_layer` derives them from the configured flows and the tower's own line cross + section on that layer. A percentage uses the maximum volumetric speed of the + initial tool, as the linear values use its nozzle. +- The `outer_wall_volumetric_speed` placeholder reports the configured outer wall + flow, capped by the filament limit and the max external volumetric speed. +- Each key invalidates the same steps as its linear counterpart, except the gap + fill flow, which invalidates perimeters because perimeter merging compares it. + +## GUI + +The Speed page opens with a "Speed definition" group holding the switch, and each +volumetric row sits under its linear row (the bridge rows as a pair). +`ConfigManipulation::toggle_print_fff_options` shows exactly one row of each pair +through `toggle_line`, so the choice holds on every page, in the object settings +and in the Object Table, whose Speed category lists both keys of each pair. diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index d2d6bfb0f5..bde6919482 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -296,6 +296,8 @@ struct SurfaceFillParams size_t idx = 0; // Infill speed setting for the effective extrusion role. float role_speed = 0; + // Its volumetric alternative, used with enable_volumetric_speeds. + FloatOrPercent role_volumetric_flow; // Params for lattice infill angles float lateral_lattice_angle_1 = 0.f; @@ -352,6 +354,8 @@ struct SurfaceFillParams RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, bridge); RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, extrusion_role); RETURN_COMPARE_NON_EQUAL(role_speed); + RETURN_COMPARE_NON_EQUAL(role_volumetric_flow.value); + RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, role_volumetric_flow.percent); RETURN_COMPARE_NON_EQUAL(lateral_lattice_angle_1); RETURN_COMPARE_NON_EQUAL(lateral_lattice_angle_2); RETURN_COMPARE_NON_EQUAL(symmetric_infill_y_axis); @@ -388,6 +392,7 @@ struct SurfaceFillParams this->flow == rhs.flow && this->extrusion_role == rhs.extrusion_role && this->role_speed == rhs.role_speed && + this->role_volumetric_flow == rhs.role_volumetric_flow && this->lateral_lattice_angle_1 == rhs.lateral_lattice_angle_1 && this->lateral_lattice_angle_2 == rhs.lateral_lattice_angle_2 && this->infill_lock_depth == rhs.infill_lock_depth && @@ -1073,16 +1078,23 @@ std::vector group_fills(const Layer &layer, LockRegionParam &lock_p layerm.flow(extrusion_role, (surface.thickness == -1) ? layer.height : surface.thickness); params.role_speed = 0; - if (params.extrusion_role == erBridgeInfill) - params.role_speed = region_config.bridge_speed.get_at(layer.get_extruder_id(params.extruder)); - else if (params.extrusion_role == erInternalBridgeInfill) - params.role_speed = region_config.get_abs_value_at("internal_bridge_speed", layer.get_extruder_id(params.extruder)); - else if (params.extrusion_role == erInternalInfill) - params.role_speed = region_config.sparse_infill_speed.get_at(layer.get_extruder_id(params.extruder)); - else if (params.extrusion_role == erTopSolidInfill) - params.role_speed = region_config.top_surface_speed.get_at(layer.get_extruder_id(params.extruder)); - else if (params.extrusion_role == erSolidInfill) - params.role_speed = region_config.internal_solid_infill_speed.get_at(layer.get_extruder_id(params.extruder)); + const size_t role_extruder_id = layer.get_extruder_id(params.extruder); + if (params.extrusion_role == erBridgeInfill) { + params.role_speed = region_config.bridge_speed.get_at(role_extruder_id); + params.role_volumetric_flow = region_config.bridge_volumetric_flow.get_at(role_extruder_id); + } else if (params.extrusion_role == erInternalBridgeInfill) { + params.role_speed = region_config.get_abs_value_at("internal_bridge_speed", role_extruder_id); + params.role_volumetric_flow = region_config.internal_bridge_volumetric_flow.get_at(role_extruder_id); + } else if (params.extrusion_role == erInternalInfill) { + params.role_speed = region_config.sparse_infill_speed.get_at(role_extruder_id); + params.role_volumetric_flow = region_config.sparse_infill_volumetric_flow.get_at(role_extruder_id); + } else if (params.extrusion_role == erTopSolidInfill) { + params.role_speed = region_config.top_surface_speed.get_at(role_extruder_id); + params.role_volumetric_flow = region_config.top_surface_volumetric_flow.get_at(role_extruder_id); + } else if (params.extrusion_role == erSolidInfill) { + params.role_speed = region_config.internal_solid_infill_speed.get_at(role_extruder_id); + params.role_volumetric_flow = region_config.internal_solid_infill_volumetric_flow.get_at(role_extruder_id); + } // Calculate flow spacing for infill pattern generation. if (surface.is_solid() || is_bridge) { params.spacing = params.flow.spacing(); diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 77c9c0a7f2..09890f570f 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -762,6 +762,14 @@ static std::vector get_path_of_change_filament(const Print& print) static float get_outer_wall_volumetric_speed(const FullPrintConfig& config, const Print& print, int filament_id, int filament_variant_idx, int extruder_id) { float outer_wall_volumetric_speed = 0; float filament_max_volumetric_speed = config.filament_max_volumetric_speed.get_at(filament_variant_idx); + const bool calibrating = print.calib_mode() != CalibMode::Calib_None; + // Orca: the outer wall is also limited by the max external volumetric speed. + float max_volumetric_speed = filament_max_volumetric_speed; + if (const float max_external = float(config.filament_max_external_volumetric_speed.get_at(filament_variant_idx)); max_external > 0 && !calibrating) + max_volumetric_speed = std::min(max_volumetric_speed, max_external); + if (config.enable_volumetric_speeds && !calibrating) + return std::min(float(print.default_region_config().outer_wall_volumetric_flow.get_at(extruder_id).get_abs_value(filament_max_volumetric_speed)), + max_volumetric_speed); const double filament_diameter = config.filament_diameter.get_at(filament_id); float outer_wall_line_width = print.default_region_config().get_abs_value("outer_wall_line_width", filament_diameter); if (outer_wall_line_width == 0.0) { @@ -771,8 +779,8 @@ static std::vector get_path_of_change_filament(const Print& print) Flow outer_wall_flow = Flow(outer_wall_line_width, config.layer_height, config.nozzle_diameter.get_at(extruder_id)); float outer_wall_speed = print.default_region_config().outer_wall_speed.get_at(extruder_id); outer_wall_volumetric_speed = outer_wall_speed * outer_wall_flow.mm3_per_mm(); - if (outer_wall_volumetric_speed > filament_max_volumetric_speed) - outer_wall_volumetric_speed = filament_max_volumetric_speed; + if (outer_wall_volumetric_speed > max_volumetric_speed) + outer_wall_volumetric_speed = max_volumetric_speed; return outer_wall_volumetric_speed; } @@ -2174,6 +2182,8 @@ static std::vector get_path_of_change_filament(const Print& print) #define EXTRUDER_CONFIG(OPT) m_config.OPT.get_at(m_writer.filament()->extruder_id()) #define FILAMENT_CONFIG(OPT) m_config.OPT.get_at(get_filament_config_index(m_writer.filament()->id())) #define NOZZLE_CONFIG(OPT) m_config.OPT.get_at(get_nozzle_config_index(m_writer.filament()->id())) +// Speed of FEATURE (FEATURE_speed, or FEATURE_volumetric_flow with volumetric speeds) for a path of the given flow. +#define FEATURE_SPEED(FEATURE, MM3_PER_MM) feature_speed(NOZZLE_CONFIG(FEATURE##_speed), m_config.FEATURE##_volumetric_flow, MM3_PER_MM) void GCode::PlaceholderParserIntegration::reset() { @@ -5979,14 +5989,14 @@ std::string GCode::generate_skirt(const Print &print, path.mm3_per_mm = mm3_per_mm; } - //FIXME using the support_speed of the 1st object printed. + // _extrude() prints skirt paths at the support speed. if (first_layer && i==loops.first) { //set skirt start point location const Point desired_start_point = Skirt::find_start_point(loop, skirt_start_angle); - gcode += this->extrude_loop(loop, "skirt", NOZZLE_CONFIG(support_speed), {}, &desired_start_point); + gcode += this->extrude_loop(loop, "skirt", -1., {}, &desired_start_point); } else - gcode += this->extrude_loop(loop, "skirt", NOZZLE_CONFIG(support_speed)); + gcode += this->extrude_loop(loop, "skirt"); // If we only want a single wall on non-first layers, break now if (!first_layer && print.m_config.single_loop_draft_shield) { @@ -6072,7 +6082,7 @@ std::string GCode::generate_object_brim( m_avoid_crossing_perimeters.use_external_mp(); for (const ExtrusionEntity *ee : by_layer[layer_idx].entities) if (ee != nullptr) - gcode += this->extrude_entity(*ee, "brim", NOZZLE_CONFIG(support_speed)); + gcode += this->extrude_entity(*ee, "brim"); m_avoid_crossing_perimeters.use_external_mp(false); m_avoid_crossing_perimeters.disable_once(); return gcode; @@ -6102,7 +6112,7 @@ std::string GCode::generate_object_brim( m_avoid_crossing_perimeters.use_external_mp(); for (const ExtrusionEntity* ee : brim.entities) if (ee != nullptr) - gcode += this->extrude_entity(*ee, "brim", NOZZLE_CONFIG(support_speed)); + gcode += this->extrude_entity(*ee, "brim"); m_avoid_crossing_perimeters.use_external_mp(false); m_avoid_crossing_perimeters.disable_once(); for (const ObjectInstanceID& instance : instances) @@ -6301,7 +6311,7 @@ std::string GCode::emit_belt_brim_bands(const Print &print, m_avoid_crossing_perimeters.use_external_mp(); for (const ExtrusionEntity *ee : band->fills.entities) if (ee != nullptr) - gcode += this->extrude_entity(*ee, "brim", NOZZLE_CONFIG(support_speed)); + gcode += this->extrude_entity(*ee, "brim"); m_avoid_crossing_perimeters.use_external_mp(false); m_avoid_crossing_perimeters.disable_once(); } @@ -8608,13 +8618,7 @@ std::string GCode::extrude_loop(const ExtrusionLoop& loop_ if (paths.empty()) return ""; // SoftFever: check loop lenght for small perimeter. - double small_peri_speed = -1; - if (speed == -1 && loop.length() <= SMALL_PERIMETER_LENGTH(NOZZLE_CONFIG(small_perimeter_threshold))) { - if(NOZZLE_CONFIG(small_perimeter_speed).value == 0) - small_peri_speed = NOZZLE_CONFIG(outer_wall_speed) * 0.5; - else - small_peri_speed = NOZZLE_CONFIG(small_perimeter_speed).get_abs_value(NOZZLE_CONFIG(outer_wall_speed)); - } + const bool is_small_perimeter = speed == -1 && loop.length() <= SMALL_PERIMETER_LENGTH(NOZZLE_CONFIG(small_perimeter_threshold)); // extrude along the path std::string gcode; @@ -8693,10 +8697,16 @@ std::string GCode::extrude_loop(const ExtrusionLoop& loop_ } - const auto speed_for_path = [&speed, &small_peri_speed](const ExtrusionPath& path) { + const auto speed_for_path = [this, speed, is_small_perimeter](const ExtrusionPath& path) { // don't apply small perimeter setting for overhangs/bridges/non-perimeters - const bool is_small_small_perimeter = small_peri_speed > 0 && !is_bridge(path.role()) && is_perimeter(path.role()); - return is_small_small_perimeter ? small_peri_speed : speed; + if (!is_small_perimeter || is_bridge(path.role()) || !is_perimeter(path.role())) + return speed; + // The outer wall speed depends on the path's flow with volumetric speeds. + const double outer_wall_speed = FEATURE_SPEED(outer_wall, extrusion_mm3_per_mm(path, this->on_first_layer(path_slicing_point(path)))); + const FloatOrPercent &small_perimeter_speed = NOZZLE_CONFIG(small_perimeter_speed); + const double small_peri_speed = small_perimeter_speed.value == 0 ? outer_wall_speed * 0.5 : + small_perimeter_speed.get_abs_value(outer_wall_speed); + return small_peri_speed > 0 ? small_peri_speed : speed; }; @@ -9068,14 +9078,16 @@ std::string GCode::extrude_support(const ExtrusionEntityCollection &support_fill static constexpr const char* support_ironing_label = "support ironing"; // Not static: it captures `this` by reference. - const auto speed_for_path = [&](double length, ExtrusionRole role, double default_speed = -1.0) { + const auto speed_for_path = [&](double length, ExtrusionRole role, const ExtrusionPath *first_path, double default_speed = -1.0) { if (!is_support(role) || length > SMALL_PERIMETER_LENGTH(NOZZLE_CONFIG(small_support_perimeter_threshold))) return default_speed; double small_perimeter_speed = -1.0; + // The support speeds depend on the paths' flow with volumetric speeds. + const double mm3_per_mm = first_path ? extrusion_mm3_per_mm(*first_path, this->on_first_layer(path_slicing_point(*first_path))) : 0.; const auto base_speed = (role == erSupportMaterialInterface) - ? NOZZLE_CONFIG(support_interface_speed) : NOZZLE_CONFIG(support_speed); + ? FEATURE_SPEED(support_interface, mm3_per_mm) : FEATURE_SPEED(support, mm3_per_mm); if (NOZZLE_CONFIG(small_support_perimeter_speed).value == 0) small_perimeter_speed = base_speed * 0.5; @@ -9124,13 +9136,14 @@ std::string GCode::extrude_support(const ExtrusionEntityCollection &support_fill const ExtrusionEntityCollection* collection = dynamic_cast(ee); if (path) { - gcode += extrude_path(*path, label, speed_for_path(path->length(), role)); + gcode += extrude_path(*path, label, speed_for_path(path->length(), role, path)); } else if (multipath) { - gcode += extrude_multi_path(*multipath, label, speed_for_path(multipath->length(), role)); + gcode += extrude_multi_path(*multipath, label, speed_for_path(multipath->length(), role, + multipath->paths.empty() ? nullptr : &multipath->paths.front())); } else if (loop) { - gcode += extrude_loop(*loop, label, speed_for_path(loop->length(), role)); + gcode += extrude_loop(*loop, label, speed_for_path(loop->length(), role, loop->paths.empty() ? nullptr : &loop->paths.front())); } else if (collection) { gcode += extrude_support(*collection, support_extrusion_role); @@ -9275,6 +9288,84 @@ static bool overhang_fan_active(float overlap, int overhang_fan_threshold, Extru return overlap_threshold >= 0.f && overlap <= overlap_threshold; } +Vec3d GCode::path_slicing_point(const ExtrusionPath &path) const +{ + return {unscale(path.first_point().x()), unscale(path.first_point().y()), + m_layer ? m_layer->print_z : (m_belt_brim_z ? *m_belt_brim_z : 0.0)}; +} + +double GCode::extrusion_mm3_per_mm(const ExtrusionPath &path, bool on_first_layer) const +{ + const bool sloped = dynamic_cast(&path) != nullptr; + // Effective flow = Geometric volume * print flow ratio * filament flow ratio * role-based-flow-ratios + double _mm3_per_mm = path.mm3_per_mm * this->config().print_flow_ratio; + _mm3_per_mm *= FILAMENT_CONFIG(filament_flow_ratio); + + if (path.role() == erTopSolidInfill) { + _mm3_per_mm *= NOZZLE_CONFIG(top_solid_infill_flow_ratio); + } else if (path.role() == erBottomSurface) { + _mm3_per_mm *= m_config.bottom_solid_infill_flow_ratio; + } else if (path.role() == erInternalBridgeInfill) { + _mm3_per_mm *= m_config.internal_bridge_flow; + } else if (path.role() == erBrim) { + _mm3_per_mm *= m_config.brim_flow_ratio; + } else if (sloped) { + _mm3_per_mm *= m_config.scarf_joint_flow_ratio; + } + + if (m_config.set_other_flow_ratios) { + if (path.role() == erExternalPerimeter) { + _mm3_per_mm *= m_config.outer_wall_flow_ratio; + } else if (path.role() == erPerimeter) { + _mm3_per_mm *= m_config.inner_wall_flow_ratio; + } else if (path.role() == erOverhangPerimeter) { + _mm3_per_mm *= m_config.overhang_flow_ratio; + } else if (path.role() == erInternalInfill) { + _mm3_per_mm *= m_config.sparse_infill_flow_ratio; + } else if (path.role() == erSolidInfill) { + _mm3_per_mm *= m_config.internal_solid_infill_flow_ratio; + } else if (path.role() == erGapFill) { + _mm3_per_mm *= m_config.gap_fill_flow_ratio; + } else if (path.role() == erSupportMaterial) { // Should this condition also cover erSupportTransition? + _mm3_per_mm *= m_config.support_flow_ratio; + } else if (path.role() == erSupportMaterialInterface) { + _mm3_per_mm *= m_config.support_interface_flow_ratio; + } + + // Additionally, adjust the value if we are on the first layer (except for brims and skirts) + if (on_first_layer && (path.role() != erBrim && path.role() != erSkirt)) { + _mm3_per_mm *= m_config.first_layer_flow_ratio; + } + } + + // Mixed-color sublayer: scale the flow down to the sub-layer's share of the layer height. + if (m_sub_layer_flow_ratio > 0.0) + _mm3_per_mm *= m_sub_layer_flow_ratio; + return _mm3_per_mm; +} + +double GCode::feature_speed(double speed, const ConfigOptionFloatsOrPercentsNullable &volumetric_flow, double mm3_per_mm) const +{ + // Orca: calibrations set linear speeds, and a path that extrudes nothing has no flow to divide by. + if (!m_config.enable_volumetric_speeds || m_print->calib_mode() != CalibMode::Calib_None || mm3_per_mm <= 0.) + return speed; + const double max_volumetric_speed = FILAMENT_CONFIG(filament_max_volumetric_speed); + return volumetric_flow.get_at(get_nozzle_config_index(m_writer.filament()->id())).get_abs_value(max_volumetric_speed) / mm3_per_mm; +} + +double GCode::volumetric_speed_limit(ExtrusionRole role) const +{ + const double max_volumetric_speed = FILAMENT_CONFIG(filament_max_volumetric_speed); + const double max_external_volumetric_speed = FILAMENT_CONFIG(filament_max_external_volumetric_speed); + // Orca: visible features are outer walls, what prints at the external bridge speed, and top surfaces this layer does not iron. + const bool visible = role == erExternalPerimeter || role == erOverhangPerimeter || role == erBridgeInfill || + (role == erTopSolidInfill && m_layer != nullptr && + Layer::choose_ironing_extruder(m_config, m_config.spiral_mode.value, m_layer->upper_layer == nullptr) < 0); + if (max_external_volumetric_speed <= 0. || !visible || m_print->calib_mode() != CalibMode::Calib_None) + return max_volumetric_speed; + return max_volumetric_speed > 0. ? std::min(max_volumetric_speed, max_external_volumetric_speed) : max_external_volumetric_speed; +} + std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_description, double speed) { std::vector> uncut_line_lengths; @@ -9370,11 +9461,7 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & // evaluator is inactive (non-belt printers, or belt printers without // a Z-axis shear) `path_on_first_layer` falls back to the legacy // layer-id check, so behavior is bit-identical to the pre-feature path. - const Vec3d path_point_mm{ - unscale(path.first_point().x()), - unscale(path.first_point().y()), - m_layer ? m_layer->print_z : (m_belt_brim_z ? *m_belt_brim_z : 0.0) - }; + const Vec3d path_point_mm = path_slicing_point(path); bool path_on_first_layer = this->on_first_layer(path_point_mm); // On a belt a path is judged by how high above the belt all of it is: it is on the first // layer when all of it is, and takes the slow_down_layers step of its middle. A piece cut @@ -9526,56 +9613,10 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & } // calculate effective extrusion length per distance unit (e_per_mm) - double filament_flow_ratio = FILAMENT_CONFIG(filament_flow_ratio); - // We set _mm3_per_mm to effectove flow = Geometric volume * print flow ratio * filament flow ratio * role-based-flow-ratios - auto _mm3_per_mm = path.mm3_per_mm * this->config().print_flow_ratio; - _mm3_per_mm *= filament_flow_ratio; + const double _mm3_per_mm = extrusion_mm3_per_mm(path, path_on_first_layer); - if (path.role() == erTopSolidInfill) { - _mm3_per_mm *= NOZZLE_CONFIG(top_solid_infill_flow_ratio); - } else if (path.role() == erBottomSurface) { - _mm3_per_mm *= m_config.bottom_solid_infill_flow_ratio; - } else if (path.role() == erInternalBridgeInfill) { - _mm3_per_mm *= m_config.internal_bridge_flow; - } else if (path.role() == erBrim) { - _mm3_per_mm *= m_config.brim_flow_ratio; - } else if (sloped) { - _mm3_per_mm *= m_config.scarf_joint_flow_ratio; - } - - if (m_config.set_other_flow_ratios) { - if (path.role() == erExternalPerimeter) { - _mm3_per_mm *= m_config.outer_wall_flow_ratio; - } else if (path.role() == erPerimeter) { - _mm3_per_mm *= m_config.inner_wall_flow_ratio; - } else if (path.role() == erOverhangPerimeter) { - _mm3_per_mm *= m_config.overhang_flow_ratio; - } else if (path.role() == erInternalInfill) { - _mm3_per_mm *= m_config.sparse_infill_flow_ratio; - } else if (path.role() == erSolidInfill) { - _mm3_per_mm *= m_config.internal_solid_infill_flow_ratio; - } else if (path.role() == erGapFill) { - _mm3_per_mm *= m_config.gap_fill_flow_ratio; - } else if (path.role() == erSupportMaterial) { // Should this condition also cover erSupportTransition? - _mm3_per_mm *= m_config.support_flow_ratio; - } else if (path.role() == erSupportMaterialInterface) { - _mm3_per_mm *= m_config.support_interface_flow_ratio; - } - - // Additionally, adjust the value if we are on the first layer (except for brims and skirts) - if (path_on_first_layer && (path.role() != erBrim && path.role() != erSkirt)) { - _mm3_per_mm *= m_config.first_layer_flow_ratio; - } - } - - // Mixed-color sublayer: this path belongs to one sub-layer of a split layer, so scale the - // flow down to that sub-layer's share of the nominal layer height and report the sub-height - // as the effective extrusion height. Inert (ratio == 0) outside the sublayer emission block. - float effective_height = path.height; - if (m_sub_layer_flow_ratio > 0.0) { - _mm3_per_mm *= m_sub_layer_flow_ratio; - effective_height = static_cast(m_sub_layer_height); - } + // Mixed-color sublayer: report the sub-layer height as the effective extrusion height. + const float effective_height = m_sub_layer_flow_ratio > 0.0 ? static_cast(m_sub_layer_height) : path.height; // _mm3_per_mm already includes the filament flow ratio, so convert it with the bare cross-section // rather than e_per_mm3(), which would apply the ratio a second time. @@ -9584,38 +9625,40 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & // set speed if (speed == -1) { if (path.role() == erPerimeter) { - speed = NOZZLE_CONFIG(inner_wall_speed); + speed = FEATURE_SPEED(inner_wall, _mm3_per_mm); if (sloped) { speed = std::min(speed, m_config.scarf_joint_speed.get_abs_value(speed)); } } else if (path.role() == erExternalPerimeter) { - speed = NOZZLE_CONFIG(outer_wall_speed); + speed = FEATURE_SPEED(outer_wall, _mm3_per_mm); if (sloped) { speed = std::min(speed, m_config.scarf_joint_speed.get_abs_value(speed)); } } else if(path.role() == erInternalBridgeInfill) { - speed = m_config.internal_bridge_speed.get_at(nozzle).get_abs_value(m_config.bridge_speed.get_at(nozzle)); + speed = feature_speed(m_config.internal_bridge_speed.get_at(nozzle).get_abs_value(m_config.bridge_speed.get_at(nozzle)), + m_config.internal_bridge_volumetric_flow, _mm3_per_mm); } else if (path.role() == erOverhangPerimeter || path.role() == erSupportTransition || path.role() == erBridgeInfill) { - speed = NOZZLE_CONFIG(bridge_speed); + speed = FEATURE_SPEED(bridge, _mm3_per_mm); } else if (path.role() == erInternalInfill) { - speed = NOZZLE_CONFIG(sparse_infill_speed); + speed = FEATURE_SPEED(sparse_infill, _mm3_per_mm); } else if (path.role() == erSolidInfill) { - speed = NOZZLE_CONFIG(internal_solid_infill_speed); + speed = FEATURE_SPEED(internal_solid_infill, _mm3_per_mm); } else if (path.role() == erTopSolidInfill) { - speed = NOZZLE_CONFIG(top_surface_speed); + speed = FEATURE_SPEED(top_surface, _mm3_per_mm); } else if (path.role() == erIroning) { const size_t filament_idx = get_filament_config_index(m_writer.filament()->id()); speed = m_config.filament_ironing_speed.is_nil(filament_idx) ? m_config.ironing_speed.value : m_config.filament_ironing_speed.get_at(filament_idx); } else if (path.role() == erBottomSurface) { - speed = NOZZLE_CONFIG(initial_layer_infill_speed); + speed = FEATURE_SPEED(initial_layer_infill, _mm3_per_mm); } else if (path.role() == erGapFill) { - speed = NOZZLE_CONFIG(gap_infill_speed); - } else if (path.role() == erSupportMaterial) { - speed = NOZZLE_CONFIG(support_speed); + speed = FEATURE_SPEED(gap_infill, _mm3_per_mm); + } else if (path.role() == erSupportMaterial || path.role() == erSkirt || path.role() == erBrim) { + //FIXME skirt and brim use the support speed of the 1st object printed. + speed = FEATURE_SPEED(support, _mm3_per_mm); } else if (path.role() == erSupportMaterialInterface) { - speed = NOZZLE_CONFIG(support_interface_speed); + speed = FEATURE_SPEED(support_interface, _mm3_per_mm); } else { throw Slic3r::InvalidArgument("Invalid speed"); } @@ -9654,15 +9697,15 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & //wall lines have be attached if (path.role() != erBottomSurface) { const bool use_first_layer_speed = is_perimeter(path.role()) || path.role() == erBrim; - speed = use_first_layer_speed ? NOZZLE_CONFIG(initial_layer_speed) : - NOZZLE_CONFIG(initial_layer_infill_speed); + speed = use_first_layer_speed ? FEATURE_SPEED(initial_layer, _mm3_per_mm) : + FEATURE_SPEED(initial_layer_infill, _mm3_per_mm); } } else if (m_config.slow_down_layers > 1 && m_config.raft_layers == 0) { if (_layer > 0 && _layer < m_config.slow_down_layers) { const auto first_layer_speed = is_perimeter(path.role()) - ? NOZZLE_CONFIG(initial_layer_speed) - : NOZZLE_CONFIG(initial_layer_infill_speed); + ? FEATURE_SPEED(initial_layer, _mm3_per_mm) + : FEATURE_SPEED(initial_layer_infill, _mm3_per_mm); if (first_layer_speed < speed) { speed = std::min( speed, @@ -9674,8 +9717,8 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & if (_layer > m_config.raft_layers && (_layer - m_config.raft_layers) < m_config.slow_down_layers) { const auto first_layer_speed - = is_perimeter(path.role()) ? NOZZLE_CONFIG(initial_layer_speed) : - NOZZLE_CONFIG(initial_layer_infill_speed); + = is_perimeter(path.role()) ? FEATURE_SPEED(initial_layer, _mm3_per_mm) : + FEATURE_SPEED(initial_layer_infill, _mm3_per_mm); if (first_layer_speed < speed) { speed = std::min(speed, Slic3r::lerp(first_layer_speed, speed, (double) (_layer - m_config.raft_layers) / m_config.slow_down_layers)); @@ -9698,9 +9741,10 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & // m_config.max_volumetric_speed.value / _mm3_per_mm // ); //} - if (FILAMENT_CONFIG(filament_max_volumetric_speed) > 0) { + const double max_volumetric_speed = volumetric_speed_limit(path.role()); + if (max_volumetric_speed > 0) { // cap speed with max_volumetric_speed anyway (even if user is not using autospeed) - speed = std::min(speed, FILAMENT_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm); + speed = std::min(speed, max_volumetric_speed / _mm3_per_mm); } // ORCA: resonance‑avoidance on short external perimeters { @@ -9714,10 +9758,10 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & } // re‑apply volumetric cap - if (FILAMENT_CONFIG(filament_max_volumetric_speed) > 0) { + if (max_volumetric_speed > 0) { speed = std::min( speed, - FILAMENT_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm + max_volumetric_speed / _mm3_per_mm ); } @@ -9725,7 +9769,10 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & // - speeds in lower half of range: clamp down to "min" // - speeds in upper half of range: boost up to "max" if (m_resonance_avoidance && speed < m_config.max_resonance_avoidance_speed.value) { - if (speed < m_config.min_resonance_avoidance_speed.value + + // ORCA: a wall the volumetric limit keeps below "max" cannot be boosted, so it clamps down to "min". + const bool can_boost = max_volumetric_speed <= 0 || + m_config.max_resonance_avoidance_speed.value <= max_volumetric_speed / _mm3_per_mm; + if (!can_boost || speed < m_config.min_resonance_avoidance_speed.value + ((m_config.max_resonance_avoidance_speed.value - m_config.min_resonance_avoidance_speed.value) / 2)) { speed = std::min(speed, m_config.min_resonance_avoidance_speed.value); } else { @@ -9750,12 +9797,12 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & if (need_overhang_detection && !path_on_first_layer && !object_layer_over_raft() && (is_bridge(path.role()) || is_perimeter(path.role()))) { bool is_external = is_external_perimeter(path.role()); - double ref_speed = is_external ? NOZZLE_CONFIG(outer_wall_speed) : NOZZLE_CONFIG(inner_wall_speed); + double ref_speed = is_external ? FEATURE_SPEED(outer_wall, _mm3_per_mm) : FEATURE_SPEED(inner_wall, _mm3_per_mm); if (ref_speed == 0) - ref_speed = FILAMENT_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm; + ref_speed = max_volumetric_speed / _mm3_per_mm; - if (FILAMENT_CONFIG(filament_max_volumetric_speed) > 0) { - ref_speed = std::min(ref_speed, FILAMENT_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm); + if (max_volumetric_speed > 0) { + ref_speed = std::min(ref_speed, max_volumetric_speed / _mm3_per_mm); } if (sloped) { ref_speed = std::min(ref_speed, m_config.scarf_joint_speed.get_abs_value(ref_speed)); @@ -9772,7 +9819,7 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & if (NOZZLE_CONFIG(slowdown_for_curled_perimeters)){ const FloatOrPercent fully_unsupported_speed = path.role() == erBridgeInfill ? - FloatOrPercent{NOZZLE_CONFIG(bridge_speed) * 100 / ref_speed, true} : + FloatOrPercent{FEATURE_SPEED(bridge, _mm3_per_mm) * 100 / ref_speed, true} : (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5 ? FloatOrPercent{100, true} : FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}); @@ -9810,7 +9857,7 @@ std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string & (NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ? FloatOrPercent{100, true} : FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}, - FloatOrPercent{NOZZLE_CONFIG(bridge_speed) * 100 / ref_speed, true}}); + FloatOrPercent{FEATURE_SPEED(bridge, _mm3_per_mm) * 100 / ref_speed, true}}); new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, ref_speed, speed, NOZZLE_CONFIG(slowdown_for_curled_perimeters), diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 07902dbdc2..316b18e6e2 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -987,6 +987,14 @@ protected: ExtrusionPaths belt_cut_at_band_edges(const ExtrusionPath &path, std::vector> &uncut_line_lengths) const; // _extrude() of a path that stays in one band above the belt (see belt_cut_at_band_edges()). std::string _extrude_piece(const ExtrusionPath &path, const std::string &path_description, double speed); + // First point of the path in the slicing frame, for the per-point first-layer test. + Vec3d path_slicing_point(const ExtrusionPath &path) const; + // Flow in mm³ per mm the path is extruded with, after the flow ratios (the first layer's when `on_first_layer`). + double extrusion_mm3_per_mm(const ExtrusionPath &path, bool on_first_layer) const; + // Feed rate of a feature: its linear `speed`, or with volumetric speeds its flow divided by `mm3_per_mm`. + double feature_speed(double speed, const ConfigOptionFloatsOrPercentsNullable &volumetric_flow, double mm3_per_mm) const; + // Max flow in mm³/s of a path with this role, 0 for no limit. + double volumetric_speed_limit(ExtrusionRole role) const; bool _needSAFC(const ExtrusionPath &path); void print_machine_envelope(GCodeOutputStream& file, Print& print); void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 184ecf8cec..badd6dd42b 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -2033,6 +2033,9 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi m_first_layer_speed = config.initial_layer_speed.get_at(get_extruder_index(config, (unsigned int) initial_tool)); if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it. m_first_layer_speed = default_speed / 2.f; + if (config.enable_volumetric_speeds) + m_first_layer_volumetric_flow = float(config.initial_layer_volumetric_flow.get_at(get_extruder_index(config, (unsigned int) initial_tool)) + .get_abs_value(config.filament_max_volumetric_speed.get_at(initial_tool))); // If this is a single extruder MM printer, we will use all the SE-specific config values. // Otherwise, the defaults will be used to turn off the SE stuff. diff --git a/src/libslic3r/GCode/WipeTower.hpp b/src/libslic3r/GCode/WipeTower.hpp index dd000737c7..7b1aaed45e 100644 --- a/src/libslic3r/GCode/WipeTower.hpp +++ b/src/libslic3r/GCode/WipeTower.hpp @@ -304,6 +304,9 @@ public: // Calculate extrusion flow from desired line width, nozzle diameter, filament diameter and layer_height: m_extrusion_flow = extrusion_flow(layer_height); + // Orca: with volumetric speeds, the first layer speed is its flow divided by the line cross section. + if (m_first_layer_volumetric_flow > 0.f) + m_first_layer_speed = m_first_layer_volumetric_flow / (m_extrusion_flow * filament_area()); // Advance m_layer_info iterator, making sure we got it right while (!m_plan.empty() && m_layer_info->z < print_z - WT_EPSILON && m_layer_info+1 != m_plan.end()) ++m_layer_info; @@ -509,6 +512,8 @@ private: int m_old_temperature = -1; // To keep track of what was the last temp that we set (so we don't issue the command when not neccessary) float m_travel_speed = 0.f; float m_first_layer_speed = 0.f; + // Volumetric flow (mm³/s) set_layer() derives m_first_layer_speed from, 0 without volumetric speeds. + float m_first_layer_volumetric_flow = 0.f; size_t m_first_layer_idx = size_t(-1); Vec2f m_origin; std::vector m_last_layer_id; diff --git a/src/libslic3r/GCode/WipeTower2.cpp b/src/libslic3r/GCode/WipeTower2.cpp index ccd3d78e92..c34a5e2699 100644 --- a/src/libslic3r/GCode/WipeTower2.cpp +++ b/src/libslic3r/GCode/WipeTower2.cpp @@ -1086,6 +1086,14 @@ WipeTower2::WipeTower2(const PrintConfig& config, const PrintRegionConfig& defau if (m_perimeter_speed == 0.f) m_perimeter_speed = 80.f; + if (config.enable_volumetric_speeds) { + const size_t extruder_idx = get_extruder_index(config, (unsigned int)initial_tool); + const double max_volumetric_speed = config.filament_max_volumetric_speed.get_at(initial_tool); + m_infill_volumetric_flow = float(default_region_config.sparse_infill_volumetric_flow.get_at(extruder_idx).get_abs_value(max_volumetric_speed)); + m_perimeter_volumetric_flow = float(default_region_config.inner_wall_volumetric_flow.get_at(extruder_idx).get_abs_value(max_volumetric_speed)); + m_first_layer_volumetric_flow = float(config.initial_layer_volumetric_flow.get_at(extruder_idx).get_abs_value(max_volumetric_speed)); + } + // If this is a single extruder MM printer, we will use all the SE-specific config values. // Otherwise, the defaults will be used to turn off the SE stuff. diff --git a/src/libslic3r/GCode/WipeTower2.hpp b/src/libslic3r/GCode/WipeTower2.hpp index 4ca320c329..5fbb2153c7 100644 --- a/src/libslic3r/GCode/WipeTower2.hpp +++ b/src/libslic3r/GCode/WipeTower2.hpp @@ -136,6 +136,15 @@ public: // Calculate extrusion flow from desired line width, nozzle diameter, filament diameter and layer_height: m_extrusion_flow = extrusion_flow(layer_height); + + // Orca: with volumetric speeds, a speed is its flow divided by this layer's line cross section. + const float mm3_per_mm = m_extrusion_flow * filament_area(); + if (m_infill_volumetric_flow > 0.f) + m_infill_speed = m_infill_volumetric_flow / mm3_per_mm; + if (m_perimeter_volumetric_flow > 0.f) + m_perimeter_speed = m_perimeter_volumetric_flow / mm3_per_mm; + if (m_first_layer_volumetric_flow > 0.f) + m_first_layer_speed = m_first_layer_volumetric_flow / mm3_per_mm; } // Return the wipe tower position. @@ -248,6 +257,10 @@ private: float m_wipe_tower_max_purge_speed = 90.f; float m_perimeter_speed = 0.f; float m_first_layer_speed = 0.f; + // Volumetric flows (mm³/s) set_layer() derives the speeds above from, 0 without volumetric speeds. + float m_infill_volumetric_flow = 0.f; + float m_perimeter_volumetric_flow = 0.f; + float m_first_layer_volumetric_flow = 0.f; size_t m_first_layer_idx = size_t(-1); bool m_enable_tower_interface_features = false; bool m_enable_tower_interface_cooldown_during_tower = false; diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index c58a1b1a7b..f3d4be36b7 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -174,6 +174,9 @@ bool Layer::is_perimeter_compatible(const Print& print, const PrintRegion& a, co && config.small_perimeter_speed.get_at(print.get_extruder_id(config.outer_wall_filament_id)) == other_config.small_perimeter_speed.get_at(print.get_extruder_id(config.outer_wall_filament_id)) && config.small_support_perimeter_speed.get_at(print.get_extruder_id(config.outer_wall_filament_id)) == other_config.small_support_perimeter_speed.get_at(print.get_extruder_id(config.outer_wall_filament_id)) && config.gap_infill_speed.get_at(print.get_extruder_id(config.outer_wall_filament_id)) == other_config.gap_infill_speed.get_at(print.get_extruder_id(config.outer_wall_filament_id)) + && config.inner_wall_volumetric_flow.get_at(print.get_extruder_id(config.outer_wall_filament_id)) == other_config.inner_wall_volumetric_flow.get_at(print.get_extruder_id(config.outer_wall_filament_id)) + && config.outer_wall_volumetric_flow.get_at(print.get_extruder_id(config.outer_wall_filament_id)) == other_config.outer_wall_volumetric_flow.get_at(print.get_extruder_id(config.outer_wall_filament_id)) + && config.gap_infill_volumetric_flow.get_at(print.get_extruder_id(config.outer_wall_filament_id)) == other_config.gap_infill_volumetric_flow.get_at(print.get_extruder_id(config.outer_wall_filament_id)) && config.filter_out_gap_fill.value == other_config.filter_out_gap_fill.value && config.detect_overhang_wall == other_config.detect_overhang_wall && config.unsupported_wall_last == other_config.unsupported_wall_last diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c16497001b..ac5143dabf 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1381,6 +1381,19 @@ static std::vector s_Preset_print_options{ "overhang_3_4_speed", "overhang_4_4_speed", "initial_layer_infill_speed", + "enable_volumetric_speeds", + "initial_layer_volumetric_flow", + "initial_layer_infill_volumetric_flow", + "outer_wall_volumetric_flow", + "inner_wall_volumetric_flow", + "sparse_infill_volumetric_flow", + "internal_solid_infill_volumetric_flow", + "top_surface_volumetric_flow", + "gap_infill_volumetric_flow", + "support_volumetric_flow", + "support_interface_volumetric_flow", + "bridge_volumetric_flow", + "internal_bridge_volumetric_flow", "only_one_wall_top", "timelapse_type", "wall_generator", @@ -1524,7 +1537,7 @@ static std::vector s_Preset_print_options{ static std::vector s_Preset_filament_options {/*"filament_colour", */ "default_filament_colour", "required_nozzle_HRC", "filament_diameter", "pellet_flow_coefficient", "volumetric_speed_coefficients", "filament_type", "filament_soluble", "filament_is_support", "filament_printable", "filament_extruder_compatibility", - "filament_max_volumetric_speed", "filament_adaptive_volumetric_speed", + "filament_max_volumetric_speed", "filament_max_external_volumetric_speed", "filament_adaptive_volumetric_speed", "filament_flow_ratio", "filament_density", "filament_adhesiveness_category", "filament_cost", "filament_minimal_purge_on_wipe_tower", "filament_tower_interface_pre_extrusion_dist", "filament_tower_interface_pre_extrusion_length", "filament_tower_ironing_area", "filament_tower_interface_purge_volume", "filament_tower_interface_print_temp", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 22f74f3ccf..dec0ed3072 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -308,6 +308,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "nozzle_height", "extruder_colour", "filament_flow_ratio", + "filament_max_external_volumetric_speed", "reduce_fan_stop_start_freq", "dont_slow_down_outer_wall", "fan_cooling_layer_time", @@ -579,6 +580,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "travel_speed" || opt_key == "travel_speed_z" || opt_key == "initial_layer_speed" + || opt_key == "enable_volumetric_speeds" + || opt_key == "initial_layer_volumetric_flow" + || opt_key == "initial_layer_infill_volumetric_flow" || opt_key == "initial_layer_travel_speed" || opt_key == "initial_layer_travel_acceleration" || opt_key == "initial_layer_travel_jerk" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index d9c2ca9ac6..01729fa5ae 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2046,7 +2046,7 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("Speed of the externally visible bridge extrusions.\n\n" "In addition, if Slow down for curled perimeters is disabled, " "it will be the print speed of overhang walls that are supported by less than 13%, " - "whether they are part of a bridge or an overhang."); + "whether they are part of a bridge or an overhang.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\" and \"Max external volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -2056,7 +2056,7 @@ void PrintConfigDef::init_fff_params() def = this->add("internal_bridge_speed", coFloatsOrPercents); def->label = L("Internal"); def->category = L("Speed"); - def->tooltip = L("Speed of internal bridges. If the value is expressed as a percentage, it will be calculated based on the bridge_speed. Default value is 150%."); + def->tooltip = L("Speed of internal bridges. If the value is expressed as a percentage, it will be calculated based on the bridge_speed. Default value is 150%.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s or %"); def->ratio_over = "bridge_speed"; def->min = 1; @@ -2702,7 +2702,7 @@ void PrintConfigDef::init_fff_params() def = this->add("outer_wall_speed", coFloats); def->label = L("Outer wall"); def->category = L("Speed"); - def->tooltip = L("This is the printing speed for the outer walls of parts. These are generally printed slower than inner walls for higher quality."); + def->tooltip = L("This is the printing speed for the outer walls of parts. These are generally printed slower than inner walls for higher quality.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\" and \"Max external volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -2714,7 +2714,7 @@ void PrintConfigDef::init_fff_params() def->category = L("Speed"); def->tooltip = L("This separate setting will affect the speed of perimeters having radius <= small_perimeter_threshold " "(usually holes). If expressed as percentage (for example: 80%) it will be calculated " - "on the outer wall speed setting above."); + "on the outer wall speed setting above.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\" and, on outer walls, \"Max external volumetric speed\"."); def->sidetext = L("mm/s or %"); def->ratio_over = "outer_wall_speed"; def->min = 1; @@ -2737,7 +2737,7 @@ void PrintConfigDef::init_fff_params() def->category = L("Speed"); def->tooltip = L("Same as \"Small perimeters\", but for supports. " "This separate setting will affect the speed of support for areas <= `small_support_perimeter_threshold`. " - "If expressed as a percentage (for example: 80%), it will be calculated on the support or support interface speed setting above."); + "If expressed as a percentage (for example: 80%), it will be calculated on the support or support interface speed setting above.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s or %"); def->ratio_over = "support_speed"; def->min = 1; @@ -2753,6 +2753,168 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatsNullable{0}); + def = this->add("enable_volumetric_speeds", coBool); + def->label = L("Volumetric speeds"); + def->category = L("Speed"); + def->tooltip = L("Set the speed of each feature as a volumetric flow (mm³/s) instead of a linear speed (mm/s). " + "Each line is then printed at its feature's flow divided by the line's cross section, so lines of different " + "width or height extrude the same flow. A volumetric speed expressed as a percentage is calculated on the " + "filament's \"Max volumetric speed\", which still limits every speed, as \"Max external volumetric speed\" " + "does for the visible features.\n\n" + "Small perimeter, overhang, ironing and travel speeds keep their own settings, applied over the resulting " + "speeds. Calibration prints ignore this option."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(false)); + + // Orca: named *_volumetric_flow because outer_wall_volumetric_speed is already a custom G-code placeholder. + const char *flow_tooltip = L("Volumetric flow of this feature when volumetric speeds are enabled. If expressed as a percentage, " + "it is calculated on the filament's \"Max volumetric speed\".\n\n" + "The resulting speed is limited by the filament's \"Max volumetric speed\"."); + const char *walls_flow_tooltip = L("Volumetric flow of this feature when volumetric speeds are enabled. If expressed as a percentage, " + "it is calculated on the filament's \"Max volumetric speed\".\n\n" + "The resulting speed is limited by the filament's \"Max volumetric speed\" and, on outer walls, " + "\"Max external volumetric speed\"."); + const char *external_flow_tooltip = L("Volumetric flow of this feature when volumetric speeds are enabled. If expressed as a percentage, " + "it is calculated on the filament's \"Max volumetric speed\".\n\n" + "The resulting speed is limited by the filament's \"Max volumetric speed\" and " + "\"Max external volumetric speed\"."); + const char *top_flow_tooltip = L("Volumetric flow of this feature when volumetric speeds are enabled. If expressed as a percentage, " + "it is calculated on the filament's \"Max volumetric speed\".\n\n" + "The resulting speed is limited by the filament's \"Max volumetric speed\" and, unless the surface " + "is ironed, \"Max external volumetric speed\"."); + + def = this->add("initial_layer_volumetric_flow", coFloatsOrPercents); + def->label = L("First layer"); + def->full_label = L("First layer volumetric speed"); + def->category = L("Speed"); + def->tooltip = walls_flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(25, true)}); + + def = this->add("initial_layer_infill_volumetric_flow", coFloatsOrPercents); + def->label = L("First layer infill"); + def->full_label = L("First layer infill volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50, true)}); + + def = this->add("outer_wall_volumetric_flow", coFloatsOrPercents); + def->label = L("Outer wall"); + def->full_label = L("Outer wall volumetric speed"); + def->category = L("Speed"); + def->tooltip = external_flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50, true)}); + + def = this->add("inner_wall_volumetric_flow", coFloatsOrPercents); + def->label = L("Inner wall"); + def->full_label = L("Inner wall volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); + + def = this->add("sparse_infill_volumetric_flow", coFloatsOrPercents); + def->label = L("Sparse infill"); + def->full_label = L("Sparse infill volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); + + def = this->add("internal_solid_infill_volumetric_flow", coFloatsOrPercents); + def->label = L("Internal solid infill"); + def->full_label = L("Internal solid infill volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); + + def = this->add("top_surface_volumetric_flow", coFloatsOrPercents); + def->label = L("Top surface"); + def->full_label = L("Top surface volumetric speed"); + def->category = L("Speed"); + def->tooltip = top_flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50, true)}); + + def = this->add("gap_infill_volumetric_flow", coFloatsOrPercents); + def->label = L("Gap infill"); + def->full_label = L("Gap infill volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50, true)}); + + def = this->add("support_volumetric_flow", coFloatsOrPercents); + def->label = L("Support"); + def->full_label = L("Support volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(100, true)}); + + def = this->add("support_interface_volumetric_flow", coFloatsOrPercents); + def->label = L("Support interface"); + def->full_label = L("Support interface volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(50, true)}); + + def = this->add("bridge_volumetric_flow", coFloatsOrPercents); + def->label = L("External"); + def->full_label = L("External bridge volumetric speed"); + def->category = L("Speed"); + def->tooltip = external_flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(25, true)}); + + def = this->add("internal_bridge_volumetric_flow", coFloatsOrPercents); + def->label = L("Internal"); + def->full_label = L("Internal bridge volumetric speed"); + def->category = L("Speed"); + def->tooltip = flow_tooltip; + def->sidetext = L(u8"mm³/s or %"); // cubic millimeters per second, CIS languages need translation + def->min = 0.1; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloatsOrPercentsNullable{FloatOrPercent(40, true)}); + def = this->add("wall_sequence", coEnum); def->label = L("Walls printing order"); def->category = L("Quality"); @@ -3193,6 +3355,17 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloats { 2. }); + def = this->add("filament_max_external_volumetric_speed", coFloats); + def->label = L("Max external volumetric speed"); + def->tooltip = L("Lower volumetric speed limit for the visible external features: outer walls, external bridges and overhang walls, " + "and top surfaces that are not ironed. It applies on top of the max volumetric speed. 0 means no extra limit.\n\n" + "Set it to the highest flow at which this material still prints glossy, to keep the surface finish while the " + "rest of the print runs at the max volumetric speed."); + def->sidetext = L(u8"mm³/s"); // cubic millimeters per second, CIS languages need translation + def->min = 0; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloats { 0. }); + def = this->add("machine_load_filament_time", coFloat); def->label = L("Filament load time"); def->tooltip = L("Time to load new filament when switch filament. It's usually applicable for single-extruder multi-material machines. " @@ -4076,7 +4249,7 @@ void PrintConfigDef::init_fff_params() def = this->add("initial_layer_speed", coFloats); def->label = L("First layer"); - def->tooltip = L("This is the speed for the walls and brim of the first layer."); + def->tooltip = L("This is the speed for the walls and brim of the first layer.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\" and, on outer walls, \"Max external volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -4085,7 +4258,7 @@ void PrintConfigDef::init_fff_params() def = this->add("initial_layer_infill_speed", coFloats); def->label = L("First layer infill"); - def->tooltip = L("This is the speed for the first layer except for walls and brim, such as infill, gap fill and support."); + def->tooltip = L("This is the speed for the first layer except for walls and brim, such as infill, gap fill and support.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -4405,7 +4578,7 @@ void PrintConfigDef::init_fff_params() def = this->add("gap_infill_speed", coFloats); def->label = L("Gap infill"); def->category = L("Speed"); - def->tooltip = L("This is the speed for gap infill. Gaps usually have irregular line width and should be printed more slowly."); + def->tooltip = L("This is the speed for gap infill. Gaps usually have irregular line width and should be printed more slowly.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -5055,7 +5228,7 @@ void PrintConfigDef::init_fff_params() def = this->add("sparse_infill_speed", coFloats); def->label = L("Sparse infill"); def->category = L("Speed"); - def->tooltip = L("This is the speed for internal sparse infill."); + def->tooltip = L("This is the speed for internal sparse infill.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -5222,7 +5395,7 @@ void PrintConfigDef::init_fff_params() def = this->add("ironing_speed", coFloat); def->label = L("Ironing speed"); def->category = L("Quality"); - def->tooltip = L("This is the print speed for ironing lines."); + def->tooltip = L("This is the print speed for ironing lines.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -5957,7 +6130,7 @@ void PrintConfigDef::init_fff_params() def = this->add("inner_wall_speed", coFloats); def->label = L("Inner wall"); def->category = L("Speed"); - def->tooltip = L("This is the speed for inner walls."); + def->tooltip = L("This is the speed for inner walls.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->aliases = { "perimeter_feed_rate" }; def->min = 1; @@ -6881,7 +7054,7 @@ void PrintConfigDef::init_fff_params() def = this->add("internal_solid_infill_speed", coFloats); def->label = L("Internal solid infill"); def->category = L("Speed"); - def->tooltip = L("This is the speed for internal solid infill, not including the top or bottom surface."); + def->tooltip = L("This is the speed for internal solid infill, not including the top or bottom surface.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -7546,7 +7719,7 @@ void PrintConfigDef::init_fff_params() def = this->add("support_interface_speed", coFloats); def->label = L("Support interface"); def->category = L("Speed"); - def->tooltip = L("This is the speed for support interfaces."); + def->tooltip = L("This is the speed for support interfaces.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -7618,7 +7791,7 @@ void PrintConfigDef::init_fff_params() def = this->add("support_speed", coFloats); def->label = L("Support"); def->category = L("Speed"); - def->tooltip = L("This is the speed for support."); + def->tooltip = L("This is the speed for support.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -8151,7 +8324,7 @@ void PrintConfigDef::init_fff_params() def = this->add("top_surface_speed", coFloats); def->label = L("Top surface"); def->category = L("Speed"); - def->tooltip = L("This is the speed for solid top surface infill."); + def->tooltip = L("This is the speed for solid top surface infill.\n\nThe resulting speed is limited by the filament's \"Max volumetric speed\" and, unless the surface is ironed, \"Max external volumetric speed\"."); def->sidetext = L("mm/s"); // millimeters per second, CIS languages need translation def->min = 1; def->mode = comAdvanced; @@ -10136,6 +10309,18 @@ std::set print_options_with_variant = { "gap_infill_speed", "support_speed", "support_interface_speed", + "initial_layer_volumetric_flow", //coFloatsOrPercents + "initial_layer_infill_volumetric_flow", + "outer_wall_volumetric_flow", + "inner_wall_volumetric_flow", + "sparse_infill_volumetric_flow", + "internal_solid_infill_volumetric_flow", + "top_surface_volumetric_flow", + "gap_infill_volumetric_flow", + "support_volumetric_flow", + "support_interface_volumetric_flow", + "bridge_volumetric_flow", + "internal_bridge_volumetric_flow", "travel_speed", "travel_speed_z", "initial_layer_travel_speed", @@ -10166,6 +10351,7 @@ std::set print_options_with_variant = { std::set filament_options_with_variant = { "filament_flow_ratio", "filament_max_volumetric_speed", + "filament_max_external_volumetric_speed", // Per-variant ramming / pre-cooling / nozzle-change filament overrides "filament_ramming_volumetric_speed", "filament_pre_cooling_temperature", diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 27e6fc0306..f98b7df2cc 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1335,12 +1335,14 @@ PRINT_CONFIG_CLASS_DEFINE( // Spacing between interface lines (the hatching distance). Set zero to get a solid interface. ((ConfigOptionFloat, support_interface_spacing)) ((ConfigOptionFloatsNullable, support_interface_speed)) + ((ConfigOptionFloatsOrPercentsNullable, support_interface_volumetric_flow)) ((ConfigOptionEnum, support_base_pattern)) ((ConfigOptionEnum, support_interface_pattern)) // Spacing between support material lines (the hatching distance). ((ConfigOptionFloat, support_base_pattern_spacing)) ((ConfigOptionFloat, support_expansion)) ((ConfigOptionFloatsNullable, support_speed)) + ((ConfigOptionFloatsOrPercentsNullable, support_volumetric_flow)) ((ConfigOptionEnum, support_style)) // Orca: a flag enabling the ability to override flow ratios @@ -1466,6 +1468,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, internal_bridge_flow)) ((ConfigOptionFloatsNullable, bridge_speed)) ((ConfigOptionFloatsOrPercentsNullable, internal_bridge_speed)) + ((ConfigOptionFloatsOrPercentsNullable, bridge_volumetric_flow)) + ((ConfigOptionFloatsOrPercentsNullable, internal_bridge_volumetric_flow)) ((ConfigOptionEnum, ensure_vertical_shell_thickness)) ((ConfigOptionPercent, top_surface_density)) ((ConfigOptionPercent, bottom_surface_density)) @@ -1476,6 +1480,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionEnum, internal_solid_infill_pattern)) ((ConfigOptionFloatOrPercent, outer_wall_line_width)) ((ConfigOptionFloatsNullable, outer_wall_speed)) + ((ConfigOptionFloatsOrPercentsNullable, outer_wall_volumetric_flow)) ((ConfigOptionFloat, infill_direction)) ((ConfigOptionFloat, solid_infill_direction)) ((ConfigOptionFloat, top_layer_direction)) @@ -1511,11 +1516,13 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionPercent, fuzzy_skin_ripple_offset)) ((ConfigOptionInt, fuzzy_skin_layers_between_ripple_offset)) ((ConfigOptionFloatsNullable, gap_infill_speed)) + ((ConfigOptionFloatsOrPercentsNullable, gap_infill_volumetric_flow)) ((ConfigOptionInt, sparse_infill_filament_id)) ((ConfigOptionFloatOrPercent, sparse_infill_line_width)) ((ConfigOptionPercent, infill_wall_overlap)) ((ConfigOptionPercent, top_bottom_infill_wall_overlap)) ((ConfigOptionFloatsNullable, sparse_infill_speed)) + ((ConfigOptionFloatsOrPercentsNullable, sparse_infill_volumetric_flow)) ((ConfigOptionPercent, skeleton_infill_density)) ((ConfigOptionPercent, skin_infill_density)) ((ConfigOptionFloat, infill_lock_depth)) @@ -1552,6 +1559,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, inner_wall_filament_id)) ((ConfigOptionFloatOrPercent, inner_wall_line_width)) ((ConfigOptionFloatsNullable, inner_wall_speed)) + ((ConfigOptionFloatsOrPercentsNullable, inner_wall_volumetric_flow)) // Total number of perimeters. ((ConfigOptionInt, wall_loops)) ((ConfigOptionBool, alternate_extra_wall)) @@ -1561,6 +1569,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, bottom_surface_filament_id)) ((ConfigOptionFloatOrPercent, internal_solid_infill_line_width)) ((ConfigOptionFloatsNullable, internal_solid_infill_speed)) + ((ConfigOptionFloatsOrPercentsNullable, internal_solid_infill_volumetric_flow)) // Detect thin walls. ((ConfigOptionBool, detect_thin_wall)) ((ConfigOptionFloatOrPercent, top_surface_line_width)) @@ -1571,6 +1580,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, top_surface_expansion_margin)) ((ConfigOptionEnum, top_surface_expansion_direction)) ((ConfigOptionFloatsNullable, top_surface_speed)) + ((ConfigOptionFloatsOrPercentsNullable, top_surface_volumetric_flow)) //BBS ((ConfigOptionBoolsNullable, enable_overhang_speed)) ((ConfigOptionFloatsOrPercentsNullable, overhang_1_4_speed)) @@ -1757,6 +1767,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionStrings, default_filament_colour)) ((ConfigOptionInts, temperature_vitrification)) //BBS ((ConfigOptionFloats, filament_max_volumetric_speed)) + ((ConfigOptionFloats, filament_max_external_volumetric_speed)) ((ConfigOptionInts, required_nozzle_HRC)) ((ConfigOptionEnum, filament_map_mode)) ((ConfigOptionInts, filament_map)) @@ -2049,9 +2060,12 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloatOrPercent, initial_layer_line_width)) ((ConfigOptionFloat, initial_layer_print_height)) ((ConfigOptionFloatsNullable, initial_layer_speed)) + ((ConfigOptionFloatsOrPercentsNullable, initial_layer_volumetric_flow)) //BBS ((ConfigOptionFloatsNullable, initial_layer_infill_speed)) + ((ConfigOptionFloatsOrPercentsNullable, initial_layer_infill_volumetric_flow)) + ((ConfigOptionBool, enable_volumetric_speeds)) ((ConfigOptionInts, nozzle_temperature_initial_layer)) ((ConfigOptionInts, full_fan_speed_layer)) // ORCA: explicit override for the part cooling fan speed on the first printed layer. diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 69f9410876..bb7346426d 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1503,7 +1503,13 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "inner_wall_speed" || opt_key == "support_speed" || opt_key == "internal_solid_infill_speed" - || opt_key == "top_surface_speed") { + || opt_key == "top_surface_speed" + || opt_key == "outer_wall_volumetric_flow" + || opt_key == "inner_wall_volumetric_flow" + || opt_key == "sparse_infill_volumetric_flow" + || opt_key == "internal_solid_infill_volumetric_flow" + || opt_key == "top_surface_volumetric_flow" + || opt_key == "support_volumetric_flow") { // Brim is printed below supports, support invalidates brim and skirt. steps.emplace_back(posSupportMaterial); if (opt_key == "brim_type" || opt_key == "brim_width") { @@ -1530,7 +1536,8 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "seam_gap" || opt_key == "role_based_wipe_speed" || opt_key == "wipe_on_loops" - || opt_key == "wipe_speed") { + || opt_key == "wipe_speed" + || opt_key == "gap_infill_volumetric_flow") { steps.emplace_back(posPerimeters); } else if ( opt_key == "small_area_infill_flow_compensation_model") { @@ -1841,6 +1848,9 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "overhang_4_4_speed" || opt_key == "bridge_speed" || opt_key == "internal_bridge_speed" + || opt_key == "support_interface_volumetric_flow" + || opt_key == "bridge_volumetric_flow" + || opt_key == "internal_bridge_volumetric_flow" || opt_key == "outer_wall_speed" || opt_key == "small_perimeter_speed" || opt_key == "small_perimeter_threshold" diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 97cf6b9cea..6eebb50e09 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -816,7 +816,8 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall", "seam_position", "staggered_inner_seams", "wall_sequence", "outer_wall_line_width" }) toggle_field(el, have_perimeters, -1, wall_loops_reason); - for (auto el : { "inner_wall_speed", "outer_wall_speed", "small_perimeter_speed", "small_perimeter_threshold" }) + for (auto el : { "inner_wall_speed", "outer_wall_speed", "small_perimeter_speed", "small_perimeter_threshold", + "inner_wall_volumetric_flow", "outer_wall_volumetric_flow" }) toggle_field(el, have_perimeters, variant_index, wall_loops_reason); bool have_infill = config->option("sparse_infill_density")->value > 0; @@ -945,7 +946,8 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in "solid_infill_direction", "solid_infill_rotate_template", "internal_solid_infill_pattern", "internal_solid_filament_id", "top_surface_filament_id", "bottom_surface_filament_id", }) toggle_field(el, have_infill || has_solid_infill, -1, infill_or_shell_reason); - for (auto el : { "sparse_infill_speed", "bridge_speed", "internal_bridge_speed"}) + for (auto el : { "sparse_infill_speed", "bridge_speed", "internal_bridge_speed", + "sparse_infill_volumetric_flow", "bridge_volumetric_flow", "internal_bridge_volumetric_flow" }) toggle_field(el, have_infill || has_solid_infill, variant_index, infill_or_shell_reason); toggle_field("top_shell_thickness", ! has_spiral_vase && has_top_shell_layers, -1, _L("Disable spiral vase mode and set top shell layers above zero to edit top shell thickness.")); @@ -953,9 +955,21 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in // Gap fill is newly allowed in between perimeter lines even for empty infill (see GH #1476). toggle_field("gap_infill_speed", have_perimeters, variant_index, wall_loops_reason); + toggle_field("gap_infill_volumetric_flow", have_perimeters, variant_index, wall_loops_reason); toggle_field("top_surface_line_width", has_top_shell, -1, top_shell_reason); toggle_field("top_surface_speed", has_top_shell, variant_index, top_shell_reason); + toggle_field("top_surface_volumetric_flow", has_top_shell, variant_index, top_shell_reason); + + // Orca: each feature shows either its linear speed or its volumetric alternative. + const bool use_volumetric_speeds = config->opt_bool("enable_volumetric_speeds"); + const wxString linear_speed_reason = _L("Disable volumetric speeds to use this setting."); + const wxString volumetric_speed_reason = _L("Enable volumetric speeds to use this setting."); + for (const std::string feature : { "initial_layer", "initial_layer_infill", "outer_wall", "inner_wall", "sparse_infill", + "internal_solid_infill", "top_surface", "gap_infill", "support", "support_interface", "bridge" }) { + toggle_line(feature + "_speed", !use_volumetric_speeds, variant_index, linear_speed_reason); + toggle_line(feature + "_volumetric_flow", use_volumetric_speeds, variant_index, volumetric_speed_reason); + } bool have_default_acceleration = config->opt_float_nullable("default_acceleration", variant_index) > 0; diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index caf6cbfd20..75c3d22265 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -125,7 +125,8 @@ std::map> SettingsFactory::OBJECT_C {"support_object_xy_distance", "",30}, {"bridge_no_support", "",31},{"max_bridge_length", "",32},{"support_critical_regions_only", "",33},{"support_remove_small_overhang","",34}, {"support_object_first_layer_gap","",35} }}, - { L("Speed"), {{"support_speed", "",12}, {"support_interface_speed", "",13} + { L("Speed"), {{"support_speed", "",12}, {"support_interface_speed", "",13}, + {"support_volumetric_flow", "",12}, {"support_interface_volumetric_flow", "",13} }} }; @@ -189,18 +190,26 @@ std::map> SettingsFactory::PART_CATE {"minimum_sparse_infill_area", "", 1}}}, {L("Speed"), {{"outer_wall_speed", "", 1}, + {"outer_wall_volumetric_flow", "", 1}, {"inner_wall_speed", "", 2}, + {"inner_wall_volumetric_flow", "", 2}, {"sparse_infill_speed", "", 3}, + {"sparse_infill_volumetric_flow", "", 3}, {"top_surface_speed", "", 4}, + {"top_surface_volumetric_flow", "", 4}, {"internal_solid_infill_speed", "", 5}, + {"internal_solid_infill_volumetric_flow", "", 5}, {"enable_overhang_speed", "", 6}, {"overhang_1_4_speed", "", 7}, {"overhang_2_4_speed", "", 8}, {"overhang_3_4_speed", "", 9}, {"overhang_4_4_speed", "", 10}, {"bridge_speed", "", 11}, + {"bridge_volumetric_flow", "", 11}, {"gap_infill_speed", "", 12}, - {"internal_bridge_speed", "", 13}}}}; + {"gap_infill_volumetric_flow", "", 12}, + {"internal_bridge_speed", "", 13}, + {"internal_bridge_volumetric_flow", "", 13}}}}; std::vector SettingsFactory::get_options(const bool is_part) { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 72b6b6364a..0f4059e553 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -17657,6 +17657,8 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i _obj->config.set_key_value("seam_slope_type", new ConfigOptionEnum(SeamScarfType::None)); _obj->config.set_key_value("gap_fill_target", new ConfigOptionEnum(GapFillTarget::gftNowhere)); print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0)); + // ORCA: the speeds above are linear, and no calibration mode switches volumetric speeds off here. + print_config->set_key_value("enable_volumetric_speeds", new ConfigOptionBool(false)); // ORCA: request the calibration's special toolpath order (chords first, center spiral // last and inside-out) so opposing directions collide into the tactile lip the test // reads. The special order only applies while the fill order is Default, so reset the diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index f08efd85f8..23e8ad0107 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3252,23 +3252,36 @@ void TabPrint::build() optgroup->append_single_option_line("ensure_vertical_shell_thickness", "strength_settings_advanced#ensure-vertical-shell-thickness"); page = add_options_page(L("Speed"), "custom-gcode_speed"); // ORCA: icon only visible on placeholders + // Orca: each speed below is followed by its volumetric alternative; ConfigManipulation shows one of the two. + optgroup = page->new_optgroup(L("Speed definition"), L"param_volumetric_speed", 15); + optgroup->append_single_option_line("enable_volumetric_speeds", "speed_settings_other_layers_speed#volumetric-speeds"); optgroup = page->new_optgroup(L("First layer speed"), L"param_speed_first", 15); optgroup->append_single_option_line("initial_layer_speed", "speed_settings_initial_layer_speed#initial-layer", 0); + optgroup->append_single_option_line("initial_layer_volumetric_flow", "speed_settings_initial_layer_speed#initial-layer", 0); optgroup->append_single_option_line("initial_layer_infill_speed", "speed_settings_initial_layer_speed#initial-layer-infill", 0); + optgroup->append_single_option_line("initial_layer_infill_volumetric_flow", "speed_settings_initial_layer_speed#initial-layer-infill", 0); optgroup->append_single_option_line("initial_layer_travel_speed", "speed_settings_initial_layer_speed#initial-layer-travel-speed", 0); optgroup->append_single_option_line("slow_down_layers", "speed_settings_initial_layer_speed#number-of-slow-layers"); optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); optgroup->append_single_option_line("outer_wall_speed", "speed_settings_other_layers_speed#outer-wall", 0); + optgroup->append_single_option_line("outer_wall_volumetric_flow", "speed_settings_other_layers_speed#outer-wall", 0); optgroup->append_single_option_line("inner_wall_speed", "speed_settings_other_layers_speed#inner-wall", 0); + optgroup->append_single_option_line("inner_wall_volumetric_flow", "speed_settings_other_layers_speed#inner-wall", 0); optgroup->append_single_option_line("small_perimeter_speed", "speed_settings_other_layers_speed#small-perimeters", 0); optgroup->append_single_option_line("small_perimeter_threshold", "speed_settings_other_layers_speed#small-perimeters-threshold", 0); optgroup->append_single_option_line("sparse_infill_speed", "speed_settings_other_layers_speed#sparse-infill", 0); + optgroup->append_single_option_line("sparse_infill_volumetric_flow", "speed_settings_other_layers_speed#sparse-infill", 0); optgroup->append_single_option_line("internal_solid_infill_speed", "speed_settings_other_layers_speed#internal-solid-infill", 0); + optgroup->append_single_option_line("internal_solid_infill_volumetric_flow", "speed_settings_other_layers_speed#internal-solid-infill", 0); optgroup->append_single_option_line("top_surface_speed", "speed_settings_other_layers_speed#top-surface", 0); + optgroup->append_single_option_line("top_surface_volumetric_flow", "speed_settings_other_layers_speed#top-surface", 0); optgroup->append_single_option_line("gap_infill_speed", "speed_settings_other_layers_speed#gap-infill", 0); + optgroup->append_single_option_line("gap_infill_volumetric_flow", "speed_settings_other_layers_speed#gap-infill", 0); optgroup->append_single_option_line("ironing_speed", "speed_settings_other_layers_speed#ironing-speed"); optgroup->append_single_option_line("support_speed", "speed_settings_other_layers_speed#support", 0); + optgroup->append_single_option_line("support_volumetric_flow", "speed_settings_other_layers_speed#support", 0); optgroup->append_single_option_line("support_interface_speed", "speed_settings_other_layers_speed#support-interface", 0); + optgroup->append_single_option_line("support_interface_volumetric_flow", "speed_settings_other_layers_speed#support-interface", 0); optgroup->append_single_option_line("small_support_perimeter_speed", "speed_settings_other_layers_speed#small-tree-support-perimeters", 0); optgroup->append_single_option_line("small_support_perimeter_threshold", "speed_settings_other_layers_speed#small-tree-support-perimeters-threshold", 0); optgroup = page->new_optgroup(L("Overhang speed"), L"param_overhang_speed", 15); @@ -3284,9 +3297,15 @@ void TabPrint::build() optgroup->append_line(line); optgroup->append_separator(); line = { L("Bridge"), L("Set speed for external and internal bridges") }; + line.label_path = "speed_settings_overhang_speed#bridge-speed"; line.append_option(optgroup->get_option("bridge_speed", 0)); line.append_option(optgroup->get_option("internal_bridge_speed", 0)); optgroup->append_line(line); + line = { L("Bridge"), L("Set volumetric speed for external and internal bridges") }; + line.label_path = "speed_settings_overhang_speed#bridge-speed"; + line.append_option(optgroup->get_option("bridge_volumetric_flow", 0)); + line.append_option(optgroup->get_option("internal_bridge_volumetric_flow", 0)); + optgroup->append_line(line); optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15); optgroup->append_single_option_line("travel_speed", "speed_settings_travel", 0); @@ -4959,6 +4978,7 @@ void TabFilament::build() optgroup = page->new_optgroup(L("Volumetric speed limitation"), L"param_volumetric_speed"); optgroup->append_single_option_line("filament_adaptive_volumetric_speed", "material_volumetric_speed_limitation#adaptive-volumetric-speed", 0); optgroup->append_single_option_line("filament_max_volumetric_speed", "material_volumetric_speed_limitation#max-volumetric-speed", 0); + optgroup->append_single_option_line("filament_max_external_volumetric_speed", "material_volumetric_speed_limitation#max-external-volumetric-speed", 0); //line = { "", "" }; //line.full_width = 1; diff --git a/tests/fff_print/test_gcode.cpp b/tests/fff_print/test_gcode.cpp index d56f29afbb..44e7b489c1 100644 --- a/tests/fff_print/test_gcode.cpp +++ b/tests/fff_print/test_gcode.cpp @@ -28,12 +28,16 @@ #include #include #include +#include #include #include #include #include +#include #include #include +#include +#include #include #include #include @@ -795,3 +799,160 @@ TEST_CASE("The temperature tower steps the temperature of the tool printing it", CHECK(tools == std::set{multi_tool ? "1" : "none"}); } } + +namespace { + +constexpr double filament_diameter = 1.75; +constexpr double max_volumetric_speed = 20.; +constexpr double layer_height = 0.2; + +// A 20mm cube sliced at 0.2mm layers with volumetric speeds `enabled` and `extra` applied last. +std::string volumetric_speed_gcode(bool enabled, std::initializer_list extra) +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict({ + {"enable_volumetric_speeds", enabled ? "1" : "0"}, + {"filament_diameter", filament_diameter}, + {"filament_max_volumetric_speed", max_volumetric_speed}, + {"layer_height", layer_height}, + {"initial_layer_print_height", layer_height}, + {"slow_down_for_layer_cooling", "0"}, + {"slow_down_layers", "0"}, + {"enable_arc_fitting", "0"}, + }); + config.set_deserialize_strict(extra); + return Test::slice({Test::cube(20.)}, config); +} + +// For each extrusion move longer than 1mm of `role` above the first layer: its feed rate (mm/s) and extruded flow (mm³/s). +std::vector> role_speeds_and_flows(const std::string &gcode, std::string_view role) +{ + const double filament_area = 0.25 * M_PI * filament_diameter * filament_diameter; + std::vector> moves; + bool in_role = false; + GCodeReader parser; + parser.parse_buffer(gcode, [&](GCodeReader &self, const GCodeReader::GCodeLine &line) { + const std::string_view comment = line.comment(); + if (comment.find("TYPE:") != std::string_view::npos) + in_role = comment.substr(comment.find("TYPE:") + 5) == role; + if (in_role && line.extruding(self) && line.dist_XY(self) > 1. && line.new_Z(self) > 1.5 * layer_height) { + const double speed = line.new_F(self) / Test::MM_PER_MIN; + moves.emplace_back(speed, line.dist_E(self) * filament_area / line.dist_XY(self) * speed); + } + }); + return moves; +} + +} // namespace + +TEST_CASE("Volumetric speeds print each feature at its configured flow", "[GCode]") +{ + const auto [key, role] = GENERATE(table({ + {"outer_wall_volumetric_flow", "Outer wall"}, + {"inner_wall_volumetric_flow", "Inner wall"}, + {"sparse_infill_volumetric_flow", "Sparse infill"}, + {"internal_solid_infill_volumetric_flow", "Internal solid infill"}, + {"top_surface_volumetric_flow", "Top surface"}, + })); + INFO(key); + const double flow = 6.; + const auto moves = role_speeds_and_flows(volumetric_speed_gcode(true, {{key, flow}}), role); + + REQUIRE_FALSE(moves.empty()); + for (const auto &[speed, extruded_flow] : moves) + CHECK_THAT(extruded_flow, Catch::Matchers::WithinRel(flow, 0.01)); +} + +TEST_CASE("A volumetric speed in percent is a share of the filament's max volumetric speed, which caps it", "[GCode]") +{ + const auto [value, expected_flow] = GENERATE(table({ + {"50%", 0.5 * max_volumetric_speed}, + {"300%", max_volumetric_speed}, + {"40", max_volumetric_speed}, + })); + INFO(value); + const auto moves = role_speeds_and_flows(volumetric_speed_gcode(true, {{"outer_wall_volumetric_flow", value}}), "Outer wall"); + + REQUIRE_FALSE(moves.empty()); + for (const auto &[speed, extruded_flow] : moves) + CHECK_THAT(extruded_flow, Catch::Matchers::WithinRel(expected_flow, 0.01)); +} + +TEST_CASE("Volumetric speeds are ignored while disabled", "[GCode]") +{ + const double outer_wall_speed = 50.; + const auto moves = role_speeds_and_flows( + volumetric_speed_gcode(false, {{"outer_wall_speed", outer_wall_speed}, {"outer_wall_volumetric_flow", "2"}}), "Outer wall"); + + REQUIRE_FALSE(moves.empty()); + for (const auto &[speed, extruded_flow] : moves) + CHECK_THAT(speed, Catch::Matchers::WithinRel(outer_wall_speed, 0.001)); +} + +TEST_CASE("The max external volumetric speed limits outer walls but not inner walls", "[GCode]") +{ + // At 200mm/s both walls would extrude well above the external limit and below the filament limit. + const double max_external = 5.; + const std::string gcode = volumetric_speed_gcode(false, {{"filament_max_external_volumetric_speed", max_external}, + {"outer_wall_speed", 200.}, + {"inner_wall_speed", 200.}}); + const auto outer_wall = role_speeds_and_flows(gcode, "Outer wall"); + const auto inner_wall = role_speeds_and_flows(gcode, "Inner wall"); + + REQUIRE_FALSE(outer_wall.empty()); + REQUIRE_FALSE(inner_wall.empty()); + for (const auto &[speed, extruded_flow] : outer_wall) + CHECK_THAT(extruded_flow, Catch::Matchers::WithinRel(max_external, 0.01)); + for (const auto &[speed, extruded_flow] : inner_wall) + CHECK(extruded_flow > 2. * max_external); +} + +TEST_CASE("The max external volumetric speed limits top surfaces only when they are not ironed", "[GCode]") +{ + const auto [ironing_type, limited] = GENERATE(table({ + {"no ironing", true}, + {"top", false}, + })); + INFO(ironing_type); + const double max_external = 5.; + const auto moves = role_speeds_and_flows(volumetric_speed_gcode(false, {{"filament_max_external_volumetric_speed", max_external}, + {"top_surface_speed", 200.}, + {"ironing_type", ironing_type}}), + "Top surface"); + + REQUIRE_FALSE(moves.empty()); + for (const auto &[speed, extruded_flow] : moves) { + if (limited) + CHECK_THAT(extruded_flow, Catch::Matchers::WithinRel(max_external, 0.01)); + else + CHECK(extruded_flow > 2. * max_external); + } +} + +// Resonance avoidance moves an outer wall in the upper half of its band up to the band's top. When the +// volumetric limit keeps the wall below that top, the boost would exceed the limit, so the wall drops to +// the band's bottom instead. +TEST_CASE("Resonance avoidance keeps outer walls within their volumetric speed limit", "[GCode]") +{ + static constexpr double min_avoided = 40., max_avoided = 90.; + const auto [limit_key, limit, outer_wall_speed, expected_speed] = GENERATE(table({ + // 6 mm3/s caps a 0.2 mm wall at about 75-80 mm/s, in the upper half of the band. + {"filament_max_external_volumetric_speed", 6., 200., min_avoided}, + {"filament_max_volumetric_speed", 6., 200., min_avoided}, + // 10 mm3/s allows the top of the band, so a 75 mm/s wall is still boosted to it. + {"filament_max_external_volumetric_speed", 10., 75., max_avoided}, + })); + INFO(limit_key << " = " << limit << ", outer wall " << outer_wall_speed << " mm/s"); + const auto moves = role_speeds_and_flows(volumetric_speed_gcode(false, {{limit_key, limit}, + {"outer_wall_speed", outer_wall_speed}, + {"resonance_avoidance", "1"}, + {"min_resonance_avoidance_speed", min_avoided}, + {"max_resonance_avoidance_speed", max_avoided}}), + "Outer wall"); + + REQUIRE_FALSE(moves.empty()); + for (const auto &[speed, extruded_flow] : moves) { + CHECK(extruded_flow <= limit * 1.01); + CHECK_THAT(speed, Catch::Matchers::WithinAbs(expected_speed, 0.5)); + } +}