ENH: add filament alias to a print warning
Change-Id: Ie7a2e0cbdd016c2120c46cde9a92a93baffbe832 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
8f9d8b55eb
commit
bdab8a28c9
|
@ -1098,9 +1098,15 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { format(L("Plate %d: %s does not support filament %s.\n"), this->get_plate_index() + 1,
|
StringObjectException except;
|
||||||
L(bed_type_name), extruder_id + 1) };
|
except.string = format(L("Plate %d: %s does not support filament %s\n"), this->get_plate_index() + 1, L(bed_type_name), extruder_id + 1);
|
||||||
|
except.type = STRING_EXCEPT_FILAMENT_NOT_MATCH_BED_TYPE;
|
||||||
|
except.params.push_back(std::to_string(this->get_plate_index() + 1));
|
||||||
|
except.params.push_back(L(bed_type_name));
|
||||||
|
except.params.push_back(std::to_string(extruder_id+1));
|
||||||
|
except.object = nullptr;
|
||||||
|
return except;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,20 @@
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
enum StringExceptionType {
|
||||||
|
STRING_EXCEPT_NOT_DEFINED = 0,
|
||||||
|
STRING_EXCEPT_FILAMENT_NOT_MATCH_BED_TYPE = 1,
|
||||||
|
STRING_EXCEPT_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
// BBS: error with object
|
// BBS: error with object
|
||||||
struct StringObjectException
|
struct StringObjectException
|
||||||
{
|
{
|
||||||
std::string string;
|
std::string string;
|
||||||
ObjectBase const *object = nullptr;
|
ObjectBase const *object = nullptr;
|
||||||
std::string opt_key;
|
std::string opt_key;
|
||||||
|
StringExceptionType type; // warning type for tips
|
||||||
|
std::vector<std::string> params; // warning params for tips
|
||||||
};
|
};
|
||||||
|
|
||||||
class CanceledException : public std::exception
|
class CanceledException : public std::exception
|
||||||
|
|
|
@ -4103,6 +4103,8 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||||
Polygons polygons;
|
Polygons polygons;
|
||||||
std::vector<std::pair<Polygon, float>> height_polygons;
|
std::vector<std::pair<Polygon, float>> height_polygons;
|
||||||
StringObjectException err = background_process.validate(&warning, &polygons, &height_polygons);
|
StringObjectException err = background_process.validate(&warning, &polygons, &height_polygons);
|
||||||
|
// update string by type
|
||||||
|
q->post_process_string_object_exception(err);
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": validate err=%1%, warning=%2%")%err.string%warning.string;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": validate err=%1%, warning=%2%")%err.string%warning.string;
|
||||||
|
|
||||||
if (err.string.empty()) {
|
if (err.string.empty()) {
|
||||||
|
@ -10426,6 +10428,8 @@ void Plater::validate_current_plate(bool& model_fits, bool& validate_error)
|
||||||
Polygons polygons;
|
Polygons polygons;
|
||||||
std::vector<std::pair<Polygon, float>> height_polygons;
|
std::vector<std::pair<Polygon, float>> height_polygons;
|
||||||
StringObjectException err = p->background_process.validate(&warning, &polygons, &height_polygons);
|
StringObjectException err = p->background_process.validate(&warning, &polygons, &height_polygons);
|
||||||
|
// update string by type
|
||||||
|
post_process_string_object_exception(err);
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": validate err=%1%, warning=%2%, model_fits %3%")%err.string%warning.string %model_fits;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": validate err=%1%, warning=%2%, model_fits %3%")%err.string%warning.string %model_fits;
|
||||||
|
|
||||||
if (err.string.empty()) {
|
if (err.string.empty()) {
|
||||||
|
@ -10754,6 +10758,29 @@ bool Plater::show_publish_dialog(bool show)
|
||||||
return p->show_publish_dlg(show);
|
return p->show_publish_dlg(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::post_process_string_object_exception(StringObjectException &err)
|
||||||
|
{
|
||||||
|
if (err.type == StringExceptionType::STRING_EXCEPT_FILAMENT_NOT_MATCH_BED_TYPE) {
|
||||||
|
try {
|
||||||
|
int extruder_id = atoi(err.params[2].c_str()) - 1;
|
||||||
|
if (extruder_id < wxGetApp().preset_bundle->filament_presets.size()) {
|
||||||
|
std::string filament_name = wxGetApp().preset_bundle->filament_presets[extruder_id];
|
||||||
|
for (auto filament : wxGetApp().preset_bundle->filaments) {
|
||||||
|
if (filament.name == filament_name) {
|
||||||
|
filament_name = filament.alias;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err.string = format(L("Plate %d: %s does not support filament %s (%s).\n"), err.params[0], err.params[1], err.params[2], filament_name);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if ENABLE_ENVIRONMENT_MAP
|
#if ENABLE_ENVIRONMENT_MAP
|
||||||
void Plater::init_environment_texture()
|
void Plater::init_environment_texture()
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "Jobs/PrintJob.hpp"
|
#include "Jobs/PrintJob.hpp"
|
||||||
#include "Jobs/SendJob.hpp"
|
#include "Jobs/SendJob.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
|
#include "libslic3r/PrintBase.hpp"
|
||||||
|
|
||||||
#define FILAMENT_SYSTEM_COLORS_NUM 16
|
#define FILAMENT_SYSTEM_COLORS_NUM 16
|
||||||
|
|
||||||
|
@ -504,6 +505,8 @@ public:
|
||||||
void show_object_info();
|
void show_object_info();
|
||||||
//BBS
|
//BBS
|
||||||
bool show_publish_dialog(bool show = true);
|
bool show_publish_dialog(bool show = true);
|
||||||
|
//BBS: post process string object exception strings by warning types
|
||||||
|
void post_process_string_object_exception(StringObjectException &err);
|
||||||
|
|
||||||
#if ENABLE_ENVIRONMENT_MAP
|
#if ENABLE_ENVIRONMENT_MAP
|
||||||
void init_environment_texture();
|
void init_environment_texture();
|
||||||
|
|
Loading…
Reference in New Issue