mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-05 14:20:40 +08:00
FIX:Fix the issue of importing GCode array out of bounds
jira: STUDIO-12389 Change-Id: Id7995558bf0e297e2360b338ffbf63d93efa38f0
This commit is contained in:
parent
6ce4666886
commit
6d15a90057
@ -5442,6 +5442,16 @@ void GCodeProcessor::process_T(const std::string_view command)
|
||||
}
|
||||
|
||||
|
||||
void GCodeProcessor::init_filament_maps_and_nozzle_type_when_import_only_gcode()
|
||||
{
|
||||
if (m_filament_maps.empty()) {
|
||||
m_filament_maps.assign((int) EnforcerBlockerType::ExtruderMax, 1);
|
||||
}
|
||||
if (m_result.nozzle_type.empty()) {
|
||||
m_result.nozzle_type.assign((int) EnforcerBlockerType::ExtruderMax, NozzleType::ntUndefine);
|
||||
}
|
||||
}
|
||||
|
||||
void GCodeProcessor::process_filament_change(int id)
|
||||
{
|
||||
assert(id < m_result.filaments_count);
|
||||
@ -5864,7 +5874,7 @@ void GCodeProcessor::update_slice_warnings()
|
||||
warning.params.clear();
|
||||
warning.level=1;
|
||||
|
||||
std::vector<int>nozzle_hrc_lists(m_result.nozzle_type.size(), 0);
|
||||
std::vector<int> nozzle_hrc_lists(m_result.nozzle_type.size(), 0);
|
||||
// store the nozzle hrc of each extruder
|
||||
for (size_t idx = 0; idx < m_result.nozzle_type.size(); ++idx)
|
||||
nozzle_hrc_lists[idx] = Print::get_hrc_by_nozzle_type(m_result.nozzle_type[idx]);
|
||||
|
@ -1100,7 +1100,7 @@ namespace Slic3r {
|
||||
|
||||
public:
|
||||
GCodeProcessor();
|
||||
|
||||
void init_filament_maps_and_nozzle_type_when_import_only_gcode();
|
||||
// check whether the gcode path meets the filament_map grouping requirements
|
||||
bool check_multi_extruder_gcode_valid(const std::vector<Polygons> &unprintable_areas,
|
||||
const std::vector<double> &printable_heights,
|
||||
@ -1296,7 +1296,6 @@ namespace Slic3r {
|
||||
void process_M1020(const GCodeReader::GCodeLine &line);
|
||||
|
||||
void process_filament_change(int id);
|
||||
|
||||
//BBS: different path_type is only used for arc move
|
||||
void store_move_vertex(EMoveType type, EMovePathType path_type = EMovePathType::Noop_move);
|
||||
|
||||
|
@ -12383,6 +12383,7 @@ void Plater::load_gcode(const wxString& filename)
|
||||
|
||||
// process gcode
|
||||
GCodeProcessor processor;
|
||||
processor.init_filament_maps_and_nozzle_type_when_import_only_gcode();
|
||||
try
|
||||
{
|
||||
processor.process_file(filename.ToUTF8().data());
|
||||
|
Loading…
x
Reference in New Issue
Block a user