ENH: add tpu check before slicing
jira: none Change-Id: I7d4f053e67f4a4aa22ef990d597d28cb894c4195
This commit is contained in:
parent
a08d79c7c5
commit
60cdf3b655
|
@ -1858,6 +1858,30 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns)
|
|||
return filament_presets.size();
|
||||
}
|
||||
|
||||
std::vector<int> PresetBundle::get_used_tpu_filaments(const std::vector<int> &used_filaments)
|
||||
{
|
||||
std::vector<int> tpu_filaments;
|
||||
for (size_t i = 0; i < this->filament_presets.size(); ++i) {
|
||||
auto iter = std::find(used_filaments.begin(), used_filaments.end(), i + 1);
|
||||
if (iter == used_filaments.end()) continue;
|
||||
|
||||
std::string filament_name = this->filament_presets[i];
|
||||
for (int f_index = 0; f_index < this->filaments.size(); f_index++) {
|
||||
PresetCollection *filament_presets = &this->filaments;
|
||||
Preset *preset = &filament_presets->preset(f_index);
|
||||
int size = this->filaments.size();
|
||||
if (preset && filament_name.compare(preset->name) == 0) {
|
||||
std::string display_filament_type;
|
||||
std::string filament_type = preset->config.get_filament_type(display_filament_type);
|
||||
if (display_filament_type == "TPU") {
|
||||
tpu_filaments.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tpu_filaments;
|
||||
}
|
||||
|
||||
void PresetBundle::set_calibrate_printer(std::string name)
|
||||
{
|
||||
if (name.empty()) {
|
||||
|
|
|
@ -100,6 +100,7 @@ public:
|
|||
//BBS: check whether this is the only edited filament
|
||||
bool is_the_only_edited_filament(unsigned int filament_index);
|
||||
|
||||
std::vector<int> get_used_tpu_filaments(const std::vector<int> &used_filaments);
|
||||
void set_calibrate_printer(std::string name);
|
||||
|
||||
std::vector<std::vector<DynamicPrintConfig>> get_extruder_filament_info() const;
|
||||
|
|
|
@ -2876,7 +2876,11 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
//if (printer_technology != ptSLA || !contained_min_one)
|
||||
// _set_warning_notification(EWarning::SlaSupportsOutside, false);
|
||||
|
||||
bool model_fits = contained_min_one && !m_model->objects.empty() && !partlyOut && object_results.filaments.empty();
|
||||
PartPlate* cur_plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
||||
bool tpu_valid = cur_plate->check_tpu_printable_status(m_config, wxGetApp().preset_bundle->get_used_tpu_filaments(cur_plate->get_extruders(true)));
|
||||
_set_warning_notification(EWarning::TPUPrintableError, !tpu_valid);
|
||||
|
||||
bool model_fits = contained_min_one && !m_model->objects.empty() && !partlyOut && object_results.filaments.empty() && tpu_valid;
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, model_fits));
|
||||
ppl.get_curr_plate()->update_slice_ready_status(model_fits);
|
||||
}
|
||||
|
@ -2885,7 +2889,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
_set_warning_notification(EWarning::ObjectClashed, false);
|
||||
_set_warning_notification(EWarning::ObjectLimited, false);
|
||||
//_set_warning_notification(EWarning::SlaSupportsOutside, false);
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
|
||||
_set_warning_notification(EWarning::TPUPrintableError, false);
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9667,8 +9672,16 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
|||
case EWarning::ObjectOutside: text = _u8L("An object is layed over the boundary of plate."); break;
|
||||
case EWarning::ToolHeightOutside: text = _u8L("A G-code path goes beyond the max print height."); error = ErrorType::SLICING_ERROR; break;
|
||||
case EWarning::ToolpathOutside: text = _u8L("A G-code path goes beyond the boundary of plate."); error = ErrorType::SLICING_ERROR; break;
|
||||
case EWarning::TPUPrintableError: {
|
||||
int master_extruder_id = 0; // main extruder is left or right
|
||||
if (m_config->has("master_extruder_id"))
|
||||
master_extruder_id = m_config->opt_int("master_extruder_id"); // base 1
|
||||
std::string extruder_name = master_extruder_id == 1 ? "Left extruder" : "Right extruder";
|
||||
text = (boost::format(_u8L("Multiple TPU filaments are not allowed to print at the same time, and the TPU filament must be placed in the virtual slot of %s.")) %extruder_name).str();
|
||||
error = ErrorType::SLICING_ERROR;
|
||||
break;
|
||||
}
|
||||
case EWarning::MultiExtruderPrintableError: {
|
||||
text.clear();
|
||||
int master_extruder_id = 0; // main extruder is left or right
|
||||
if (m_config->has("master_extruder_id"))
|
||||
master_extruder_id = m_config->opt_int("master_extruder_id") - 1;
|
||||
|
|
|
@ -379,6 +379,7 @@ class GLCanvas3D
|
|||
ObjectLimited,
|
||||
GCodeConflict,
|
||||
ToolHeightOutside,
|
||||
TPUPrintableError,
|
||||
MultiExtruderPrintableError, // after slice
|
||||
FilamentUnPrintableOnFirstLayer
|
||||
};
|
||||
|
|
|
@ -1252,6 +1252,29 @@ std::vector<int> PartPlate::get_used_extruders()
|
|||
return std::vector(used_extruders_set.begin(), used_extruders_set.end());
|
||||
}
|
||||
|
||||
bool PartPlate::check_tpu_printable_status(const DynamicPrintConfig *config, const std::vector<int> &tpu_filaments)
|
||||
{
|
||||
bool tpu_valid = true;
|
||||
|
||||
if (!tpu_filaments.empty()) {
|
||||
if (tpu_filaments.size() > 1)
|
||||
tpu_valid = false;
|
||||
else if (get_filament_map_mode() == FilamentMapMode::fmmManual) {
|
||||
if (config->has("master_extruder_id")) {
|
||||
int tpu_filament_id = *tpu_filaments.begin();
|
||||
std::vector<int> filament_map = get_filament_maps();
|
||||
int extruder_id = filament_map[tpu_filament_id];
|
||||
|
||||
int master_extruder_id = config->opt_int("master_extruder_id"); // base 1
|
||||
if (master_extruder_id != extruder_id)
|
||||
tpu_valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tpu_valid;
|
||||
}
|
||||
|
||||
Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size, bool use_global_objects) const
|
||||
{
|
||||
Vec3d wipe_tower_size;
|
||||
|
|
|
@ -296,6 +296,7 @@ public:
|
|||
std::vector<int> get_extruders_without_support(bool conside_custom_gcode = false) const;
|
||||
// get used filaments, 1 based idx
|
||||
std::vector<int> get_used_extruders();
|
||||
bool check_tpu_printable_status(const DynamicPrintConfig *config, const std::vector<int> &tpu_filaments);
|
||||
|
||||
/* instance related operations*/
|
||||
//judge whether instance is bound in plate or not
|
||||
|
|
Loading…
Reference in New Issue