Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2018-05-25 17:11:55 +0300
committerLukas Matena <lukasmatena@seznam.cz>2018-05-25 17:11:55 +0300
commitbfe4350a89bea904c39e640b8779542a0a9642d1 (patch)
tree4e9f1375e0883e9e0bf5bc778d01a53ef8307dbd
parent132a67edb21ca0bb5deb77e32de4af0cf92da3a0 (diff)
Calculation of wipe tower reduction corrected, new config option (wipe into infill)
-rw-r--r--xs/src/libslic3r/GCode.cpp41
-rw-r--r--xs/src/libslic3r/Print.cpp35
-rw-r--r--xs/src/libslic3r/PrintConfig.cpp10
-rw-r--r--xs/src/libslic3r/PrintConfig.hpp2
-rw-r--r--xs/src/slic3r/GUI/Preset.cpp3
-rw-r--r--xs/src/slic3r/GUI/Tab.cpp3
6 files changed, 57 insertions, 37 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index 3536c0c9c..0ccc4384e 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -1338,26 +1338,31 @@ void GCode::process_layer(
m_avoid_crossing_perimeters.disable_once = true;
}
- for (const auto& layer_to_print : layers) { // iterate through all objects
- if (layer_to_print.object_layer == nullptr)
- continue;
- std::vector<ObjectByExtruder::Island::Region> overridden;
- for (size_t region_id = 0; region_id < print.regions.size(); ++ region_id) {
- ObjectByExtruder::Island::Region new_region;
- overridden.push_back(new_region);
- for (ExtrusionEntity *ee : (*layer_to_print.object_layer).regions[region_id]->fills.entities) {
- auto *fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
- if (fill->get_extruder_override() == extruder_id) {
- overridden.back().infills.append(*fill);
- fill->set_extruder_override(-1);
- }
- }
- m_config.apply((layer_to_print.object_layer)->object()->config, true);
- Point copy = (layer_to_print.object_layer)->object()->_shifted_copies.front();
- this->set_origin(unscale(copy.x), unscale(copy.y));
- gcode += this->extrude_infill(print, overridden);
+ gcode += "; INFILL WIPING STARTS\n";
+
+ if (extruder_id != layer_tools.extruders.front()) { // if this is the first extruder on this layer, there was no toolchange
+ for (const auto& layer_to_print : layers) { // iterate through all objects
+ if (layer_to_print.object_layer == nullptr)
+ continue;
+ std::vector<ObjectByExtruder::Island::Region> overridden;
+ for (size_t region_id = 0; region_id < print.regions.size(); ++ region_id) {
+ ObjectByExtruder::Island::Region new_region;
+ overridden.push_back(new_region);
+ for (ExtrusionEntity *ee : (*layer_to_print.object_layer).regions[region_id]->fills.entities) {
+ auto *fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
+ if (fill->get_extruder_override() == extruder_id) {
+ overridden.back().infills.append(*fill);
+ fill->set_extruder_override(-1);
+ }
+ }
+ m_config.apply((layer_to_print.object_layer)->object()->config, true);
+ Point copy = (layer_to_print.object_layer)->object()->_shifted_copies.front();
+ this->set_origin(unscale(copy.x), unscale(copy.y));
+ gcode += this->extrude_infill(print, overridden);
+ }
}
}
+ gcode += "; WIPING FINISHED\n";
auto objects_by_extruder_it = by_extruder.find(extruder_id);
diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index 64bfb45ca..e09cafa56 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -1142,28 +1142,31 @@ void Print::_make_wipe_tower()
// we run out of the volume (or infills)
const float min_infill_volume = 0.f;
- if (config.filament_soluble.get_at(extruder_id)) // soluble filament cannot be wiped in a random infill
- continue;
-
float volume_to_wipe = wipe_volumes[current_extruder_id][extruder_id];
-
- for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects...
- for (Layer* lay : objects[i]->layers) {
- for (LayerRegion* reg : lay->regions) { // and all regions
- ExtrusionEntityCollection& eec = reg->fills;
- for (ExtrusionEntity* ee : eec.entities) { // and all infill Collections
- auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
- if (volume_to_wipe > 0.f && !fill->is_extruder_overridden() && fill->total_volume() > min_infill_volume) { // this infill will be used to wipe this extruder
- fill->set_extruder_override(extruder_id);
- volume_to_wipe -= fill->total_volume();
- }
+ float saved_material = 0.f;
+
+ // soluble filament cannot be wiped in a random infill, first layer is potentionally visible too
+ if (!first_layer && !config.filament_soluble.get_at(extruder_id)) {
+ for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects...
+ for (Layer* lay : objects[i]->layers) {
+ if (std::abs(layer_tools.print_z - lay->print_z) > EPSILON) continue;
+ for (LayerRegion* reg : lay->regions) { // and all regions
+ ExtrusionEntityCollection& eec = reg->fills;
+ for (ExtrusionEntity* ee : eec.entities) { // and all infill Collections
+ auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
+ if (fill->role() == erTopSolidInfill) continue;
+ if (volume_to_wipe > 0.f && !fill->is_extruder_overridden() && fill->total_volume() > min_infill_volume) { // this infill will be used to wipe this extruder
+ fill->set_extruder_override(extruder_id);
+ volume_to_wipe -= fill->total_volume();
+ }
+ }
}
}
}
}
- float saved_material = wipe_volumes[current_extruder_id][extruder_id] - std::max(0.f, volume_to_wipe);
- std::cout << volume_to_wipe << "\t(saved " << saved_material << ")" << std::endl;
+ saved_material = wipe_volumes[current_extruder_id][extruder_id] - std::max(0.f, volume_to_wipe);
+ std::cout << layer_tools.print_z << "\t" << extruder_id << "\t" << wipe_volumes[current_extruder_id][extruder_id] - volume_to_wipe << "\n";
wipe_tower.plan_toolchange(layer_tools.print_z, layer_tools.wipe_tower_layer_height, current_extruder_id, extruder_id, first_layer && extruder_id == m_tool_ordering.all_extruders().back(), saved_material);
current_extruder_id = extruder_id;
diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp
index e3cbf5243..bf9421f9d 100644
--- a/xs/src/libslic3r/PrintConfig.cpp
+++ b/xs/src/libslic3r/PrintConfig.cpp
@@ -1884,7 +1884,15 @@ PrintConfigDef::PrintConfigDef()
def->sidetext = L("degrees");
def->cli = "wipe-tower-rotation-angle=f";
def->default_value = new ConfigOptionFloat(0.);
-
+
+ def = this->add("wipe_into_infill", coBool);
+ def->label = L("Wiping into infill");
+ def->tooltip = L("Wiping after toolchange will be preferentially done inside infills. "
+ "This lowers the amount of waste but may result in longer print time "
+ " due to additional travel moves.");
+ def->cli = "wipe-into-infill!";
+ def->default_value = new ConfigOptionBool(true);
+
def = this->add("wipe_tower_bridging", coFloat);
def->label = L("Maximal bridging distance");
def->tooltip = L("Maximal distance between supports on sparse infill sections. ");
diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp
index a36e5def9..1b73c31b3 100644
--- a/xs/src/libslic3r/PrintConfig.hpp
+++ b/xs/src/libslic3r/PrintConfig.hpp
@@ -642,6 +642,7 @@ public:
ConfigOptionFloat wipe_tower_per_color_wipe;
ConfigOptionFloat wipe_tower_rotation_angle;
ConfigOptionFloat wipe_tower_bridging;
+ ConfigOptionBool wipe_into_infill;
ConfigOptionFloats wiping_volumes_matrix;
ConfigOptionFloats wiping_volumes_extruders;
ConfigOptionFloat z_offset;
@@ -710,6 +711,7 @@ protected:
OPT_PTR(wipe_tower_width);
OPT_PTR(wipe_tower_per_color_wipe);
OPT_PTR(wipe_tower_rotation_angle);
+ OPT_PTR(wipe_into_infill);
OPT_PTR(wipe_tower_bridging);
OPT_PTR(wiping_volumes_matrix);
OPT_PTR(wiping_volumes_extruders);
diff --git a/xs/src/slic3r/GUI/Preset.cpp b/xs/src/slic3r/GUI/Preset.cpp
index ce6918406..e483381ac 100644
--- a/xs/src/slic3r/GUI/Preset.cpp
+++ b/xs/src/slic3r/GUI/Preset.cpp
@@ -298,7 +298,8 @@ const std::vector<std::string>& Preset::print_options()
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio", "clip_multipart_objects",
"elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y",
- "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "compatible_printers", "compatible_printers_condition","inherits"
+ "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "wipe_into_infill", "compatible_printers",
+ "compatible_printers_condition","inherits"
};
return s_opts;
}
diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp
index b3e737f6e..c94307aa4 100644
--- a/xs/src/slic3r/GUI/Tab.cpp
+++ b/xs/src/slic3r/GUI/Tab.cpp
@@ -945,6 +945,7 @@ void TabPrint::build()
optgroup->append_single_option_line("wipe_tower_width");
optgroup->append_single_option_line("wipe_tower_rotation_angle");
optgroup->append_single_option_line("wipe_tower_bridging");
+ optgroup->append_single_option_line("wipe_into_infill");
optgroup = page->new_optgroup(_(L("Advanced")));
optgroup->append_single_option_line("interface_shells");
@@ -1233,7 +1234,7 @@ void TabPrint::update()
get_field("standby_temperature_delta")->toggle(have_ooze_prevention);
bool have_wipe_tower = m_config->opt_bool("wipe_tower");
- for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging"})
+ for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_into_infill", "wipe_tower_bridging"})
get_field(el)->toggle(have_wipe_tower);
m_recommended_thin_wall_thickness_description_line->SetText(