mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-17 09:52:36 -07:00
ENH: add tpu check before slicing
jira: none Change-Id: I7d4f053e67f4a4aa22ef990d597d28cb894c4195 (cherry picked from commit 60cdf3b6551a8c18c10db0a746e1b15b764eda66)
This commit is contained in:
parent
5dda30f9cc
commit
6599f37c83
6 changed files with 66 additions and 3 deletions
|
|
@ -1992,6 +1992,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()) {
|
||||
|
|
|
|||
|
|
@ -120,6 +120,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);
|
||||
// Orca: update selected filament and print
|
||||
void update_selections(AppConfig &config);
|
||||
void set_calibrate_printer(std::string name);
|
||||
|
|
|
|||
|
|
@ -2870,7 +2870,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);
|
||||
}
|
||||
|
|
@ -2879,7 +2883,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9744,8 +9749,16 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
|||
case EWarning::ObjectOutside: text = _u8L("An object is laid over the plate boundaries."); 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 plate boundaries."); 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;
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ class GLCanvas3D
|
|||
ObjectLimited,
|
||||
GCodeConflict,
|
||||
ToolHeightOutside,
|
||||
TPUPrintableError,
|
||||
MultiExtruderPrintableError, // after slice
|
||||
FilamentUnPrintableOnFirstLayer
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1675,6 +1675,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 d, int plate_extruder_size, bool use_global_objects) const
|
||||
{
|
||||
Vec3d wipe_tower_size;
|
||||
|
|
|
|||
|
|
@ -312,6 +312,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…
Add table
Add a link
Reference in a new issue