diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index d24be4504..21c922a16 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1100,13 +1100,34 @@ void SLAPrint::fill_statistics() const auto index = po->get_slice_index(); if (index.find(layer.first) == index.end()) continue; - - if (index.at(layer.first).model_slices_idx != SLAPrintObject::SliceRecord::NONE) { - for (const ExPolygon& polygon : po->get_model_slices().at(index.at(layer.first).model_slices_idx)) + + const SLAPrintObject::SliceRecord& record = index.at(layer.first); + + if (record.model_slices_idx != SLAPrintObject::SliceRecord::NONE && + record.support_slices_idx != SLAPrintObject::SliceRecord::NONE) + { + double model_area = 0; + for (const ExPolygon& polygon : po->get_model_slices().at(record.model_slices_idx)) + model_area += polygon.area(); + + layer_model_area += model_area; + + Polygons polygons = to_polygons(po->get_model_slices().at(record.model_slices_idx)); + append(polygons, to_polygons(po->get_support_slices().at(record.support_slices_idx))); + polygons = union_(polygons); + double poligons_area = 0; + for (const Polygon& polygon : polygons) + poligons_area += polygon.area(); + + if (poligons_area > model_area) + layer_support_area += (poligons_area-model_area); + } + else if (record.model_slices_idx != SLAPrintObject::SliceRecord::NONE) { + for (const ExPolygon& polygon : po->get_model_slices().at(record.model_slices_idx)) layer_model_area += polygon.area(); } - /*else */if (index.at(layer.first).support_slices_idx != SLAPrintObject::SliceRecord::NONE) { - for (const ExPolygon& polygon : po->get_support_slices().front()) + else if (record.support_slices_idx != SLAPrintObject::SliceRecord::NONE) { + for (const ExPolygon& polygon : po->get_support_slices().at(record.support_slices_idx)) layer_support_area += polygon.area(); } } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 87a950b7f..e8944654a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -99,6 +99,11 @@ public: wxStaticText *info_facets; wxStaticText *info_materials; wxStaticText *info_manifold; + + wxStaticText *label_volume; + wxStaticText *label_materials; + std::vector sla_hided_items; + bool showing_manifold_warning_icon; void show_sizer(bool show); }; @@ -120,15 +125,16 @@ ObjectInfo::ObjectInfo(wxWindow *parent) : (*info_label)->SetFont(wxGetApp().small_font()); grid_sizer->Add(text, 0); grid_sizer->Add(*info_label, 0); + return text; }; init_info_label(&info_size, _(L("Size"))); - init_info_label(&info_volume, _(L("Volume"))); + label_volume = init_info_label(&info_volume, _(L("Volume"))); init_info_label(&info_facets, _(L("Facets"))); - init_info_label(&info_materials, _(L("Materials"))); + label_materials = init_info_label(&info_materials, _(L("Materials"))); Add(grid_sizer, 0, wxEXPAND); - auto *info_manifold_text = new wxStaticText(parent, wxID_ANY, _(L("Manifold"))); + auto *info_manifold_text = new wxStaticText(parent, wxID_ANY, _(L("Manifold")) + ":"); info_manifold_text->SetFont(wxGetApp().small_font()); info_manifold = new wxStaticText(parent, wxID_ANY, ""); info_manifold->SetFont(wxGetApp().small_font()); @@ -139,6 +145,8 @@ ObjectInfo::ObjectInfo(wxWindow *parent) : sizer_manifold->Add(manifold_warning_icon, 0, wxLEFT, 2); sizer_manifold->Add(info_manifold, 0, wxLEFT, 2); Add(sizer_manifold, 0, wxEXPAND | wxTOP, 4); + + sla_hided_items = { label_volume, info_volume, label_materials, info_materials }; } void ObjectInfo::show_sizer(bool show) @@ -811,6 +819,11 @@ void Sidebar::show_info_sizer() } p->object_info->show_sizer(true); + + if (p->plater->printer_technology() == ptSLA) { + for (auto item: p->object_info->sla_hided_items) + item->Show(false); + } } void Sidebar::show_sliced_info_sizer(const bool show)