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:
authorbubnikv <bubnikv@gmail.com>2018-11-12 17:20:18 +0300
committerbubnikv <bubnikv@gmail.com>2018-11-12 17:20:18 +0300
commit6572e5980f56d6535d3089f4bee14cd414bd5ef5 (patch)
tree12f82dc2b62c0e15ef495dfae07b92d5b5860309
parent440fbb1e74326ed07c4c5388eddc82f9de7abf2e (diff)
Fix of an invalid extruder ID assignment after switching from
a multi-material printer to a single material printer (or a printer with a lower number of extruders).
-rw-r--r--xs/src/libslic3r/Model.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp
index e0097ce2e..9fe855aa1 100644
--- a/xs/src/libslic3r/Model.cpp
+++ b/xs/src/libslic3r/Model.cpp
@@ -455,10 +455,14 @@ void Model::adjust_min_z()
unsigned int Model::get_auto_extruder_id(unsigned int max_extruders)
{
unsigned int id = s_auto_extruder_id;
-
- if (++s_auto_extruder_id > max_extruders)
+ if (id > max_extruders) {
+ // The current counter is invalid, likely due to switching the printer profiles
+ // to a profile with a lower number of extruders.
reset_auto_extruder_id();
-
+ id = s_auto_extruder_id;
+ } else if (++s_auto_extruder_id > max_extruders) {
+ reset_auto_extruder_id();
+ }
return id;
}