From 754bfd926b46924df2e1c56adb945c12ba900f02 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 10 May 2018 11:10:44 +0200 Subject: [PATCH 01/13] Auto-correction of the input values according to the admissible range --- xs/src/libslic3r/PrintConfig.cpp | 3 ++- xs/src/slic3r/GUI/Field.cpp | 25 ++++++++++++++++++------- xs/src/slic3r/GUI/Field.hpp | 1 - 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index f70a42182..697a6f0d4 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -111,7 +111,8 @@ PrintConfigDef::PrintConfigDef() "with cooling (use a fan) before tweaking this."); def->cli = "bridge-flow-ratio=f"; def->min = 0; - def->default_value = new ConfigOptionFloat(1); + def->max = 2; + def->default_value = new ConfigOptionFloat(1); def = this->add("bridge_speed", coFloat); def->label = L("Bridges"); diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index 5cae9172e..a5a14d368 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -82,10 +82,8 @@ namespace Slic3r { namespace GUI { return std::regex_match(string, regex_pattern); } -// boost::any Field::get_value_by_opt_type(wxString& str) void Field::get_value_by_opt_type(wxString& str) { -// boost::any m_value; switch (m_opt.type){ case coInt: m_value = wxAtoi(str); @@ -96,9 +94,24 @@ namespace Slic3r { namespace GUI { case coFloat:{ if (m_opt.type == coPercent && str.Last() == '%') str.RemoveLast(); + else if (str.Last() == '%') { + show_error(m_parent, _(L("Current option doesn't support percentage"))); + set_value(double_to_string(m_opt.min), true); + m_value = double(m_opt.min); + break; + } double val; str.ToCDouble(&val); - m_value = val; + if (m_opt.min <= val && val <= m_opt.max) + m_value = val; + else + { + show_error(m_parent, _(L("Input value is out of range"))); + if (m_opt.min > val) val = m_opt.min; + if (val > m_opt.max) val = m_opt.max; + set_value(double_to_string(val), true); + m_value = val; + } break; } case coString: case coStrings: @@ -108,8 +121,6 @@ namespace Slic3r { namespace GUI { default: break; } - -// return m_value; } void TextCtrl::BUILD() { @@ -188,9 +199,9 @@ namespace Slic3r { namespace GUI { boost::any& TextCtrl::get_value() { wxString ret_str = static_cast(window)->GetValue(); - /*boost::any ret_val*/get_value_by_opt_type(ret_str); + get_value_by_opt_type(ret_str); - return m_value;//ret_val; + return m_value; } void TextCtrl::enable() { dynamic_cast(window)->Enable(); dynamic_cast(window)->SetEditable(true); } diff --git a/xs/src/slic3r/GUI/Field.hpp b/xs/src/slic3r/GUI/Field.hpp index 729f73d16..7e421244b 100644 --- a/xs/src/slic3r/GUI/Field.hpp +++ b/xs/src/slic3r/GUI/Field.hpp @@ -124,7 +124,6 @@ public: virtual wxWindow* getWindow() { return nullptr; } bool is_matched(const std::string& string, const std::string& pattern); -// boost::any get_value_by_opt_type(wxString& str); void get_value_by_opt_type(wxString& str); /// Factory method for generating new derived classes. From 98d9ce31de65f70111c490a883b33408d0f30124 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 10 May 2018 12:54:02 +0200 Subject: [PATCH 02/13] Corrected error message to last commit --- xs/src/slic3r/GUI/Field.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index a5a14d368..623e20b45 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -95,23 +95,25 @@ namespace Slic3r { namespace GUI { if (m_opt.type == coPercent && str.Last() == '%') str.RemoveLast(); else if (str.Last() == '%') { - show_error(m_parent, _(L("Current option doesn't support percentage"))); + wxString label = m_Label->GetLabel(); + if (label.Last() == '\n') label.RemoveLast(); + while (label.Last() == ' ') label.RemoveLast(); + if (label.Last() == ':') label.RemoveLast(); + show_error(m_parent, wxString::Format(_(L("%s doesn't support percentage")), label)); set_value(double_to_string(m_opt.min), true); m_value = double(m_opt.min); break; } double val; str.ToCDouble(&val); - if (m_opt.min <= val && val <= m_opt.max) - m_value = val; - else + if (m_opt.min > val && val > m_opt.max) { show_error(m_parent, _(L("Input value is out of range"))); if (m_opt.min > val) val = m_opt.min; if (val > m_opt.max) val = m_opt.max; set_value(double_to_string(val), true); - m_value = val; } + m_value = val; break; } case coString: case coStrings: From 5e231bf8749c0eb54cd3ffc71f5d172d7c8a9c65 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 10 May 2018 17:44:04 +0200 Subject: [PATCH 03/13] New wipe tower parameters added to INI file with profiles --- resources/profiles/PrusaResearch.ini | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index d82921fd8..87950bae7 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -121,7 +121,8 @@ top_infill_extrusion_width = 0.45 top_solid_infill_speed = 40 travel_speed = 180 wipe_tower = 1 -wipe_tower_per_color_wipe = 20 +wipe_tower_bridging = 10 +wipe_tower_rotation_angle = 0 wipe_tower_width = 60 wipe_tower_x = 180 wipe_tower_y = 140 @@ -538,6 +539,10 @@ compatible_printers = compatible_printers_condition = end_filament_gcode = "; Filament-specific end gcode" extrusion_multiplier = 1 +filament_loading_speed = 28 +filament_unloading_speed = 90 +filament_toolchange_delay = 0 +filament_ramming_parameters = "120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0| 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" filament_cost = 0 filament_density = 0 filament_diameter = 1.75 @@ -591,6 +596,7 @@ fan_always_on = 0 fan_below_layer_time = 20 filament_colour = #3A80CA filament_max_volumetric_speed = 11 +filament_ramming_parameters = "120 100 5.70968 6.03226 7 8.25806 9 9.19355 9.3871 9.77419 10.129 10.3226 10.4516 10.5161| 0.05 5.69677 0.45 6.15484 0.95 8.76774 1.45 9.20323 1.95 9.95806 2.45 10.3871 2.95 10.5677 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" filament_type = ABS first_layer_bed_temperature = 100 first_layer_temperature = 255 @@ -763,6 +769,7 @@ fan_always_on = 0 filament_colour = #FFFFD7 filament_max_volumetric_speed = 10 filament_notes = "List of materials tested with standart PVA print settings for MK2:\n\nPrimaSelect PVA+\nICE FILAMENTS PVA 'NAUGHTY NATURAL'\nVerbatim BVOH" +filament_ramming_parameters = "120 100 8.3871 8.6129 8.93548 9.22581 9.48387 9.70968 9.87097 10.0323 10.2258 10.4194 10.6452 10.8065| 0.05 8.34193 0.45 8.73548 0.95 9.34836 1.45 9.78385 1.95 10.0871 2.45 10.5161 2.95 10.8903 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" filament_soluble = 1 filament_type = PVA first_layer_temperature = 195 @@ -933,6 +940,9 @@ retract_restart_extra_toolchange = 0 retract_speed = 80 single_extruder_multi_material = 1 printer_model = MK2SMM +parking_pos_retraction = 92 +cooling_tube_length = 5 +cooling_tube_retraction = 91.5 [printer:*mm-single*] inherits = *multimaterial* From 9af6a89f20785feab4d068977957bee9ee239cad Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 10 May 2018 18:07:22 +0200 Subject: [PATCH 04/13] Fixed a crash when loading multipart objects --- lib/Slic3r/GUI/Plater.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 0a5d02b94..08c1065df 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -700,7 +700,7 @@ sub load_files { . "Instead of considering them as multiple objects, should I consider\n" . "this file as a single object having multiple parts?\n"), L('Multi-part object detected'), wxICON_WARNING | wxYES | wxNO); - $model->convert_multipart_object if $dialog->ShowModal(scalar(@$nozzle_dmrs)) == wxID_YES; + $model->convert_multipart_object(scalar(@$nozzle_dmrs)) if $dialog->ShowModal() == wxID_YES; } if ($one_by_one) { @@ -717,7 +717,7 @@ sub load_files { . "Instead of considering them as multiple objects, should I consider\n" . "these files to represent a single object having multiple parts?\n"), L('Multi-part object detected'), wxICON_WARNING | wxYES | wxNO); - $new_model->convert_multipart_object if $dialog->ShowModal(scalar(@$nozzle_dmrs)) == wxID_YES; + $new_model->convert_multipart_object(scalar(@$nozzle_dmrs)) if $dialog->ShowModal() == wxID_YES; push @obj_idx, $self->load_model_objects(@{$new_model->objects}); } From d620961c34ceb8ca747ab675042abb3abf8c341a Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 10 May 2018 18:37:57 +0200 Subject: [PATCH 05/13] Fixed the version number. We have an alpha state as of today. --- xs/src/libslic3r/libslic3r.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xs/src/libslic3r/libslic3r.h b/xs/src/libslic3r/libslic3r.h index 4aef4d5c1..e7b858e8b 100644 --- a/xs/src/libslic3r/libslic3r.h +++ b/xs/src/libslic3r/libslic3r.h @@ -14,7 +14,7 @@ #include #define SLIC3R_FORK_NAME "Slic3r Prusa Edition" -#define SLIC3R_VERSION "1.40.0" +#define SLIC3R_VERSION "1.40.0-alpha" #define SLIC3R_BUILD "UNKNOWN" typedef int32_t coord_t; From e91ebddeea4da1f6062546ee354573119c22f89b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 11 May 2018 09:53:35 +0200 Subject: [PATCH 06/13] Added possibility of select all TextCtrl context using Ctrl+A --- xs/src/slic3r/GUI/Field.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index 623e20b45..0fcf480e3 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -194,6 +194,14 @@ namespace Slic3r { namespace GUI { temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent) { on_change_field(); }), temp->GetId()); + // select all text using Ctrl+A + temp->Bind(wxEVT_CHAR, ([temp](wxKeyEvent& event) + { + if (wxGetKeyState(wxKeyCode('A')) && wxGetKeyState(WXK_CONTROL)) + temp->SetSelection(-1, -1); //select all + event.Skip(); + })); + // recast as a wxWindow to fit the calling convention window = dynamic_cast(temp); } From d89f8128cde85f45beac212847ee0f578eab26ed Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 11 May 2018 12:28:31 +0200 Subject: [PATCH 07/13] Fixed a GCode preview crash on Linux due to returning a reference to temporary (issue #872) --- xs/src/libslic3r/GCode/PreviewData.cpp | 2 +- xs/src/libslic3r/GCode/PreviewData.hpp | 2 +- xs/src/slic3r/GUI/3DScene.cpp | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/xs/src/libslic3r/GCode/PreviewData.cpp b/xs/src/libslic3r/GCode/PreviewData.cpp index d431708c1..40f0747b2 100644 --- a/xs/src/libslic3r/GCode/PreviewData.cpp +++ b/xs/src/libslic3r/GCode/PreviewData.cpp @@ -275,7 +275,7 @@ bool GCodePreviewData::empty() const return extrusion.layers.empty() && travel.polylines.empty() && retraction.positions.empty() && unretraction.positions.empty(); } -const GCodePreviewData::Color& GCodePreviewData::get_extrusion_role_color(ExtrusionRole role) const +GCodePreviewData::Color GCodePreviewData::get_extrusion_role_color(ExtrusionRole role) const { return extrusion.role_colors[role]; } diff --git a/xs/src/libslic3r/GCode/PreviewData.hpp b/xs/src/libslic3r/GCode/PreviewData.hpp index a7d77e0b9..ea8ca6d58 100644 --- a/xs/src/libslic3r/GCode/PreviewData.hpp +++ b/xs/src/libslic3r/GCode/PreviewData.hpp @@ -187,7 +187,7 @@ public: void reset(); bool empty() const; - const Color& get_extrusion_role_color(ExtrusionRole role) const; + Color get_extrusion_role_color(ExtrusionRole role) const; Color get_height_color(float height) const; Color get_width_color(float width) const; Color get_feedrate_color(float feedrate) const; diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index 6b2f5c830..85018404c 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -2204,7 +2204,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, return 0.0f; } - static const GCodePreviewData::Color& path_color(const GCodePreviewData& data, const std::vector& tool_colors, float value) + static const GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector& tool_colors, float value) { switch (data.extrusion.view_type) { @@ -2257,7 +2257,6 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, }; typedef std::vector FiltersList; - size_t initial_volumes_count = volumes.volumes.size(); // detects filters @@ -2281,7 +2280,6 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, for (Filter& filter : filters) { s_gcode_preview_volume_index.first_volumes.emplace_back(GCodePreviewVolumeIndex::Extrusion, (unsigned int)filter.role, (unsigned int)volumes.volumes.size()); - GLVolume* volume = new GLVolume(Helper::path_color(preview_data, tool_colors, filter.value).rgba); if (volume != nullptr) { From 8c4c392cb8a47031402c215c31b3d67eafa5ad49 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 11 May 2018 14:41:21 +0200 Subject: [PATCH 08/13] Fixed enable/disable of the tooltips on GTK --- xs/src/slic3r/GUI/Field.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index 0fcf480e3..4febae362 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -183,14 +183,21 @@ namespace Slic3r { namespace GUI { //! to allow the default handling event.Skip(); //! eliminating the g-code pop up text description - temp->GetToolTip()->Enable(false); + bool flag = false; +#ifdef __WXGTK__ + // I have no idea why, but on GTK flag works in other way + flag = true; +#endif // __WXGTK__ + temp->GetToolTip()->Enable(flag); }), temp->GetId()); +#if !defined(__WXGTK__) temp->Bind(wxEVT_KILL_FOCUS, ([this, temp](wxEvent& e) { e.Skip();// on_kill_focus(e); temp->GetToolTip()->Enable(true); }), temp->GetId()); +#endif // __WXGTK__ temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent) { on_change_field(); }), temp->GetId()); From 613bcf80555ba5982797e31bed7bad9407ea8ae4 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 11 May 2018 15:41:26 +0200 Subject: [PATCH 09/13] Updated PrusaResearch.ini with the latest version from Slic3r-settings repository --- resources/profiles/PrusaResearch.idx | 2 ++ resources/profiles/PrusaResearch.ini | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/resources/profiles/PrusaResearch.idx b/resources/profiles/PrusaResearch.idx index f07d8b280..e3b1e6ef5 100644 --- a/resources/profiles/PrusaResearch.idx +++ b/resources/profiles/PrusaResearch.idx @@ -1 +1,3 @@ +0.1.2 Wipe tower changes +0.1.1 Minor print speed adjustments 0.1.0 Initial diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index 87950bae7..ba8e55ad4 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -5,7 +5,7 @@ name = Prusa Research # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the Slic3r configuration to be downgraded. -config_version = 0.1.0 +config_version = 0.1.2 # Where to get the updates from? config_update_url = https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/PrusaResearch/ @@ -90,7 +90,7 @@ seam_position = nearest skirts = 1 skirt_distance = 2 skirt_height = 3 -small_perimeter_speed = 20 +small_perimeter_speed = 25 solid_infill_below_area = 0 solid_infill_every_layers = 0 solid_infill_extruder = 1 @@ -180,7 +180,7 @@ gap_fill_speed = 20 infill_acceleration = 800 infill_speed = 30 max_print_speed = 80 -small_perimeter_speed = 15 +small_perimeter_speed = 20 solid_infill_speed = 30 support_material_extrusion_width = 0.3 support_material_spacing = 1.5 @@ -215,7 +215,7 @@ infill_speed = 20 max_print_speed = 100 perimeter_extrusion_width = 0 perimeter_speed = 20 -small_perimeter_speed = 10 +small_perimeter_speed = 15 solid_infill_extrusion_width = 0 solid_infill_speed = 20 support_material_speed = 20 @@ -268,7 +268,7 @@ infill_acceleration = 1600 infill_speed = 40 perimeter_acceleration = 600 perimeter_speed = 25 -small_perimeter_speed = 10 +small_perimeter_speed = 15 solid_infill_speed = 40 top_solid_infill_speed = 30 @@ -341,7 +341,7 @@ infill_acceleration = 1600 infill_speed = 40 perimeter_acceleration = 600 perimeter_speed = 25 -small_perimeter_speed = 10 +small_perimeter_speed = 15 solid_infill_speed = 40 support_material_extrusion_width = 0.2 top_solid_infill_speed = 30 @@ -549,7 +549,7 @@ filament_diameter = 1.75 filament_notes = "" filament_settings_id = filament_soluble = 0 -min_print_speed = 5 +min_print_speed = 15 slowdown_below_layer_time = 20 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}30{endif}; Filament gcode" @@ -643,7 +643,6 @@ first_layer_bed_temperature = 105 first_layer_temperature = 270 max_fan_speed = 20 min_fan_speed = 10 -min_print_speed = 5 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}45{endif}; Filament gcode" temperature = 270 @@ -657,7 +656,6 @@ extrusion_multiplier = 1.2 filament_colour = #804040 filament_max_volumetric_speed = 10 first_layer_temperature = 200 -min_print_speed = 5 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode" temperature = 200 @@ -823,7 +821,6 @@ first_layer_bed_temperature = 60 first_layer_temperature = 240 max_fan_speed = 5 min_fan_speed = 0 -min_print_speed = 5 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode" temperature = 250 @@ -856,7 +853,6 @@ first_layer_bed_temperature = 60 first_layer_temperature = 215 max_fan_speed = 100 min_fan_speed = 100 -min_print_speed = 15 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode" temperature = 210 @@ -877,7 +873,6 @@ first_layer_bed_temperature = 100 first_layer_temperature = 220 max_fan_speed = 100 min_fan_speed = 100 -min_print_speed = 15 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode" temperature = 220 @@ -938,11 +933,11 @@ retract_lift_below = 199 retract_restart_extra = 0 retract_restart_extra_toolchange = 0 retract_speed = 80 -single_extruder_multi_material = 1 -printer_model = MK2SMM parking_pos_retraction = 92 cooling_tube_length = 5 cooling_tube_retraction = 91.5 +single_extruder_multi_material = 1 +printer_model = MK2SMM [printer:*mm-single*] inherits = *multimaterial* From ae1a015494b0ac1d50f7931b71f09ba560e3a984 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 11 May 2018 16:03:07 +0200 Subject: [PATCH 10/13] Fixed Perl array addressing issues, leading to crashes when loading additional objects at the 3D path preview window. --- lib/Slic3r/GUI/Plater/3D.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Slic3r/GUI/Plater/3D.pm b/lib/Slic3r/GUI/Plater/3D.pm index ced6fb82e..c9c954276 100644 --- a/lib/Slic3r/GUI/Plater/3D.pm +++ b/lib/Slic3r/GUI/Plater/3D.pm @@ -32,7 +32,7 @@ sub new { $self->{on_instances_moved} = sub {}; $self->{on_wipe_tower_moved} = sub {}; - $self->{objects_volumes_idxs} = (); + $self->{objects_volumes_idxs} = []; $self->on_select(sub { my ($volume_idx) = @_; @@ -188,8 +188,8 @@ sub update_volumes_selection { foreach my $obj_idx (0..$#{$self->{model}->objects}) { if ($self->{objects}[$obj_idx]->selected) { - my @volume_idxs = @{$self->{objects_volumes_idxs}[$obj_idx]}; - $self->select_volume($_) for @volume_idxs; + my $volume_idxs = $self->{objects_volumes_idxs}->[$obj_idx]; + $self->select_volume($_) for @{$volume_idxs}; } } } @@ -207,7 +207,7 @@ sub reload_scene { $self->{reload_delayed} = 0; - $self->{objects_volumes_idxs} = (); + $self->{objects_volumes_idxs} = []; foreach my $obj_idx (0..$#{$self->{model}->objects}) { my @volume_idxs = $self->load_object($self->{model}, $self->{print}, $obj_idx); push(@{$self->{objects_volumes_idxs}}, \@volume_idxs); From 4cf74d6dcf6a4129915f71d79d59642ffd1981bb Mon Sep 17 00:00:00 2001 From: YuSanka Date: Sun, 13 May 2018 21:00:03 +0200 Subject: [PATCH 11/13] Object information is pasted to the ScrolledWindow --- lib/Slic3r/GUI/Plater.pm | 46 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 08c1065df..eb655ae55 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -225,7 +225,13 @@ sub new { $self->{btoolbar}->Add($self->{"btn_layer_editing"}); } - $self->{list} = Wx::ListView->new($self, -1, wxDefaultPosition, wxDefaultSize, + ### Scrolled Window for info boxes + my $scrolled_window_sizer = Wx::BoxSizer->new(wxVERTICAL); + my $scrolled_window_panel = Wx::ScrolledWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); + $scrolled_window_panel->SetSizer($scrolled_window_sizer); + $scrolled_window_panel->SetScrollbars(1, 1, 1, 1); + + $self->{list} = Wx::ListView->new($scrolled_window_panel, -1, wxDefaultPosition, wxDefaultSize, wxLC_SINGLE_SEL | wxLC_REPORT | wxBORDER_SUNKEN | wxTAB_TRAVERSAL | wxWANTS_CHARS ); $self->{list}->InsertColumn(0, L("Name"), wxLIST_FORMAT_LEFT, 145); $self->{list}->InsertColumn(1, L("Copies"), wxLIST_FORMAT_CENTER, 45); @@ -405,12 +411,12 @@ sub new { my $frequently_changed_parameters_sizer = Wx::BoxSizer->new(wxHORIZONTAL); Slic3r::GUI::add_frequently_changed_parameters($self, $frequently_changed_parameters_sizer, $presets); - + my $object_info_sizer; { - my $box = Wx::StaticBox->new($self, -1, L("Info")); + my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Info")); $object_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL); - $object_info_sizer->SetMinSize([350,-1]); + $object_info_sizer->SetMinSize([300,-1]); my $grid_sizer = Wx::FlexGridSizer->new(3, 4, 5, 5); $grid_sizer->SetFlexibleDirection(wxHORIZONTAL); $grid_sizer->AddGrowableCol(1, 1); @@ -426,14 +432,14 @@ sub new { ); while (my $field = shift @info) { my $label = shift @info; - my $text = Wx::StaticText->new($self, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); $text->SetFont($Slic3r::GUI::small_font); $grid_sizer->Add($text, 0); - $self->{"object_info_$field"} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + $self->{"object_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); $self->{"object_info_$field"}->SetFont($Slic3r::GUI::small_font); if ($field eq 'manifold') { - $self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($self, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG)); + $self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($scrolled_window_panel, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG)); $self->{object_info_manifold_warning_icon}->Hide; my $h_sizer = Wx::BoxSizer->new(wxHORIZONTAL); @@ -448,9 +454,9 @@ sub new { my $print_info_sizer; { - my $box = Wx::StaticBox->new($self, -1, L("Sliced Info")); + my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Sliced Info")); $print_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL); - $print_info_sizer->SetMinSize([350,-1]); + $print_info_sizer->SetMinSize([300,-1]); my $grid_sizer = Wx::FlexGridSizer->new(2, 2, 5, 5); $grid_sizer->SetFlexibleDirection(wxHORIZONTAL); $grid_sizer->AddGrowableCol(1, 1); @@ -465,11 +471,11 @@ sub new { ); while (my $field = shift @info) { my $label = shift @info; - my $text = Wx::StaticText->new($self, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); $text->SetFont($Slic3r::GUI::small_font); $grid_sizer->Add($text, 0); - $self->{"print_info_$field"} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + $self->{"print_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); $self->{"print_info_$field"}->SetFont($Slic3r::GUI::small_font); $grid_sizer->Add($self->{"print_info_$field"}, 0); } @@ -484,18 +490,24 @@ sub new { $buttons_sizer->Add($self->{btn_send_gcode}, 0, wxALIGN_RIGHT, 0); $buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0); + $scrolled_window_sizer->Add($self->{list}, 1, wxEXPAND, 5); + $scrolled_window_sizer->Add($object_info_sizer, 0, wxEXPAND, 0); + $scrolled_window_sizer->Add($print_info_sizer, 0, wxEXPAND, 0); + my $right_sizer = Wx::BoxSizer->new(wxVERTICAL); $right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets; $right_sizer->Add($frequently_changed_parameters_sizer, 0, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer; $right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5); - $right_sizer->Add($self->{list}, 1, wxEXPAND, 5); - $right_sizer->Add($object_info_sizer, 0, wxEXPAND, 0); - $right_sizer->Add($print_info_sizer, 0, wxEXPAND, 0); + $right_sizer->Add($scrolled_window_panel, 1, wxEXPAND | wxALL, 1); # Callback for showing / hiding the print info box. $self->{"print_info_box_show"} = sub { - if ($right_sizer->IsShown(5) != $_[0]) { - $right_sizer->Show(5, $_[0]); - $self->Layout +# if ($right_sizer->IsShown(5) != $_[0]) { +# $right_sizer->Show(5, $_[0]); +# $self->Layout +# } + if ($scrolled_window_sizer->IsShown(2) != $_[0]) { + $scrolled_window_sizer->Show(2, $_[0]); + $scrolled_window_panel->Layout } }; # Show the box initially, let it be shown after the slicing is finished. From e90bc3fcabafb333bb6e7db8fe65e20f9ca6613d Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 14 May 2018 09:00:19 +0200 Subject: [PATCH 12/13] Fix in _3DScene::_load_gcode_extrusion_paths::Helper::path_color() --- xs/src/slic3r/GUI/3DScene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index 85018404c..df8b1fbfc 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -2204,7 +2204,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, return 0.0f; } - static const GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector& tool_colors, float value) + static GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector& tool_colors, float value) { switch (data.extrusion.view_type) { @@ -2220,7 +2220,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, return data.get_volumetric_rate_color(value); case GCodePreviewData::Extrusion::Tool: { - static GCodePreviewData::Color color; + GCodePreviewData::Color color; ::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float)); return color; } From 5fb81bacd526d8d460fb8eebe7d8aa464697c991 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 14 May 2018 09:54:38 +0200 Subject: [PATCH 13/13] Added layer index under sliders in 3D view --- lib/Slic3r/GUI/Plater/3DPreview.pm | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/GUI/Plater/3DPreview.pm b/lib/Slic3r/GUI/Plater/3DPreview.pm index 9d8b82242..b746de98f 100644 --- a/lib/Slic3r/GUI/Plater/3DPreview.pm +++ b/lib/Slic3r/GUI/Plater/3DPreview.pm @@ -58,6 +58,13 @@ sub new { [40,-1], wxALIGN_CENTRE_HORIZONTAL); $z_label_high->SetFont($Slic3r::GUI::small_font); + my $z_label_low_idx = $self->{z_label_low_idx} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, + [40,-1], wxALIGN_CENTRE_HORIZONTAL); + $z_label_low_idx->SetFont($Slic3r::GUI::small_font); + my $z_label_high_idx = $self->{z_label_high_idx} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, + [40,-1], wxALIGN_CENTRE_HORIZONTAL); + $z_label_high_idx->SetFont($Slic3r::GUI::small_font); + $self->single_layer(0); my $checkbox_singlelayer = $self->{checkbox_singlelayer} = Wx::CheckBox->new($self, -1, L("1 Layer")); @@ -103,11 +110,13 @@ sub new { my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); my $vsizer = Wx::BoxSizer->new(wxVERTICAL); my $vsizer_outer = Wx::BoxSizer->new(wxVERTICAL); - $vsizer->Add($slider_low, 3, 0, 0); - $vsizer->Add($z_label_low, 0, 0, 0); + $vsizer->Add($slider_low, 3, wxALIGN_CENTER_HORIZONTAL, 0); + $vsizer->Add($z_label_low_idx, 0, wxALIGN_CENTER_HORIZONTAL, 0); + $vsizer->Add($z_label_low, 0, wxALIGN_CENTER_HORIZONTAL, 0); $hsizer->Add($vsizer, 0, wxEXPAND, 0); $vsizer = Wx::BoxSizer->new(wxVERTICAL); - $vsizer->Add($slider_high, 3, 0, 0); + $vsizer->Add($slider_high, 3, wxALIGN_CENTER_HORIZONTAL, 0); + $vsizer->Add($z_label_high_idx, 0, wxALIGN_CENTER_HORIZONTAL, 0); $vsizer->Add($z_label_high, 0, 0, 0); $hsizer->Add($vsizer, 0, wxEXPAND, 0); $vsizer_outer->Add($hsizer, 3, wxALIGN_CENTER_HORIZONTAL, 0); @@ -325,6 +334,8 @@ sub load_print { $self->slider_high->Hide; $self->{z_label_low}->SetLabel(""); $self->{z_label_high}->SetLabel(""); + $self->{z_label_low_idx}->SetLabel(""); + $self->{z_label_high_idx}->SetLabel(""); $self->canvas->reset_legend_texture(); $self->canvas->Refresh; # clears canvas return; @@ -427,6 +438,10 @@ sub set_z_range return if !$self->enabled; $self->{z_label_low}->SetLabel(sprintf '%.2f', $z_low); $self->{z_label_high}->SetLabel(sprintf '%.2f', $z_high); + my $z_idx_low = 1 + $self->slider_low->GetValue; + my $z_idx_high = 1 + $self->slider_high->GetValue; + $self->{z_label_low_idx}->SetLabel(sprintf '%d', $z_idx_low); + $self->{z_label_high_idx}->SetLabel(sprintf '%d', $z_idx_high); $self->canvas->set_toolpaths_range($z_low - 1e-6, $z_high + 1e-6); $self->canvas->Refresh if $self->IsShown; }