mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 09:02:06 +00:00
FIX: add warning when wipe tower outside
jira: STUDIO-11817 Change-Id: I4352f8485e98c84a0ba75d0b2cc8a339e02c209e (cherry picked from commit ce4bf4bc1bd2342c4bd3a270ed3b7619c7529c7f)
This commit is contained in:
@@ -1070,6 +1070,37 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type,
|
||||
glsafe(::glDisable(GL_BLEND));
|
||||
}
|
||||
|
||||
bool GLVolumeCollection::check_wipe_tower_outside_state(const Slic3r::BuildVolume &build_volume) const
|
||||
{
|
||||
for (GLVolume *volume : this->volumes) {
|
||||
if (volume->is_wipe_tower) {
|
||||
const std::vector<Vec2d>& printable_area = build_volume.printable_area();
|
||||
Polygon printable_poly = Polygon::new_scale(printable_area);
|
||||
|
||||
// multi-extruder
|
||||
Polygons extruder_polys;
|
||||
const std::vector<std::vector<Vec2d>> & extruder_areas = build_volume.extruder_areas();
|
||||
if (!extruder_areas.empty()) {
|
||||
for (size_t i = 0; i < extruder_areas.size(); ++i) {
|
||||
extruder_polys.emplace_back(Polygon::new_scale(extruder_areas[i]));
|
||||
}
|
||||
extruder_polys = union_(extruder_polys);
|
||||
if (extruder_polys.empty())
|
||||
return false;
|
||||
|
||||
printable_poly = extruder_polys[0];
|
||||
}
|
||||
|
||||
const BoundingBoxf3 &bbox = volume->transformed_convex_hull_bounding_box();
|
||||
Polygon wipe_tower_polygon = bbox.polygon(true);
|
||||
|
||||
Polygons diff_res = diff(wipe_tower_polygon, printable_poly);
|
||||
return diff_res.empty();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state, ObjectFilamentResults* object_results) const
|
||||
{
|
||||
if (GUI::wxGetApp().plater() == NULL)
|
||||
|
||||
@@ -535,6 +535,7 @@ public:
|
||||
// returns the containment state in the given out_state, if non-null
|
||||
bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state, ObjectFilamentResults* object_results) const;
|
||||
void reset_outside_state();
|
||||
bool check_wipe_tower_outside_state(const Slic3r::BuildVolume &build_volume) const;
|
||||
|
||||
void update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha = true);
|
||||
|
||||
|
||||
@@ -3048,6 +3048,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||
const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
|
||||
// const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited);
|
||||
|
||||
bool wipe_tower_outside = m_volumes.check_wipe_tower_outside_state(m_bed.build_volume());
|
||||
_set_warning_notification(EWarning::PrimeTowerOutside, !wipe_tower_outside);
|
||||
|
||||
auto clash_flag = construct_error_string(object_results, get_object_clashed_text());
|
||||
auto unprintable_flag= construct_extruder_unprintable_error(object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text());
|
||||
|
||||
@@ -3084,6 +3087,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||
_set_warning_notification(EWarning::TPUPrintableError, false);
|
||||
_set_warning_notification(EWarning::FilamentPrintableError, false);
|
||||
_set_warning_notification(EWarning::MixUsePLAAndPETG, false);
|
||||
_set_warning_notification(EWarning::PrimeTowerOutside, false);
|
||||
_set_warning_notification(EWarning::MultiExtruderPrintableError,false);
|
||||
_set_warning_notification(EWarning::MultiExtruderHeightOutside,false);
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
|
||||
@@ -10128,6 +10132,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
||||
case EWarning::MixUsePLAAndPETG:
|
||||
text = _u8L("PLA and PETG filaments detected in the mixture. Adjust parameters according to the Wiki to ensure print quality.");
|
||||
break;
|
||||
case EWarning::PrimeTowerOutside:
|
||||
text = _u8L("The prime tower extends beyond the plate boundary, which may cause part of the prime tower to lie outside the printable area after slicing.");
|
||||
break;
|
||||
}
|
||||
//BBS: this may happened when exit the app, plater is null
|
||||
if (!wxGetApp().plater())
|
||||
|
||||
@@ -391,7 +391,8 @@ class GLCanvas3D
|
||||
MultiExtruderPrintableError, // after slice
|
||||
MultiExtruderHeightOutside, // after slice
|
||||
FilamentUnPrintableOnFirstLayer,
|
||||
MixUsePLAAndPETG
|
||||
MixUsePLAAndPETG,
|
||||
PrimeTowerOutside,
|
||||
};
|
||||
|
||||
class RenderStats
|
||||
|
||||
Reference in New Issue
Block a user