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

Implemented minimum skirt extrusion length and draft shield parameter #5356

Merged
14 changes: 8 additions & 6 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3452,13 +3452,15 @@ namespace Skirt {
size_t lines_per_extruder = (n_loops + n_tools - 1) / n_tools;

// BBS. Extrude skirt with first extruder if min_skirt_length is zero
const PrintConfig &config = print.config();
if (Print::min_skirt_length < EPSILON) {
//ORCA: Always extrude skirt with first extruder, independantly of if the minimum skirt length is zero or not. The code below
// is left as a placeholder for when a multiextruder support is implemented. Then we will need to extrude the skirt loops for each extruder.
//const PrintConfig &config = print.config();
//if (config.min_skirt_length.value < EPSILON) {
skirt_loops_per_extruder_out[layer_tools.extruders.front()] = std::pair<size_t, size_t>(0, n_loops);
} else {
for (size_t i = 0; i < n_loops; i += lines_per_extruder)
skirt_loops_per_extruder_out[layer_tools.extruders[i / lines_per_extruder]] = std::pair<size_t, size_t>(i, std::min(i + lines_per_extruder, n_loops));
}
//} else {
// for (size_t i = 0; i < n_loops; i += lines_per_extruder)
// skirt_loops_per_extruder_out[layer_tools.extruders[i / lines_per_extruder]] = std::pair<size_t, size_t>(i, std::min(i + lines_per_extruder, n_loops));
//}
}

static std::map<unsigned int, std::pair<size_t, size_t>> make_skirt_loops_per_extruder_1st_layer(
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ static std::vector<std::string> s_Preset_print_options {
"inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
"bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
"outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_loops", "skirt_speed", "skirt_distance", "skirt_height", "draft_shield",
"outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_height", "draft_shield",
"brim_width", "brim_object_gap", "brim_type", "brim_ears_max_angle", "brim_ears_detection_length", "enable_support", "support_type", "support_threshold_angle", "enforce_support_layers",
"raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion",
"support_base_pattern", "support_base_pattern_spacing", "support_expansion", "support_style",
Expand Down
10 changes: 6 additions & 4 deletions src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ PrintRegion::PrintRegion(const PrintRegionConfig &config) : PrintRegion(config,
PrintRegion::PrintRegion(PrintRegionConfig &&config) : PrintRegion(std::move(config), config.hash()) {}

//BBS
float Print::min_skirt_length = 0;
// ORCA: Now this is a parameter
//float Print::min_skirt_length = 0;

void Print::clear()
{
Expand Down Expand Up @@ -239,6 +240,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
opt_key == "skirt_loops"
|| opt_key == "skirt_speed"
|| opt_key == "skirt_height"
|| opt_key == "min_skirt_length"
|| opt_key == "draft_shield"
|| opt_key == "skirt_distance"
|| opt_key == "ooze_prevention"
Expand Down Expand Up @@ -2331,15 +2333,15 @@ void Print::_make_skirt()
)));
eloop.paths.back().polyline = loop.split_at_first_point();
m_skirt.append(eloop);
if (Print::min_skirt_length > 0) {
if (m_config.min_skirt_length.value > 0) {
// The skirt length is limited. Sum the total amount of filament length extruded, in mm.
extruded_length[extruder_idx] += unscale<double>(loop.length()) * extruders_e_per_mm[extruder_idx];
if (extruded_length[extruder_idx] < Print::min_skirt_length) {
if (extruded_length[extruder_idx] < m_config.min_skirt_length.value) {
// Not extruded enough yet with the current extruder. Add another loop.
if (i == 1)
++ i;
} else {
assert(extruded_length[extruder_idx] >= Print::min_skirt_length);
assert(extruded_length[extruder_idx] >= m_config.min_skirt_length.value);
// Enough extruded with the current extruder. Extrude with the next one,
// until the prescribed number of skirt loops is extruded.
if (extruder_idx + 1 < extruders.size())
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/Print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,8 @@ class Print : public PrintBaseWithState<PrintStep, psCount>

public:
//BBS: this was a print config and now seems to be useless so we move it to here
static float min_skirt_length;
// ORCA: parameter below is now back to being a user option (min_skirt_length)
//static float min_skirt_length;
};


Expand Down
26 changes: 19 additions & 7 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3802,20 +3802,22 @@ def = this->add("filament_loading_speed", coFloats);
def->set_default_value(new ConfigOptionInt(1));

def = this->add("draft_shield", coEnum);
//def->label = L("Draft shield");
def->label = "Draft shield";
//def->tooltip = L("With draft shield active, the skirt will be printed skirt_distance from the object, possibly intersecting brim.\n"
// "Enabled = skirt is as tall as the highest printed object.\n"
// "Limited = skirt is as tall as specified by skirt_height.\n"
// "This is useful to protect an ABS or ASA print from warping and detaching from print bed due to wind draft.");
def->label = L("Draft shield");
def->tooltip = L("A draft shield is useful to protect an ABS or ASA print from warping and detaching from print bed due to wind draft. "
"It is usually needed only with open frame printers, i.e. without an enclosure. \n\n"
"Options:\n"
"Enabled = skirt is as tall as the highest printed object.\n"
"Limited = skirt is as tall as specified by skirt height.\n\n"
"Note: With the draft shield active, the skirt will be printed at skirt distance from the object. Therefore, if brims "
"are active it may intersect with them. To avoid this, increase the skirt distance value.\n");
def->enum_keys_map = &ConfigOptionEnum<DraftShield>::get_enum_values();
def->enum_values.push_back("disabled");
def->enum_values.push_back("limited");
def->enum_values.push_back("enabled");
def->enum_labels.push_back("Disabled");
def->enum_labels.push_back("Limited");
def->enum_labels.push_back("Enabled");
def->mode = comDevelop;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<DraftShield>(dsDisabled));

def = this->add("skirt_loops", coInt);
Expand All @@ -3835,6 +3837,16 @@ def = this->add("filament_loading_speed", coFloats);
def->sidetext = L("mm/s");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(50.0));

def = this->add("min_skirt_length", coFloat);
def->label = L("Skirt minimum extrusion length");
def->full_label = L("Skirt minimum extrusion length");
def->tooltip = L("Minimum filament extrusion length in mm when printing the skirt. Zero means this feature is disabled.\n\n"
"Using a non zero value is useful if the printer is set up to print without a prime line.");
def->min = 0;
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.0));

def = this->add("slow_down_layer_time", coFloats);
def->label = L("Layer time");
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionInt, skirt_height))
((ConfigOptionInt, skirt_loops))
((ConfigOptionFloat, skirt_speed))
((ConfigOptionFloat, min_skirt_length))
((ConfigOptionFloats, slow_down_layer_time))
((ConfigOptionBool, spiral_mode))
((ConfigOptionBool, spiral_mode_smooth))
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
, config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({
"printable_area", "bed_exclude_area", "bed_custom_texture", "bed_custom_model", "print_sequence",
"extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"nozzle_height", "skirt_loops", "skirt_speed", "skirt_distance",
"nozzle_height", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance",
"brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material", "preferred_orientation",
"enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_volume",
"extruder_colour", "filament_colour", "material_colour", "printable_height", "printer_model", "printer_technology",
Expand Down
7 changes: 5 additions & 2 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2269,12 +2269,15 @@ void TabPrint::build()
optgroup->append_single_option_line("tree_support_brim_width");

page = add_options_page(L("Others"), "advanced");
optgroup = page->new_optgroup(L("Bed adhension"), L"param_adhension");
optgroup = page->new_optgroup(L("Skirt"), L"param_adhension");
optgroup->append_single_option_line("skirt_loops");
optgroup->append_single_option_line("min_skirt_length");
optgroup->append_single_option_line("skirt_distance");
optgroup->append_single_option_line("skirt_height");
optgroup->append_single_option_line("skirt_speed");
//optgroup->append_single_option_line("draft_shield");
optgroup->append_single_option_line("draft_shield");

optgroup = page->new_optgroup(L("Brim"), L"param_adhension");
optgroup->append_single_option_line("brim_type", "auto-brim");
optgroup->append_single_option_line("brim_width", "auto-brim#manual");
optgroup->append_single_option_line("brim_object_gap", "auto-brim#brim-object-gap");
Expand Down
Loading