Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small area infill flow compensation (graph version) causing some lines to not extrude (#4374) #4399

Open
wants to merge 4 commits into
base: nightly_dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions resources/ui_layout/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ These functions can only be called in a `set` or `reset` function. If you need t
### others
* void **ask_for_refresh**()
ask for a OPTNAME_set() after the current OPTNAME_get(), to be able to set settings.
* bool **is_enabled**(string setting_key)
Experimental. Ask if this setting is currently enabled. Dangerous, as it will be true if it's not constructed.
* bool **is_enabled**(string setting_key, int idx)
Ask if this setting is currently enabled. `idx` is the index of the value if the settigns is a vector, it's ignored if it's a scalar.
* bool **is_widget_enabled**(string setting_key)
Experimental. Ask if a widget for this setting is currently enabled. Dangerous, as it will be true if it's not constructed.

### to get/set the value of a custom variable
The first argument is the index of the tab setting: 0 for print settings, 1 for filament settings and 2 for printer settings.
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/default/filament.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ group:Temperature °C
line:Extruder
setting:id$0:first_layer_temperature
setting:id$0:temperature
setting:id$0:label$Idle:idle_temperature
end_line
line:Bed
setting:id$0:first_layer_bed_temperature
setting:id$0:label$Other layers:bed_temperature
end_line
setting:id$0:chamber_temperature
setting:id$0:label$Idle:idle_temperature
group:Filament properties
setting:id$0:width$7:filament_type
setting:id$0:filament_soluble
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
page:Perimeters & Shell:shell
group:Vertical shells
line:Perimeters
setting:label$Contour:width$6:perimeters
setting:label$Contour:width$6:sidetext_width$10:perimeters
setting:label$Holes:width$6:perimeters_hole
end_line
setting:tags$Simple$Expert$SuSi:script:float:depends$perimeter_spacing$external_perimeter_spacing:label$Wall Thickness:tooltip$Change the perimeter extrusion widths to ensure that there is an exact number of perimeters for this wall thickness value. It won't put the perimeter width below the nozzle diameter, and up to double.\nNote that the value displayed is just a view of the current perimeter thickness, like the info text below. The number of perimeters used to compute this value is one loop, or the custom variable 'wall_thickness_lines' (advanced mode) if defined.\nIf the value is too low, it will revert the widths to the saved value.\nIf the value is set to 0, it will show 0.:s_wall_thickness
Expand Down
171 changes: 85 additions & 86 deletions src/libslic3r/Config.cpp

Large diffs are not rendered by default.

1,073 changes: 359 additions & 714 deletions src/libslic3r/Config.hpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/libslic3r/Extruder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ double Extruder::retract_before_wipe() const

double Extruder::retract_length() const
{
assert(!m_config->retract_length.is_nil());
assert(m_config->retract_length.is_enabled());
assert(m_config->retract_length.get_at(m_id) < std::numeric_limits<int32_t>::max());
assert(m_config->retract_length.get_at(m_id) > -std::numeric_limits<int32_t>::max());
assert(m_config->retract_length.size() > m_id);
Expand All @@ -258,7 +258,7 @@ double Extruder::retract_length() const

double Extruder::retract_lift() const
{
assert(!m_config->retract_lift.is_nil());
assert(m_config->retract_lift.is_enabled());
assert(m_config->retract_lift.get_at(m_id) < std::numeric_limits<int32_t>::max());
assert(m_config->retract_lift.get_at(m_id) > -std::numeric_limits<int32_t>::max());
assert(m_config->retract_lift.size() > m_id);
Expand All @@ -278,7 +278,7 @@ int Extruder::deretract_speed() const

double Extruder::retract_restart_extra() const
{
assert(!m_config->retract_restart_extra.is_nil());
assert(m_config->retract_restart_extra.is_enabled());
assert(m_config->retract_restart_extra.get_at(m_id) < std::numeric_limits<int32_t>::max());
assert(m_config->retract_restart_extra.get_at(m_id) > -std::numeric_limits<int32_t>::max());
assert(m_config->retract_restart_extra.size() > m_id);
Expand All @@ -292,7 +292,7 @@ double Extruder::retract_length_toolchange() const

double Extruder::retract_restart_extra_toolchange() const
{
assert(!m_config->retract_restart_extra_toolchange.is_nil());
assert(m_config->retract_restart_extra_toolchange.is_enabled());
assert(m_config->retract_restart_extra_toolchange.get_at(m_id) < std::numeric_limits<int32_t>::max());
assert(m_config->retract_restart_extra_toolchange.get_at(m_id) > -std::numeric_limits<int32_t>::max());
assert(m_config->retract_restart_extra_toolchange.size() > m_id);
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/Format/BBConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,8 @@ void very_complicated_convert(ConfigSubstitutionContext &unconverted_config, Con
double overhangs_max_slope = std::tan(make_overhang_printable_angle) * layer_height;
conf_to_read_and_update.set_deserialize("overhangs_max_slope",
Slic3r::to_string_nozero(overhangs_max_slope, 3));
conf_to_read_and_update.set_deserialize("overhangs_bridge_threshold", "-1");
conf_to_read_and_update.set_deserialize("overhangs_bridge_upper_layers", "-1");
conf_to_read_and_update.set_deserialize("overhangs_bridge_threshold", "!0");
conf_to_read_and_update.set_deserialize("overhangs_bridge_upper_layers", "!0");
unconverted_config.erase("make_overhang_printable");
unconverted_config.erase("make_overhang_printable_angle");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Format/CWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void fill_slicerconf(ConfMap &m, const SLAPrint &print)

auto &cfg = print.full_print_config();
for (const std::string &key : cfg.keys())
if (! is_banned(key) && ! cfg.option(key)->is_nil())
if (!is_banned(key) && (cfg.option(key)->is_enabled() || !cfg.get_option_def(key)->is_optional))
m[key] = cfg.opt_serialize(key);

}
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Format/SL1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void fill_slicerconf(ConfMap &m, const SLAPrint &print)

auto &cfg = print.full_print_config();
for (const std::string &key : cfg.keys())
if (! is_banned(key) && ! cfg.option(key)->is_nil())
if (!is_banned(key) && (cfg.option(key)->is_enabled() || !cfg.get_option_def(key)->is_optional))
m[key] = cfg.opt_serialize(key);

}
Expand Down
8 changes: 4 additions & 4 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ namespace Slic3r {
// gcode += gcodegen.writer().travel_to_xy(unscale(standby_point), 0.0, "move to standby position");
//}
unsigned int extruder_id = gcodegen.writer().tool()->id();
const ConfigOptionIntsNullable& filament_idle_temp = gcodegen.config().idle_temperature;
if (filament_idle_temp.is_nil(extruder_id)) {
const ConfigOptionInts& filament_idle_temp = gcodegen.config().idle_temperature;
if (!filament_idle_temp.is_enabled(extruder_id)) {
// There is no idle temperature defined in filament settings.
// Use the delta value from print config.
if (gcodegen.config().standby_temperature_delta.value != 0 && gcodegen.writer().tool_is_extruder() && this->_get_temp(gcodegen) > 0) {
Expand Down Expand Up @@ -2742,7 +2742,7 @@ void GCodeGenerator::_print_first_layer_extruder_temperatures(std::string &out,
if (temp == 0)
temp = print.config().temperature.get_at(tool.id());
if (print.config().ooze_prevention.value && tool.id() != first_printing_extruder_id)
if (print.config().idle_temperature.is_nil(tool.id()))
if (!print.config().idle_temperature.is_enabled(tool.id()))
temp += print.config().standby_temperature_delta.value;
else
temp = print.config().idle_temperature.get_at(tool.id());
Expand Down Expand Up @@ -3881,7 +3881,7 @@ void GCodeGenerator::encode_full_config(const Print& print, std::vector<std::pai
};
config.reserve(config.size() + cfg.keys().size());
for (const std::string& key : cfg.keys()) {
if (!is_banned(key) && !cfg.option(key)->is_nil())
if (!is_banned(key) && (cfg.option(key)->is_enabled() || !cfg.get_option_def(key)->is_optional))
config.emplace_back(key, cfg.opt_serialize(key));
}
config.shrink_to_fit();
Expand Down
36 changes: 24 additions & 12 deletions src/libslic3r/GCode/CoolingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,9 +949,10 @@ std::string CoolingBuffer::apply_layer_cooldown(
int fan_speeds[ uint8_t(GCodeExtrusionRole::Count)];
int default_fan_speed[ uint8_t(GCodeExtrusionRole::Count)];
#define EXTRUDER_CONFIG(OPT) m_config.OPT.get_at(m_current_extruder)
#define FAN_CONFIG(OPT) m_config.OPT.is_enabled(m_current_extruder) ? m_config.OPT.get_at(m_current_extruder) : -1
const int min_fan_speed = m_config.fan_printer_min_speed;
assert(min_fan_speed >= 0);
int initial_default_fan_speed = EXTRUDER_CONFIG(default_fan_speed);
int initial_default_fan_speed = FAN_CONFIG(default_fan_speed);
//if default_fan_speed activated, be sure it's at least the mins
if (initial_default_fan_speed > 0 && initial_default_fan_speed < min_fan_speed)
initial_default_fan_speed = min_fan_speed;
Expand All @@ -967,19 +968,29 @@ std::string CoolingBuffer::apply_layer_cooldown(
if (default_fan_speed[i] == 1) default_fan_speed[i] = 0;
}
//set the fan controls
default_fan_speed[ uint8_t(GCodeExtrusionRole::BridgeInfill)] = EXTRUDER_CONFIG(bridge_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::InternalBridgeInfill)] = EXTRUDER_CONFIG(internal_bridge_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::TopSolidInfill)] = EXTRUDER_CONFIG(top_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::BridgeInfill)] = FAN_CONFIG(bridge_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::InternalBridgeInfill)] = FAN_CONFIG(internal_bridge_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::TopSolidInfill)] = FAN_CONFIG(top_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::Ironing)] = default_fan_speed[ uint8_t(GCodeExtrusionRole::TopSolidInfill)];
default_fan_speed[ uint8_t(GCodeExtrusionRole::SupportMaterialInterface)] = EXTRUDER_CONFIG(support_material_interface_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::SupportMaterial)] = EXTRUDER_CONFIG(support_material_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::ExternalPerimeter)] = EXTRUDER_CONFIG(external_perimeter_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::SupportMaterialInterface)] = FAN_CONFIG(support_material_interface_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::SupportMaterial)] = FAN_CONFIG(support_material_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::ExternalPerimeter)] = FAN_CONFIG(external_perimeter_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::ThinWall)] = default_fan_speed[ uint8_t(GCodeExtrusionRole::ExternalPerimeter)];
default_fan_speed[ uint8_t(GCodeExtrusionRole::Perimeter)] = EXTRUDER_CONFIG(perimeter_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::SolidInfill)] = EXTRUDER_CONFIG(solid_infill_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::InternalInfill)] = EXTRUDER_CONFIG(infill_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::OverhangPerimeter)] = EXTRUDER_CONFIG(overhangs_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::GapFill)] = EXTRUDER_CONFIG(gap_fill_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::Perimeter)] = FAN_CONFIG(perimeter_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::SolidInfill)] = FAN_CONFIG(solid_infill_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::InternalInfill)] = FAN_CONFIG(infill_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::OverhangPerimeter)] = FAN_CONFIG(overhangs_fan_speed);
default_fan_speed[ uint8_t(GCodeExtrusionRole::GapFill)] = FAN_CONFIG(gap_fill_fan_speed);
// if disabled, and default is not default
if (default_fan_speed[uint8_t(GCodeExtrusionRole::TopSolidInfill)] < 0) {
default_fan_speed[ uint8_t(GCodeExtrusionRole::TopSolidInfill)] = default_fan_speed[ uint8_t(GCodeExtrusionRole::SolidInfill)];
}
if (default_fan_speed[uint8_t(GCodeExtrusionRole::SupportMaterialInterface)] < 0) {
default_fan_speed[ uint8_t(GCodeExtrusionRole::SupportMaterialInterface)] = default_fan_speed[ uint8_t(GCodeExtrusionRole::SupportMaterial)];
}
if (default_fan_speed[uint8_t(GCodeExtrusionRole::InternalBridgeInfill)] < 0) {
default_fan_speed[ uint8_t(GCodeExtrusionRole::InternalBridgeInfill)] = default_fan_speed[ uint8_t(GCodeExtrusionRole::BridgeInfill)];
}
// if default is enabled, it takes over the settings that are disabled.
if (initial_default_fan_speed >= 0) {
for (int i = 0; i < uint8_t(GCodeExtrusionRole::Count); i++) {
Expand Down Expand Up @@ -1285,6 +1296,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
pos = line_end;
}
#undef EXTRUDER_CONFIG
#undef FAN_CONFIG
const char *gcode_end = gcode.c_str() + gcode.size();
if (pos < gcode_end)
new_gcode.append(pos, gcode_end - pos);
Expand Down
23 changes: 13 additions & 10 deletions src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,23 +2760,26 @@ void PerimeterGenerator::process(// Input:

// detect how many perimeters must be generated for this island
int nb_loop_contour = params.config.perimeters;
assert(nb_loop_contour >= 0);
assert(params.config.perimeters.is_enabled());
if (nb_loop_contour > 0)
nb_loop_contour += extra_odd_perimeter + surface.extra_perimeters;
int nb_loop_holes = params.config.perimeters_hole;
if (nb_loop_holes > 0)
assert(nb_loop_contour >= 0);
int nb_loop_holes = params.config.perimeters_hole.value;
assert(nb_loop_holes >= 0);
if (params.config.perimeters_hole.is_enabled() && nb_loop_holes > 0)
nb_loop_holes += extra_odd_perimeter + surface.extra_perimeters;
assert(nb_loop_holes >= 0);

if (nb_loop_contour < 0)
nb_loop_contour = std::max(0, nb_loop_holes);
if (nb_loop_holes < 0)
if (!params.config.perimeters_hole.is_enabled())
nb_loop_holes = std::max(0, nb_loop_contour);

if (params.print_config.spiral_vase) {
if (params.layer->id() >= params.config.bottom_solid_layers) {
nb_loop_contour = 1;
nb_loop_holes = 0;
}
if (params.print_config.spiral_vase) {
if (params.layer->id() >= params.config.bottom_solid_layers) {
nb_loop_contour = 1;
nb_loop_holes = 0;
}
}

if ((params.layer->id() == 0 && params.config.only_one_perimeter_first_layer) ||
(params.config.only_one_perimeter_top && this->upper_slices == NULL)) {
Expand Down
Loading