ENH: Pass ams information for slicing

jira: none
Change-Id: I3fe12189b6e8246fd553dcd8659bf7f98e622767
This commit is contained in:
zhimin.zeng 2024-09-06 17:42:38 +08:00 committed by lane.wei
parent fd257a2910
commit b620a4122e
4 changed files with 29 additions and 3 deletions

View File

@ -1881,6 +1881,23 @@ void PresetBundle::set_calibrate_printer(std::string name)
}
}
std::vector<std::vector<DynamicPrintConfig>> PresetBundle::get_extruder_filament_info() const
{
std::vector<std::vector<DynamicPrintConfig>> filament_infos;
int extruder_nums = get_printer_extruder_count();
if (extruder_nums > 1) {
filament_infos.resize(extruder_nums, std::vector<DynamicPrintConfig>());
for (auto ams_item : filament_ams_list) {
if (ams_item.first & 0x10000) { // right
filament_infos[1].push_back(ams_item.second);
} else { // left
filament_infos[0].push_back(ams_item.second);
}
}
}
return filament_infos;
}
std::set<std::string> PresetBundle::get_printer_names_by_printer_type_and_nozzle(const std::string &printer_type, std::string nozzle_diameter_str)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "printer_type: " << printer_type << "nozzle_diameter_str" << nozzle_diameter_str;
@ -2007,9 +2024,9 @@ bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
return true;
}
int PresetBundle::get_printer_extruder_count()
int PresetBundle::get_printer_extruder_count() const
{
Preset& printer_preset = this->printers.get_edited_preset();
const Preset& printer_preset = this->printers.get_edited_preset();
int count = printer_preset.config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();

View File

@ -102,6 +102,8 @@ public:
void set_calibrate_printer(std::string name);
std::vector<std::vector<DynamicPrintConfig>> get_extruder_filament_info() const;
std::set<std::string> get_printer_names_by_printer_type_and_nozzle(const std::string &printer_type, std::string nozzle_diameter_str);
bool check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(const std::string &printer_type,
std::string & nozzle_diameter_str,
@ -158,7 +160,7 @@ public:
DynamicPrintConfig full_config_secure(std::vector<int> filament_maps = std::vector<int>()) const;
//BBS: add some functions for multiple extruders
int get_printer_extruder_count();
int get_printer_extruder_count() const;
bool support_different_extruders();
// Load user configuration and store it into the user profiles.

View File

@ -828,6 +828,10 @@ public:
// get the group label of filament
size_t get_extruder_id(unsigned int filament_id) const;
const std::vector<std::vector<DynamicPrintConfig>>& get_extruder_filament_info() const { return m_extruder_filament_info; }
void set_extruder_filament_info(const std::vector<std::vector<DynamicPrintConfig>>& filament_info) { m_extruder_filament_info = filament_info; }
// 1 based ids
const std::vector<std::vector<int>>& get_unprintable_filament_ids() const { return m_unprintable_filament_ids; }
void set_unprintable_filament_ids(const std::vector<std::vector<int>> &filament_ids) { m_unprintable_filament_ids = filament_ids; }
@ -936,6 +940,8 @@ private:
Polygon m_first_layer_convex_hull;
Points m_skirt_convex_hull;
std::vector<std::vector<DynamicPrintConfig>> m_extruder_filament_info;
// Following section will be consumed by the GCodeGenerator.
ToolOrdering m_tool_ordering;
WipeTowerData m_wipe_tower_data {m_tool_ordering};

View File

@ -5492,6 +5492,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
PartPlate* cur_plate = background_process.get_current_plate();
std::vector<int> f_maps = cur_plate->get_filament_maps();
invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false, f_maps));
background_process.fff_print()->set_extruder_filament_info(wxGetApp().preset_bundle->get_extruder_filament_info());
}
else
invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false));