mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 03:25:53 +08:00
Add invalid state toolpath_outside and display it accordingly
This commit is contained in:
parent
5e6a721683
commit
6001759e6c
@ -35,7 +35,8 @@ enum class PrintStatus {
|
||||
finished,
|
||||
outside,
|
||||
invalid,
|
||||
empty
|
||||
empty,
|
||||
toolpath_outside
|
||||
};
|
||||
|
||||
bool is_sliceable(const PrintStatus status);
|
||||
|
@ -1022,8 +1022,12 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
|
||||
});
|
||||
m_paths_bounding_box = BoundingBoxf3(libvgcode::convert(bbox[0]).cast<double>(), libvgcode::convert(bbox[1]).cast<double>());
|
||||
|
||||
if (wxGetApp().is_editor())
|
||||
if (wxGetApp().is_editor()) {
|
||||
m_contained_in_bed = wxGetApp().plater()->build_volume().all_paths_inside(gcode_result, m_paths_bounding_box);
|
||||
if (!m_contained_in_bed) {
|
||||
s_print_statuses[s_multiple_beds.get_active_bed()] = PrintStatus::toolpath_outside;
|
||||
}
|
||||
}
|
||||
|
||||
m_extruders_count = gcode_result.extruders_count;
|
||||
m_sequential_view.gcode_window.load_gcode(gcode_result);
|
||||
@ -1115,6 +1119,9 @@ void GCodeViewer::load_as_preview(libvgcode::GCodeInputData&& data)
|
||||
const libvgcode::AABox bbox = m_viewer.get_extrusion_bounding_box();
|
||||
const BoundingBoxf3 paths_bounding_box(libvgcode::convert(bbox[0]).cast<double>(), libvgcode::convert(bbox[1]).cast<double>());
|
||||
m_contained_in_bed = wxGetApp().plater()->build_volume().all_paths_inside(GCodeProcessorResult(), paths_bounding_box);
|
||||
if (!m_contained_in_bed) {
|
||||
s_print_statuses[s_multiple_beds.get_active_bed()] = PrintStatus::toolpath_outside;
|
||||
}
|
||||
}
|
||||
|
||||
void GCodeViewer::update_shells_color_by_extruder(const DynamicPrintConfig* config)
|
||||
|
@ -6230,10 +6230,20 @@ void GLCanvas3D::_render_background()
|
||||
use_error_color = m_dynamic_background_enabled &&
|
||||
(current_printer_technology() != ptSLA || !m_volumes.empty());
|
||||
|
||||
if (!m_volumes.empty())
|
||||
use_error_color &= _is_any_volume_outside().first;
|
||||
else
|
||||
use_error_color &= m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed();
|
||||
if (s_multiple_beds.is_autoslicing()) {
|
||||
use_error_color &= std::any_of(
|
||||
s_print_statuses.begin(),
|
||||
s_print_statuses.end(),
|
||||
[](const PrintStatus status){
|
||||
return status == PrintStatus::toolpath_outside;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (!m_volumes.empty())
|
||||
use_error_color &= _is_any_volume_outside().first;
|
||||
else
|
||||
use_error_color &= m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed();
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a bottom to top gradient over the complete screen.
|
||||
@ -6581,11 +6591,12 @@ void GLCanvas3D::_render_overlays()
|
||||
std::string get_status_text(PrintStatus status) {
|
||||
switch(status) {
|
||||
case PrintStatus::idle: return _u8L("Unsliced");
|
||||
case PrintStatus::running: return _u8L("Slicing...");
|
||||
case PrintStatus::running: return _u8L("Slicing") + "...";
|
||||
case PrintStatus::finished: return _u8L("Sliced");
|
||||
case PrintStatus::outside: return _u8L("Outside");
|
||||
case PrintStatus::invalid: return _u8L("Invalid");
|
||||
case PrintStatus::outside: return _u8L("Object at boundary");
|
||||
case PrintStatus::invalid: return _u8L("Invalid data");
|
||||
case PrintStatus::empty: return _u8L("Empty");
|
||||
case PrintStatus::toolpath_outside: return _u8L("Toolpath exceeds bounds");
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@ -6598,6 +6609,7 @@ wchar_t get_raw_status_icon(const PrintStatus status) {
|
||||
case PrintStatus::outside: return ImGui::PrintIdle;
|
||||
case PrintStatus::invalid: return ImGui::PrintIdle;
|
||||
case PrintStatus::empty: return ImGui::PrintIdle;
|
||||
case PrintStatus::toolpath_outside: return ImGui::PrintIdle;
|
||||
}
|
||||
return ImGui::PrintIdle;
|
||||
}
|
||||
@ -6740,8 +6752,11 @@ void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
|
||||
}
|
||||
|
||||
bool clicked = false;
|
||||
if (!is_sliceable(print_status)) {
|
||||
ImGui::Button(get_status_text(print_status).c_str(), btn_size + btn_padding);
|
||||
if (
|
||||
!is_sliceable(print_status)
|
||||
|| print_status == PrintStatus::toolpath_outside
|
||||
) {
|
||||
clicked = ImGui::Button(get_status_text(print_status).c_str(), btn_size + btn_padding);
|
||||
} else if (
|
||||
i >= int(s_bed_selector_thumbnail_texture_ids.size())
|
||||
) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user