mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-01 16:38:43 +03:00
update to latest version
This commit is contained in:
@@ -1176,6 +1176,10 @@ static bool object_contains_negative_volumes(const Model& model, int obj_id) {
|
||||
return (0 <= obj_id && obj_id < (int)model.objects.size()) ? model.objects[obj_id]->has_negative_volume_mesh() : false;
|
||||
}
|
||||
|
||||
static bool object_has_sla_drain_holes(const Model& model, int obj_id) {
|
||||
return (0 <= obj_id && obj_id < (int)model.objects.size()) ? model.objects[obj_id]->has_sla_drain_holes() : false;
|
||||
}
|
||||
|
||||
void GLCanvas3D::SLAView::detect_type_from_volumes(const GLVolumePtrs& volumes)
|
||||
{
|
||||
for (auto& [id, type] : m_instances_cache) {
|
||||
@@ -1184,7 +1188,8 @@ void GLCanvas3D::SLAView::detect_type_from_volumes(const GLVolumePtrs& volumes)
|
||||
|
||||
for (const GLVolume* v : volumes) {
|
||||
if (v->volume_idx() == -(int)slaposDrillHoles) {
|
||||
if (object_contains_negative_volumes(*m_parent.get_model(), v->composite_id.object_id)) {
|
||||
if (object_contains_negative_volumes(*m_parent.get_model(), v->composite_id.object_id) ||
|
||||
object_has_sla_drain_holes(*m_parent.get_model(), v->composite_id.object_id)) {
|
||||
const InstancesCacheItem* instance = find_instance_item(v->composite_id);
|
||||
assert(instance != nullptr);
|
||||
set_type(instance->first, ESLAViewType::Processed);
|
||||
@@ -2569,22 +2574,25 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||
|
||||
const Print *print = m_process->fff_print();
|
||||
const float depth = print->wipe_tower_data(extruders_count).depth;
|
||||
const std::vector<std::pair<float, float>> z_and_depth_pairs = print->wipe_tower_data(extruders_count).z_and_depth_pairs;
|
||||
const float height_real = print->wipe_tower_data(extruders_count).height; // -1.f = unknown
|
||||
|
||||
// Height of a print (Show at least a slab).
|
||||
const double height = height_real < 0.f ? std::max(m_model->max_z(), 10.0) : height_real;
|
||||
|
||||
#if ENABLE_OPENGL_ES
|
||||
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
||||
x, y, w, depth, (float)height, ca, a, !print->is_step_done(psWipeTower),
|
||||
bw, &m_wipe_tower_mesh);
|
||||
#else
|
||||
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
||||
x, y, w, depth, (float)height, ca, a, !print->is_step_done(psWipeTower),
|
||||
bw);
|
||||
#endif // ENABLE_OPENGL_ES
|
||||
if (volume_idx_wipe_tower_old != -1)
|
||||
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;
|
||||
if (depth != 0.) {
|
||||
#if ENABLE_OPENGL_ES
|
||||
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
||||
x, y, w, depth, z_and_depth_pairs, (float)height, ca, a, !print->is_step_done(psWipeTower),
|
||||
bw, &m_wipe_tower_mesh);
|
||||
#else
|
||||
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
||||
x, y, w, depth, z_and_depth_pairs, (float)height, ca, a, !print->is_step_done(psWipeTower),
|
||||
bw);
|
||||
#endif // ENABLE_OPENGL_ES
|
||||
if (volume_idx_wipe_tower_old != -1)
|
||||
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2714,6 +2722,7 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co
|
||||
if (wxGetApp().is_editor()) {
|
||||
m_gcode_viewer.update_shells_color_by_extruder(m_config);
|
||||
_set_warning_notification_if_needed(EWarning::ToolpathOutside);
|
||||
_set_warning_notification_if_needed(EWarning::GCodeConflict);
|
||||
}
|
||||
|
||||
m_gcode_viewer.refresh(gcode_result, str_tool_colors);
|
||||
@@ -4706,6 +4715,13 @@ std::pair<SlicingParameters, const std::vector<double>> GLCanvas3D::get_layers_h
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GLCanvas3D::detect_sla_view_type()
|
||||
{
|
||||
m_sla_view.detect_type_from_volumes(m_volumes.volumes);
|
||||
m_sla_view.update_volumes_visibility(m_volumes.volumes);
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_sla_view_type(ESLAViewType type)
|
||||
{
|
||||
m_sla_view.set_type(type);
|
||||
@@ -7477,8 +7493,12 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning)
|
||||
}
|
||||
else {
|
||||
if (wxGetApp().is_editor()) {
|
||||
if (current_printer_technology() != ptSLA)
|
||||
show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed();
|
||||
if (current_printer_technology() != ptSLA) {
|
||||
if (warning == EWarning::ToolpathOutside)
|
||||
show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed();
|
||||
else if (warning == EWarning::GCodeConflict)
|
||||
show = m_gcode_viewer.has_data() && m_gcode_viewer.is_contained_in_bed() && m_gcode_viewer.get_conflict_result().has_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7511,8 +7531,55 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
||||
"Resolve the current problem to continue slicing.");
|
||||
error = ErrorType::PLATER_ERROR;
|
||||
break;
|
||||
case EWarning::GCodeConflict: {
|
||||
const ConflictResultOpt& conflict_result = m_gcode_viewer.get_conflict_result();
|
||||
if (!conflict_result.has_value()) { break; }
|
||||
std::string objName1 = conflict_result->_objName1;
|
||||
std::string objName2 = conflict_result->_objName2;
|
||||
double height = conflict_result->_height;
|
||||
int layer = conflict_result->layer;
|
||||
// TRN %3% is name of Object1, %4% is name of Object2
|
||||
text = format(_u8L("Conflicts in G-code paths have been detected at layer %1%, z=%2$.2f mm. Please reposition the conflicting objects (%3% <-> %4%) further apart."),
|
||||
layer, height, objName1, objName2);
|
||||
error = ErrorType::SLICING_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto& notification_manager = *wxGetApp().plater()->get_notification_manager();
|
||||
|
||||
const ConflictResultOpt& conflict_result = m_gcode_viewer.get_conflict_result();
|
||||
if (warning == EWarning::GCodeConflict) {
|
||||
if (conflict_result.has_value()) {
|
||||
const PrintObject* obj2 = reinterpret_cast<const PrintObject*>(conflict_result->_obj2);
|
||||
auto mo = obj2->model_object();
|
||||
ObjectID id = mo->id();
|
||||
int layer_id = conflict_result->layer;
|
||||
auto action_fn = [id, layer_id](wxEvtHandler*) {
|
||||
auto& objects = wxGetApp().model().objects;
|
||||
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
|
||||
if (iter != objects.end()) {
|
||||
const unsigned int obj_idx = std::distance(objects.begin(), iter);
|
||||
wxGetApp().CallAfter([obj_idx, layer_id]() {
|
||||
wxGetApp().plater()->set_preview_layers_slider_values_range(0, layer_id - 1);
|
||||
wxGetApp().plater()->select_view_3D("3D");
|
||||
wxGetApp().plater()->canvas3D()->reset_all_gizmos();
|
||||
wxGetApp().plater()->canvas3D()->get_selection().add_object(obj_idx, true);
|
||||
wxGetApp().obj_list()->update_selections();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
auto hypertext = _u8L("Jump to");
|
||||
hypertext += std::string(" [") + mo->name + "]";
|
||||
notification_manager.push_notification(NotificationType::SlicingError, NotificationManager::NotificationLevel::ErrorNotificationLevel,
|
||||
_u8L("ERROR:") + "\n" + text, hypertext, action_fn);
|
||||
}
|
||||
else
|
||||
notification_manager.close_slicing_error_notification(text);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (error)
|
||||
{
|
||||
case PLATER_WARNING:
|
||||
|
||||
Reference in New Issue
Block a user