From 000a60e19805cd68f79b6fcac5e8a98d790d2505 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 7 Mar 2019 12:09:23 +0100 Subject: [PATCH 1/3] Added "Export object as STL" menu item to the ObjectList context menu --- src/slic3r/GUI/GUI_ObjectList.cpp | 15 +++++++++++++-- src/slic3r/GUI/GUI_ObjectList.hpp | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index a4ce8fe12..33988a3ba 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -940,7 +940,9 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_) // Create new items for settings popupmenu - menu->m_separator_frst = menu->AppendSeparator(); + if (printer_technology() == ptFFF || + menu->GetMenuItems().size() > 0 && !menu->GetMenuItems().back()->IsSeparator()) + menu->m_separator_frst = menu->AppendSeparator(); // Add frequently settings create_freq_settings_popupmenu(menu); @@ -992,12 +994,20 @@ void ObjectList::append_menu_item_fix_through_netfabb(wxMenu* menu) menu->AppendSeparator(); } +void ObjectList::append_menu_item_export_stl(wxMenu* menu) const +{ + append_menu_item(menu, wxID_ANY, _(L("Export object as STL")) + dots, "", + [](wxCommandEvent&) { wxGetApp().plater()->export_stl(true); }, "", menu); + menu->AppendSeparator(); +} + void ObjectList::create_object_popupmenu(wxMenu *menu) { #ifdef __WXOSX__ append_menu_item_rename(menu); #endif // __WXOSX__ + append_menu_item_export_stl(menu); append_menu_item_fix_through_netfabb(menu); // Split object to parts @@ -1017,7 +1027,8 @@ void ObjectList::create_sla_object_popupmenu(wxMenu *menu) #ifdef __WXOSX__ append_menu_item_rename(menu); #endif // __WXOSX__ - + + append_menu_item_export_stl(menu); append_menu_item_fix_through_netfabb(menu); // rest of a object_sla_menu will be added later in: // - append_menu_item_settings() -> for "Add (settings)" diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 7d14eb13f..762020bda 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -186,6 +186,7 @@ public: wxMenuItem* append_menu_item_instance_to_object(wxMenu* menu); void append_menu_item_rename(wxMenu* menu); void append_menu_item_fix_through_netfabb(wxMenu* menu); + void append_menu_item_export_stl(wxMenu* menu) const ; void create_object_popupmenu(wxMenu *menu); void create_sla_object_popupmenu(wxMenu*menu); void create_part_popupmenu(wxMenu*menu); From ef3482a427d2b2fdf7ab738102a5a5abc457d27e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 7 Mar 2019 15:26:19 +0100 Subject: [PATCH 2/3] Fixed a scrolling of the selected item in ObjectList (SPE-849) --- src/slic3r/GUI/GUI_ObjectList.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 33988a3ba..eb3744bef 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1928,11 +1928,23 @@ void ObjectList::update_selections() select_items(sels); + /* Because of ScrollLines() and GetItemRect() functions are implemented + * only for GENERIC DataViewCtrl in current version of wxWidgets, + * use this part of code only for MSW + */ +#if defined(wxUSE_GENERICDATAVIEWCTRL) + // Scroll selected Item in the middle of an object list if (GetSelection()) { - const int sel_item_row = m_objects_model->GetRowByItem(GetSelection()); - ScrollLines(sel_item_row - m_selected_row); - m_selected_row = sel_item_row; + const wxRect& sel_rc = GetItemRect(GetSelection()); + const wxRect& main_rc = GetClientRect(); + if (sel_rc.GetBottom() <= main_rc.GetTop()+sel_rc.height || + sel_rc.GetTop() >= main_rc.GetBottom() ) + { + const wxRect& top_rc = GetItemRect(GetTopItem()); + ScrollLines(int((sel_rc.y - top_rc.y) / top_rc.GetHeight()) - 0.5*GetCountPerPage()); + } } +#endif } void ObjectList::update_selections_on_canvas() From 311df8ecfd93803bd51e6c2fa706a7e3d90bb338 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 7 Mar 2019 16:01:46 +0100 Subject: [PATCH 3/3] Reworked discretization step of Archimedean Chords infill to lower slicing time and memory requirements. Fixes "Infill pattern Archimedean causing total freeze at Infilling patterns" #1871 --- src/libslic3r/Fill/FillPlanePath.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Fill/FillPlanePath.cpp b/src/libslic3r/Fill/FillPlanePath.cpp index 615cc6efe..c52353b02 100644 --- a/src/libslic3r/Fill/FillPlanePath.cpp +++ b/src/libslic3r/Fill/FillPlanePath.cpp @@ -15,7 +15,7 @@ void FillPlanePath::_fill_surface_single( { expolygon.rotate(- direction.first); - coord_t distance_between_lines = scale_(this->spacing) / params.density; + coord_t distance_between_lines = coord_t(scale_(this->spacing) / params.density); // align infill across layers using the object's bounding box // Rotated bounding box of the whole object. @@ -89,7 +89,8 @@ Pointfs FillArchimedeanChords::_generate(coord_t min_x, coord_t min_y, coord_t m out.push_back(Vec2d(0, 0)); out.push_back(Vec2d(1, 0)); while (r < rmax) { - theta += 1. / r; + // Discretization angle to achieve a discretization error lower than RESOLUTION. + theta += 2. * acos(1. - RESOLUTION / r); r = a + b * theta; out.push_back(Vec2d(r * cos(theta), r * sin(theta))); }