ENH: refine some logic when loading 3mf

1. old 3mf judge logic improvement
2. some 3mf doesn't include gcode and geometry, treat it as empty
   project

Change-Id: I9b3f3d04e32ae6ff273ec1ae04c04ac6329487f0
This commit is contained in:
lane.wei 2023-03-21 10:34:05 +08:00 committed by Lane.Wei
parent 0b1ccb8708
commit 9e077b2e65
2 changed files with 15 additions and 10 deletions

View File

@ -1718,7 +1718,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
for (auto connector : cut_object_info->second.connectors) {
assert(0 <= connector.volume_id && connector.volume_id <= int(model_object->volumes.size()));
model_object->volumes[connector.volume_id]->cut_info =
model_object->volumes[connector.volume_id]->cut_info =
ModelVolume::CutInfo(CutConnectorType(connector.type), connector.r_tolerance, connector.h_tolerance, true);
}
}
@ -3270,7 +3270,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool _BBS_3MF_Importer::_handle_end_metadata()
{
if ((m_curr_metadata_name == BBS_3MF_VERSION)||(m_curr_metadata_name == BBS_3MF_VERSION1)) {
m_is_bbl_3mf = true;
//m_is_bbl_3mf = true;
m_version = (unsigned int)atoi(m_curr_characters.c_str());
/*if (m_check_version && (m_version > VERSION_BBS_3MF_COMPATIBLE)) {
// std::string msg = _(L("The selected 3mf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatible."));

View File

@ -2335,16 +2335,21 @@ int PartPlate::load_gcode_from_file(const std::string& filename)
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("Failed to rename the output G-code file from %1% to %2%, error code %3%") % filename.c_str() % path.c_str() %
//error.message(); return -1;
//}
if (boost::filesystem::exists(filename)) {
assert(m_tmp_gcode_path.empty());
m_tmp_gcode_path = filename;
m_gcode_result->filename = filename;
m_print->set_gcode_file_ready();
if (boost::filesystem::exists(filename)) {
assert(m_tmp_gcode_path.empty());
m_tmp_gcode_path = filename;
m_gcode_result->filename = filename;
m_print->set_gcode_file_ready();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": from %1% to %2%, finished") % filename.c_str() % filename.c_str();
}
update_slice_result_valid_state(true);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": found valid gcode file %1%") % filename.c_str();
}
else {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": can not find gcode file %1%") % filename.c_str();
ret = -1;
}
update_slice_result_valid_state(true);
m_ready_for_slice = true;
return ret;
}