FIX:only show the material used in the actual printing

Change-Id: I44edd5ffb54376da91077e2e3d990851af050949
This commit is contained in:
tao wang 2022-09-13 14:41:09 +08:00 committed by Lane.Wei
parent 07d234825e
commit b9b3f7b4c1
3 changed files with 18 additions and 1 deletions

View File

@ -831,6 +831,11 @@ void GCodeViewer::update_by_mode(ConfigOptionMode mode)
}
}
std::vector<int> GCodeViewer::get_plater_extruder()
{
return m_plater_extruder;
}
//BBS: always load shell at preview
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print, const BuildVolume& build_volume,
const std::vector<BoundingBoxf3>& exclude_bounding_box, bool initialized, ConfigOptionMode mode, bool only_gcode)
@ -2924,6 +2929,14 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result, const
sort_remove_duplicates(m_extruder_ids);
m_extruder_ids.shrink_to_fit();
std::vector<int> plater_extruder;
for (auto mid : m_extruder_ids){
int eid = mid;
plater_extruder.push_back(++eid);
}
m_plater_extruder = plater_extruder;
// set layers z range
if (!m_layers.empty())
m_layers_z_range = { 0, static_cast<unsigned int>(m_layers.size() - 1) };

View File

@ -711,6 +711,7 @@ public:
};
private:
std::vector<int> m_plater_extruder;
bool m_gl_data_initialized{ false };
unsigned int m_last_result_id{ 0 };
size_t m_moves_count{ 0 };
@ -800,6 +801,7 @@ public:
bool has_data() const { return !m_roles.empty(); }
bool can_export_toolpaths() const;
std::vector<int> get_plater_extruder();
const BoundingBoxf3& get_paths_bounding_box() const { return m_paths_bounding_box; }
const BoundingBoxf3& get_max_bounding_box() const { return m_max_bounding_box; }

View File

@ -2214,7 +2214,9 @@ void SelectMachineDialog::set_default()
}
// material info
auto extruders = m_plater->get_partplate_list().get_curr_plate()->get_extruders();
//auto extruders1 = m_plater->get_partplate_list().get_curr_plate()->get_extruders();
auto extruders = wxGetApp().plater()->get_current_canvas3D()->get_gcode_viewer().get_plater_extruder();
BitmapCache bmcache;
MaterialHash::iterator iter = m_materialList.begin();