ENH: generate wipe tower when custom change gcode filament

Change-Id: Ia0c81453f09457a9d1d56fbcdce79112953c0208
This commit is contained in:
zhimin.zeng 2022-12-16 18:06:28 +08:00 committed by Lane.Wei
parent 75c5d7b267
commit 4284d2ddb0
10 changed files with 58 additions and 11 deletions

View file

@ -327,10 +327,18 @@ std::vector<unsigned int> Print::support_material_extruders() const
}
// returns 0-based indices of used extruders
std::vector<unsigned int> Print::extruders() const
std::vector<unsigned int> Print::extruders(bool conside_custom_gcode) const
{
std::vector<unsigned int> extruders = this->object_extruders();
append(extruders, this->support_material_extruders());
if (conside_custom_gcode) {
for (auto item : m_model.custom_gcode_per_print_z.gcodes) {
if (item.type == CustomGCode::Type::ToolChange)
extruders.push_back((unsigned int)item.extruder);
}
}
sort_remove_duplicates(extruders);
return extruders;
}

View file

@ -660,7 +660,7 @@ public:
std::vector<unsigned int> object_extruders() const;
std::vector<unsigned int> support_material_extruders() const;
std::vector<unsigned int> extruders() const;
std::vector<unsigned int> extruders(bool conside_custom_gcode = false) const;
double max_allowed_layer_height() const;
bool has_support_material() const;
// Make sure the background processing has no access to this model_object during this call!

View file

@ -1020,7 +1020,8 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
new_full_config.option("filament_settings_id", true);
new_full_config.option("printer_settings_id", true);
// BBS
int used_filaments = this->extruders().size();
int used_filaments = this->extruders(true).size();
//new_full_config.normalize_fdm(used_filaments);
new_full_config.normalize_fdm_1();
t_config_option_keys changed_keys = new_full_config.normalize_fdm_2(used_filaments);
@ -1413,7 +1414,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
}
//BBS: check the config again
int new_used_filaments = this->extruders().size();
int new_used_filaments = this->extruders(true).size();
t_config_option_keys new_changed_keys = new_full_config.normalize_fdm_2(new_used_filaments);
if (new_changed_keys.size() > 0) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got new_changed_keys, size=%1%")%new_changed_keys.size();

View file

@ -2883,7 +2883,7 @@ void PrintConfigDef::init_fff_params()
//def->sidetext = L("mm");
def->mode = comDevelop;
// BBS: change data type to floats to add partplate logic
def->set_default_value(new ConfigOptionFloats{ 240. });
def->set_default_value(new ConfigOptionFloats{ 220. });
def = this->add("prime_tower_width", coFloat);
def->label = L("Width");