FIX: add get_used_extruders interface

Change-Id: I03f0dca933c0aa9de893bc86b268ea727eeee9fb
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-12-16 15:12:52 +08:00 committed by Lane.Wei
parent aae57b32e4
commit c6152a70e9
3 changed files with 24 additions and 1 deletions

View file

@ -1198,6 +1198,28 @@ std::vector<int> PartPlate::get_extruders() const
return plate_extruders; return plate_extruders;
} }
std::vector<int> PartPlate::get_used_extruders()
{
std::vector<int> used_extruders;
// if gcode.3mf file
if (m_model->objects.empty()) {
for (int i = 0; i < slice_filaments_info.size(); i++) {
used_extruders.push_back(slice_filaments_info[i].id + 1);
}
return used_extruders;
}
GCodeProcessorResult* result = get_slice_result();
if (!result)
return used_extruders;
PrintEstimatedStatistics& ps = result->print_statistics;
for (auto it = ps.volumes_per_extruder.begin(); it != ps.volumes_per_extruder.end(); it++) {
used_extruders.push_back(it->first + 1);
}
return used_extruders;
}
Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volume) const Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volume) const
{ {
Vec3d wipe_tower_size; Vec3d wipe_tower_size;

View file

@ -259,6 +259,7 @@ public:
Vec3d get_origin() { return m_origin; } Vec3d get_origin() { return m_origin; }
Vec3d estimate_wipe_tower_size(const double w, const double wipe_volume) const; Vec3d estimate_wipe_tower_size(const double w, const double wipe_volume) const;
std::vector<int> get_extruders() const; std::vector<int> get_extruders() const;
std::vector<int> get_used_extruders();
/* instance related operations*/ /* instance related operations*/
//judge whether instance is bound in plate or not //judge whether instance is bound in plate or not

View file

@ -2930,7 +2930,7 @@ void SelectMachineDialog::set_default()
} }
// material info // material info
auto extruders = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_extruders(); auto extruders = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders();
BitmapCache bmcache; BitmapCache bmcache;
MaterialHash::iterator iter = m_materialList.begin(); MaterialHash::iterator iter = m_materialList.begin();