From befccb07341a632db3b7cafb547d30e03bbd25d5 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 14 Jan 2019 19:39:45 +0100 Subject: [PATCH 01/11] Fixed assert in mesh slicing code. --- src/libslic3r/TriangleMesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp index 359e144b5a..8a0a087c02 100644 --- a/src/libslic3r/TriangleMesh.cpp +++ b/src/libslic3r/TriangleMesh.cpp @@ -860,12 +860,12 @@ void TriangleMeshSlicer::_slice_do(size_t facet_idx, std::vector::const_iterator min_layer, max_layer; min_layer = std::lower_bound(z.begin(), z.end(), min_z); // first layer whose slice_z is >= min_z - max_layer = std::upper_bound(z.begin() + (min_layer - z.begin()), z.end(), max_z) - 1; // last layer whose slice_z is <= max_z + max_layer = std::upper_bound(min_layer, z.end(), max_z); // first layer whose slice_z is > max_z #ifdef SLIC3R_TRIANGLEMESH_DEBUG printf("layers: min = %d, max = %d\n", (int)(min_layer - z.begin()), (int)(max_layer - z.begin())); #endif /* SLIC3R_TRIANGLEMESH_DEBUG */ - for (std::vector::const_iterator it = min_layer; it != max_layer + 1; ++ it) { + for (std::vector::const_iterator it = min_layer; it != max_layer; ++ it) { std::vector::size_type layer_idx = it - z.begin(); IntersectionLine il; if (this->slice_facet(*it / SCALING_FACTOR, facet, facet_idx, min_z, max_z, &il) == TriangleMeshSlicer::Slicing) { From 54299d8eb0db7910b73aba7101484a10823dc32d Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 14 Jan 2019 19:57:41 +0100 Subject: [PATCH 02/11] Fix of https://github.com/prusa3d/Slic3r/issues/1631 This is a fix of a long standing bug, where an extrusion is incorrectly drawn from the end of the last wipe move. Interestingly enough, this bug is in Slic3r at least since 1.2.9, but lucky enough it only occured for single perimeter, no infill prints with wipe after retract enabled, and only if the two successive slices were discretized exactly the same, which is quite unlikely. --- src/libslic3r/GCode.cpp | 40 ++++++++++++++++++++++------------------ src/libslic3r/GCode.hpp | 5 +++-- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index bff72a9c0c..4d314004d6 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -103,8 +103,7 @@ OozePrevention::_get_temp(GCode &gcodegen) : gcodegen.config().temperature.get_at(gcodegen.writer().extruder()->id()); } -std::string -Wipe::wipe(GCode &gcodegen, bool toolchange) +std::string Wipe::wipe(GCode &gcodegen, bool toolchange) { std::string gcode; @@ -137,19 +136,22 @@ Wipe::wipe(GCode &gcodegen, bool toolchange) wipe_path.clip_end(wipe_path.length() - wipe_dist); // subdivide the retraction in segments - for (const Line &line : wipe_path.lines()) { - double segment_length = line.length(); - /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one - due to rounding (TODO: test and/or better math for this) */ - double dE = length * (segment_length / wipe_dist) * 0.95; - //FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle. - // Is it here for the cooling markers? Or should it be outside of the cycle? - gcode += gcodegen.writer().set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers() ? ";_WIPE" : ""); - gcode += gcodegen.writer().extrude_to_xy( - gcodegen.point_to_gcode(line.b), - -dE, - "wipe and retract" - ); + if (! wipe_path.empty()) { + for (const Line &line : wipe_path.lines()) { + double segment_length = line.length(); + /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one + due to rounding (TODO: test and/or better math for this) */ + double dE = length * (segment_length / wipe_dist) * 0.95; + //FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle. + // Is it here for the cooling markers? Or should it be outside of the cycle? + gcode += gcodegen.writer().set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers() ? ";_WIPE" : ""); + gcode += gcodegen.writer().extrude_to_xy( + gcodegen.point_to_gcode(line.b), + -dE, + "wipe and retract" + ); + } + gcodegen.set_last_pos(wipe_path.points.back()); } // prevent wiping again on same path @@ -2577,9 +2579,11 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string // use G1 because we rely on paths being straight (G0 may make round paths) Lines lines = travel.lines(); - for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) - gcode += m_writer.travel_to_xy(this->point_to_gcode(line->b), comment); - + if (! lines.empty()) { + for (const Line &line : lines) + gcode += m_writer.travel_to_xy(this->point_to_gcode(line.b), comment); + this->set_last_pos(lines.back().b); + } return gcode; } diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 32a7057512..86a6cacee3 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -155,11 +155,11 @@ public: void do_export(Print *print, const char *path, GCodePreviewData *preview_data = nullptr); // Exported for the helper classes (OozePrevention, Wipe) and for the Perl binding for unit tests. - const Vec2d& origin() const { return m_origin; } + const Vec2d& origin() const { return m_origin; } void set_origin(const Vec2d &pointf); void set_origin(const coordf_t x, const coordf_t y) { this->set_origin(Vec2d(x, y)); } const Point& last_pos() const { return m_last_pos; } - Vec2d point_to_gcode(const Point &point) const; + Vec2d point_to_gcode(const Point &point) const; Point gcode_to_point(const Vec2d &point) const; const FullPrintConfig &config() const { return m_config; } const Layer* layer() const { return m_layer; } @@ -360,6 +360,7 @@ protected: size_t num_objects, size_t num_islands); + friend class Wipe; friend class WipeTowerIntegration; }; From 84eefa280c2f1ebbf6b867b89a05c0b0e9d2de26 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 14 Jan 2019 19:59:18 +0100 Subject: [PATCH 03/11] Added debugging code for the Douglas-Peucker contour simplification code. --- src/libslic3r/MultiPoint.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libslic3r/MultiPoint.cpp b/src/libslic3r/MultiPoint.cpp index 7b483cba04..ee3b997476 100644 --- a/src/libslic3r/MultiPoint.cpp +++ b/src/libslic3r/MultiPoint.cpp @@ -206,6 +206,26 @@ std::vector MultiPoint::_douglas_peucker(const std::vector& pts, c floater = &pts[floater_idx]; } } + assert(result_pts.front() == pts.front()); + assert(result_pts.back() == pts.back()); + +#if 0 + { + static int iRun = 0; + BoundingBox bbox(pts); + BoundingBox bbox2(result_pts); + bbox.merge(bbox2); + SVG svg(debug_out_path("douglas_peucker_%d.svg", iRun ++).c_str(), bbox); + if (pts.front() == pts.back()) + svg.draw(Polygon(pts), "black"); + else + svg.draw(Polyline(pts), "black"); + if (result_pts.front() == result_pts.back()) + svg.draw(Polygon(result_pts), "green", scale_(0.1)); + else + svg.draw(Polyline(result_pts), "green", scale_(0.1)); + } +#endif } return result_pts; } From 4b55db878a6bf5a8da4238005c168d75c61afd2f Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 15 Jan 2019 09:30:12 +0100 Subject: [PATCH 04/11] Fixed rotation of single volumes using rotate gizmo --- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 50cc028a9a..6ffd0b6211 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1609,7 +1609,7 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local) else if (is_single_volume() || is_single_modifier()) #if ENABLE_WORLD_ROTATIONS { - if (requires_local_axes()) + if (local) (*m_volumes)[i]->set_volume_rotation(rotation); else { diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 7c6ac111a3..3e6fe228c9 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -497,7 +497,11 @@ void ObjectManipulation::change_rotation_value(const Vec3d& rotation) } canvas->get_selection().start_dragging(); +#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION + canvas->get_selection().rotate(rad_rotation, selection.is_single_full_instance() || selection.requires_local_axes()); +#else canvas->get_selection().rotate(rad_rotation, selection.is_single_full_instance()); +#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION canvas->do_rotate(); #if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION From 793e3cd47067d75e7f595f655016f8d65cee7cce Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 15 Jan 2019 09:31:53 +0100 Subject: [PATCH 05/11] Added "Frequently changed parameters for SLA-profiles" --- src/slic3r/GUI/GUI_ObjectSettings.hpp | 2 +- src/slic3r/GUI/Plater.cpp | 71 ++++++++++++++++++++------- src/slic3r/GUI/Plater.hpp | 2 +- src/slic3r/GUI/Tab.cpp | 20 ++++++-- 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectSettings.hpp b/src/slic3r/GUI/GUI_ObjectSettings.hpp index 19140efe3b..3e72713bfb 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.hpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.hpp @@ -24,7 +24,7 @@ public: virtual void Hide(); virtual void UpdateAndShow(const bool show); - wxSizer* get_sizer(); + virtual wxSizer* get_sizer(); ConfigOptionsGroup* get_og() { return m_og.get(); } }; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 7015084cd2..a6ad715d59 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -286,12 +286,17 @@ class FreqChangedParams : public OG_Settings { double m_brim_width = 0.0; wxButton* m_wiping_dialog_button{ nullptr }; + wxSizer* m_sizer {nullptr}; + + std::shared_ptr m_og_sla; public: FreqChangedParams(wxWindow* parent, const int label_width); ~FreqChangedParams() {} wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; } - void Show(const bool show); + wxSizer* get_sizer() override; + ConfigOptionsGroup* get_og(const bool is_fff); + void Show(const bool is_fff); }; FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : @@ -299,22 +304,13 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : { DynamicPrintConfig* config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; + // Frequently changed parameters for FFF_technology m_og->set_config(config); m_og->label_width = label_width; m_og->m_on_change = [config, this](t_config_option_key opt_key, boost::any value) { - TabPrint* tab_print = nullptr; - for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) { - Tab *tab = dynamic_cast(wxGetApp().tab_panel()->GetPage(i)); - if (!tab) - continue; - if (tab->name() == "print") { - tab_print = static_cast(tab); - break; - } - } - if (tab_print == nullptr) - return; + Tab* tab_print = wxGetApp().get_tab(Preset::TYPE_PRINT); + if (!tab_print) return; if (opt_key == "fill_density") { value = m_og->get_config_value(*config, opt_key); @@ -413,19 +409,56 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : return sizer; }; m_og->append_line(line); + + + // Frequently changed parameters for SLA_technology + m_og_sla = std::make_shared(parent, ""); + DynamicPrintConfig* config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config; + m_og_sla->set_config(config_sla); + m_og_sla->label_width = label_width*2; + + m_og_sla->m_on_change = [config_sla, this](t_config_option_key opt_key, boost::any value) { + Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT); + if (!tab) return; + + tab->set_value(opt_key, value); + + DynamicPrintConfig new_conf = *config_sla; + new_conf.set_key_value(opt_key, new ConfigOptionBool(boost::any_cast(value))); + tab->load_config(new_conf); + tab->update_dirty(); + }; + + m_og_sla->append_single_option_line("supports_enable"); + m_og_sla->append_single_option_line("pad_enable"); + + m_sizer = new wxBoxSizer(wxVERTICAL); + m_sizer->Add(m_og->sizer, 0, wxEXPAND); + m_sizer->Add(m_og_sla->sizer, 0, wxEXPAND | wxTOP, 5); } -void FreqChangedParams::Show(const bool show) +wxSizer* FreqChangedParams::get_sizer() { - bool is_wdb_shown = m_wiping_dialog_button->IsShown(); - m_og->Show(show); + return m_sizer; +} + +void FreqChangedParams::Show(const bool is_fff) +{ + const bool is_wdb_shown = m_wiping_dialog_button->IsShown(); + m_og->Show(is_fff); + m_og_sla->Show(!is_fff); // correct showing of the FreqChangedParams sizer when m_wiping_dialog_button is hidden - if (show && !is_wdb_shown) + if (is_fff && !is_wdb_shown) m_wiping_dialog_button->Hide(); } +ConfigOptionsGroup* FreqChangedParams::get_og(const bool is_fff) +{ + return is_fff ? m_og.get() : m_og_sla.get(); +} + // Sidebar / private struct Sidebar::priv @@ -703,9 +736,9 @@ wxScrolledWindow* Sidebar::scrolled_panel() return p->scrolled; } -ConfigOptionsGroup* Sidebar::og_freq_chng_params() +ConfigOptionsGroup* Sidebar::og_freq_chng_params(const bool is_fff) { - return p->frequently_changed_parameters->get_og(); + return p->frequently_changed_parameters->get_og(is_fff); } wxButton* Sidebar::get_wiping_dialog_button() diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 373d7dc28e..7b19d6f313 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -76,7 +76,7 @@ public: ObjectSettings* obj_settings(); wxScrolledWindow* scrolled_panel(); - ConfigOptionsGroup* og_freq_chng_params(); + ConfigOptionsGroup* og_freq_chng_params(const bool is_fff); wxButton* get_wiping_dialog_button(); void update_objects_list_extruder_column(int extruders_count); void show_info_sizer(); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index d78e9c695e..452e3bf202 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -751,8 +751,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) wxPostEvent(this, event); - auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(); - if (opt_key == "fill_density") + ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF)); + if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable") { boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key); og_freq_chng_params->set_value(opt_key, val); @@ -881,8 +881,20 @@ void Tab::update_preset_description_line() void Tab::update_frequently_changed_parameters() { - auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(); + auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF)); if (!og_freq_chng_params) return; + + if (m_type == Preset::TYPE_SLA_PRINT) + { + for (auto opt_key : { "supports_enable", "pad_enable" }) + { + boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key); + og_freq_chng_params->set_value(opt_key, val); + } + return; + } + + // for m_type == Preset::TYPE_PRINT boost::any value = og_freq_chng_params->get_config_value(*m_config, "fill_density"); og_freq_chng_params->set_value("fill_density", value); @@ -2370,7 +2382,7 @@ void Tab::load_current_preset() } else { on_presets_changed(); - if (m_name == "print") + if (m_type == Preset::TYPE_SLA_PRINT || m_type == Preset::TYPE_PRINT)// if (m_name == "print") update_frequently_changed_parameters(); } From 14a36c56e7e610cd08e80a281d788003504d70ac Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 15 Jan 2019 10:00:34 +0100 Subject: [PATCH 06/11] Fix of "Crash after changing print values when layer colour pause is added #1658" Fix of SPE-768 --- src/slic3r/GUI/GUI_Preview.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 560d5b69cb..f791145a2b 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -751,30 +751,20 @@ void Preview::load_print_as_fff() if (IsShown()) { if (gcode_preview_data_valid) - { + // Load the real G-code preview. m_canvas->load_gcode_preview(*m_gcode_preview_data, colors); - show_hide_ui_elements("full"); - - // recalculates zs and update sliders accordingly - has_layers = ! m_canvas->get_current_print_zs(true).empty(); - if (! has_layers) - { - // all layers filtered out - reset_sliders(); - m_canvas_widget->Refresh(); - } - } else - { - // load skirt and brim + // Load the initial preview based on slices, not the final G-code. m_canvas->load_preview(colors); - show_hide_ui_elements("simple"); - } - - - if (has_layers) - update_sliders(m_canvas->get_current_print_zs(true)); - + show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple"); + // recalculates zs and update sliders accordingly + std::vector zs = m_canvas->get_current_print_zs(true); + if (zs.empty()) { + // all layers filtered out + reset_sliders(); + m_canvas_widget->Refresh(); + } else + update_sliders(zs); m_loaded = true; } } From 519f5e5ea7c96db4b7ae64c7f48d1bc8c720dbf3 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 15 Jan 2019 10:24:58 +0100 Subject: [PATCH 07/11] Fix of #1606 + Added dialog closing by "Esc" button for the FirmwareDialog. --- src/slic3r/GUI/AboutDialog.cpp | 2 +- src/slic3r/GUI/FirmwareDialog.cpp | 3 +++ src/slic3r/GUI/SysInfoDialog.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 582496506b..a4bb6c814a 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -114,7 +114,7 @@ AboutDialog::AboutDialog() this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE); vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); - this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); +// this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); SetSizer(main_sizer); diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 418d1a3c9d..2df1f0bc99 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -775,6 +775,8 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) : SetSize(std::max(size.GetWidth(), static_cast(MIN_WIDTH)), std::max(size.GetHeight(), static_cast(MIN_HEIGHT))); Layout(); + SetEscapeId(wxID_CLOSE); // To close the dialog using "Esc" button + // Bind events p->hex_picker->Bind(wxEVT_FILEPICKER_CHANGED, [this](wxFileDirPickerEvent& evt) { @@ -826,6 +828,7 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) : if (this->p->avrdude) { evt.Veto(); } else { + this->EndModal(wxID_CLOSE); evt.Skip(); } }); diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 110bfaf44a..5da74b4bb9 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -120,7 +120,7 @@ SysInfoDialog::SysInfoDialog() this->Bind(wxEVT_BUTTON, &SysInfoDialog::onCloseDialog, this, wxID_OK); main_sizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); - this->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this); +// this->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this); logo->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this); SetSizer(main_sizer); From 2f48997a2201b793fab79e901df1910a8002a6bb Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 15 Jan 2019 12:24:32 +0100 Subject: [PATCH 08/11] Fixed rotation of single volumes inside a rotated instance using rotate gizmo --- src/libslic3r/Geometry.cpp | 20 +++++++++++--------- src/slic3r/GUI/GLCanvas3D.cpp | 3 +-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/libslic3r/Geometry.cpp b/src/libslic3r/Geometry.cpp index 11a9955133..37484de613 100644 --- a/src/libslic3r/Geometry.cpp +++ b/src/libslic3r/Geometry.cpp @@ -1182,15 +1182,17 @@ Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation, Vec3d extract_euler_angles(const Eigen::Matrix& rotation_matrix) { #if ENABLE_NEW_EULER_ANGLES - bool x_only = (rotation_matrix(0, 0) == 1.0) && (rotation_matrix(0, 1) == 0.0) && (rotation_matrix(0, 2) == 0.0) && (rotation_matrix(1, 0) == 0.0) && (rotation_matrix(2, 0) == 0.0); - bool y_only = (rotation_matrix(0, 1) == 0.0) && (rotation_matrix(1, 0) == 0.0) && (rotation_matrix(1, 1) == 1.0) && (rotation_matrix(1, 2) == 0.0) && (rotation_matrix(2, 1) == 0.0); - bool z_only = (rotation_matrix(0, 2) == 0.0) && (rotation_matrix(1, 2) == 0.0) && (rotation_matrix(2, 0) == 0.0) && (rotation_matrix(2, 1) == 0.0) && (rotation_matrix(2, 2) == 1.0); -// bool xy_only = (rotation_matrix(0, 1) == 0.0); // Rx * Ry - bool yx_only = (rotation_matrix(1, 0) == 0.0); // Ry * Rx -// bool xz_only = (rotation_matrix(0, 2) == 0.0); // Rx * Rz -// bool zx_only = (rotation_matrix(2, 0) == 0.0); // Rz * Rx -// bool yz_only = (rotation_matrix(1, 2) == 0.0); // Ry * Rz -// bool zy_only = (rotation_matrix(2, 1) == 0.0); // Rz * Ry + auto is_approx = [](double value, double test_value) -> bool { return std::abs(value - test_value) < EPSILON; }; + + bool x_only = is_approx(rotation_matrix(0, 0), 1.0) && is_approx(rotation_matrix(0, 1), 0.0) && is_approx(rotation_matrix(0, 2), 0.0) && is_approx(rotation_matrix(1, 0), 0.0) && is_approx(rotation_matrix(2, 0), 0.0); + bool y_only = is_approx(rotation_matrix(0, 1), 0.0) && is_approx(rotation_matrix(1, 0), 0.0) && is_approx(rotation_matrix(1, 1), 1.0) && is_approx(rotation_matrix(1, 2), 0.0) && is_approx(rotation_matrix(2, 1), 0.0); + bool z_only = is_approx(rotation_matrix(0, 2), 0.0) && is_approx(rotation_matrix(1, 2), 0.0) && is_approx(rotation_matrix(2, 0), 0.0) && is_approx(rotation_matrix(2, 1), 0.0) && is_approx(rotation_matrix(2, 2), 1.0); +// bool xy_only = is_approx(rotation_matrix(0, 1), 0.0); // Rx * Ry + bool yx_only = is_approx(rotation_matrix(1, 0), 0.0); // Ry * Rx +// bool xz_only = is_approx(rotation_matrix(0, 2), 0.0); // Rx * Rz +// bool zx_only = is_approx(rotation_matrix(2, 0), 0.0); // Rz * Rx +// bool yz_only = is_approx(rotation_matrix(1, 2), 0.0); // Ry * Rz +// bool zy_only = is_approx(rotation_matrix(2, 1), 0.0); // Rz * Ry Vec3d angles = Vec3d::Zero(); if (x_only || y_only || z_only) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6ffd0b6211..d5f4808aaf 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1614,8 +1614,7 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local) else { Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation); - const Transform3d& inst_m = m_cache.volumes_data[i].get_instance_rotation_matrix(); - Vec3d new_rotation = Geometry::extract_euler_angles(inst_m.inverse() * m * inst_m * m_cache.volumes_data[i].get_volume_rotation_matrix()); + Vec3d new_rotation = Geometry::extract_euler_angles(m * m_cache.volumes_data[i].get_volume_rotation_matrix()); (*m_volumes)[i]->set_volume_rotation(new_rotation); } } From 4066df2db7cec9a4e1fafdcda9a95914c2e9d767 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 15 Jan 2019 12:59:28 +0100 Subject: [PATCH 09/11] Slightly increased limit for zoom out --- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d5f4808aaf..9a2ea4b44c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5708,7 +5708,7 @@ void GLCanvas3D::set_camera_zoom(float zoom) // Don't allow to zoom too far outside the scene. float zoom_min = _get_zoom_to_bounding_box_factor(_max_bounding_box()); if (zoom_min > 0.0f) - zoom = std::max(zoom, zoom_min * 0.8f); + zoom = std::max(zoom, zoom_min * 0.7f); m_camera.zoom = zoom; viewport_changed(); From 831de96a81f284c22f35ff8ec25273638bb1d91e Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 15 Jan 2019 14:25:28 +0100 Subject: [PATCH 10/11] Solving issue with first empty layer. --- src/libslic3r/SLA/SLASupportTree.cpp | 2 +- src/libslic3r/SLAPrint.cpp | 4 +--- src/libslic3r/SLAPrint.hpp | 8 ++++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index c2fcb3c3a4..59d03039a7 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -1746,7 +1746,7 @@ SlicedSupports SLASupportTree::slice(float layerh, float init_layerh) const const Pad& pad = m_impl->pad(); if(!pad.empty()) gndlvl -= float(get_pad_elevation(pad.cfg)); - std::vector heights = {gndlvl}; + std::vector heights; heights.reserve(size_t(modelh/layerh) + 1); for(float h = gndlvl + init_layerh; h < gndlvl + modelh; h += layerh) { diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 5cddadb5b1..1383acc40c 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -732,9 +732,7 @@ void SLAPrint::process() po.m_supportdata->level_ids.reserve(sslices.size()); for(int i = 0; i < int(sslices.size()); ++i) { - int a = i == 0 ? 0 : 1; - int b = i == 0 ? 0 : i - 1; - LevelID h = sminZ + a * sih + b * slh; + LevelID h = sminZ + sih + i * slh; po.m_supportdata->level_ids.emplace_back(h); float fh = float(double(h) * SCALING_FACTOR); diff --git a/src/libslic3r/SLAPrint.hpp b/src/libslic3r/SLAPrint.hpp index 9fab4d5500..21503c6f6a 100644 --- a/src/libslic3r/SLAPrint.hpp +++ b/src/libslic3r/SLAPrint.hpp @@ -148,8 +148,16 @@ private: // Which steps have to be performed. Implicitly: all std::vector m_stepmask; + + // Individual 2d slice polygons from lower z to higher z levels std::vector m_model_slices; + + // Exact (float) height levels mapped to the slices. Each record contains + // the index to the model and the support slice vectors. SliceIndex m_slice_index; + + // The height levels corrected and scaled up in integer values. This will + // be used at rasterization. std::vector m_level_ids; // Caching the transformed (m_trafo) raw mesh of the object From bb8866ca372378cbec748fc3e42832d7d73c2f3b Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 15 Jan 2019 14:41:45 +0100 Subject: [PATCH 11/11] Quick fix for visible bridges under the pillar base. --- src/libslic3r/SLA/SLASupportTree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index 59d03039a7..6477010fda 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -1248,8 +1248,8 @@ bool SLASupportTree::generate(const PointSet &points, // there is no need to bridge them together. if(pillar_dist > 2*cfg.head_back_radius_mm && bridge_distance < cfg.max_bridge_length_mm) - while(sj(Z) > pillar.endpoint(Z) && - ej(Z) > nextpillar.endpoint(Z)) + while(sj(Z) > pillar.endpoint(Z) + cfg.base_radius_mm && + ej(Z) > nextpillar.endpoint(Z) + + cfg.base_radius_mm) { if(chkd >= bridge_distance) { result.add_bridge(sj, ej, pillar.r);