From f2a994543556c5c3dfa42978483619ede307f9f8 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 31 Oct 2021 00:08:11 +0200 Subject: Add lift_min: minimum height to travel between objects Also change other behaviors to be compliant: * At the first move don't split the travel * At the first move, if start_gcode_manual and no layer_gcode, don't lift the nozzle so the printer won't "z-dance", whatever where the nozzle is. Note:it's a hack, please redo it properly when reworking gcode-writer. * retract_lift_first_layer is gone back to the old simple behavior (revert b16ecbfc) * removed auto extra lift for first layer, now that lift_min exists. * with complete_object, don't unlift at object/first layer change, to avoid Z-dance * lift_min will be used between brims, skirts, objects but not between object-skirt, object-brim and their object supermerill/SuperSlicer#1783 supermerill/SuperSlicer#1775 supermerill/SuperSlicer#1575 supermerill/SuperSlicer#599 supermerill/SuperSlicer#429 supermerill/SuperSlicer#395 supermerill/SuperSlicer#241 --- src/slic3r/GUI/DoubleSlider.cpp | 117 ++++++++++++++++++++-------------------- src/slic3r/GUI/Tab.cpp | 2 +- 2 files changed, 59 insertions(+), 60 deletions(-) (limited to 'src/slic3r') diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index 42f24a601..175757b1a 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -986,71 +986,70 @@ void Control::draw_ruler(wxDC& dc) wxCoord pos = get_position_from_value(tick); draw_ticks_pair(dc, pos, mid, 5); draw_tick_text(dc, wxPoint(mid, pos), tick); - } - else { - auto draw_short_ticks = [this, mid](wxDC& dc, double& current_tick, int max_tick) { - while (current_tick < max_tick) { - wxCoord pos = get_position_from_value(lround(current_tick)); - draw_ticks_pair(dc, pos, mid, 2); - current_tick += m_ruler.short_step; - if (current_tick > m_max_value) - break; - } - }; - - double short_tick = std::nan(""); - int tick = 0; - double value = 0.0; - int sequence = 0; - - int prev_y_pos = -1; - wxCoord label_height = dc.GetMultiLineTextExtent("0").y - 2; - int values_size = (int)m_values.size(); - - while (tick <= m_max_value) { - value += m_ruler.long_step; - if (value > m_values.back() && sequence < m_ruler.count) { - value = m_ruler.long_step; - for (; tick < values_size; tick++) - if (m_values[tick] < value) + } else { + auto draw_short_ticks = [this, mid](wxDC& dc, double& current_tick, int max_tick) { + while (current_tick < max_tick) { + wxCoord pos = get_position_from_value(lround(current_tick)); + draw_ticks_pair(dc, pos, mid, 2); + current_tick += m_ruler.short_step; + if (current_tick > m_max_value) break; - // short ticks from the last tick to the end of current sequence - assert(! std::isnan(short_tick)); - draw_short_ticks(dc, short_tick, tick); - sequence++; - } - short_tick = tick; + } + }; + + double short_tick = std::nan(""); + int tick = 0; + double value = 0.0; + int sequence = 0; + + int prev_y_pos = -1; + wxCoord label_height = dc.GetMultiLineTextExtent("0").y - 2; + int values_size = (int)m_values.size(); + + while (tick <= m_max_value) { + value += m_ruler.long_step; + if (value > m_values.back() && sequence < m_ruler.count) { + value = m_ruler.long_step; + for (; tick < values_size; tick++) + if (m_values[tick] < value) + break; + // short ticks from the last tick to the end of current sequence + //assert(!std::isnan(short_tick)); + draw_short_ticks(dc, short_tick, tick); + sequence++; + } + short_tick = tick; - for (; tick < values_size; tick++) { - if (m_values[tick] == value) - break; - if (m_values[tick] > value) { - if (tick > 0) - tick--; - break; - } - } - if (tick > m_max_value) - break; + for (; tick < values_size; tick++) { + if (m_values[tick] == value) + break; + if (m_values[tick] > value) { + if (tick > 0) + tick--; + break; + } + } + if (tick > m_max_value) + break; - wxCoord pos = get_position_from_value(tick); - draw_ticks_pair(dc, pos, mid, 5); - if (prev_y_pos < 0 || prev_y_pos - pos >= label_height) { - draw_tick_text(dc, wxPoint(mid, pos), tick); - prev_y_pos = pos; - } + wxCoord pos = get_position_from_value(tick); + draw_ticks_pair(dc, pos, mid, 5); + if (prev_y_pos < 0 || prev_y_pos - pos >= label_height) { + draw_tick_text(dc, wxPoint(mid, pos), tick); + prev_y_pos = pos; + } - draw_short_ticks(dc, short_tick, tick); + draw_short_ticks(dc, short_tick, tick); - if (value == m_values.back() && sequence < m_ruler.count) { - value = 0.0; - sequence++; - tick++; + if (value == m_values.back() && sequence < m_ruler.count) { + value = 0.0; + sequence++; + tick++; + } + } + // short ticks from the last tick to the end + draw_short_ticks(dc, short_tick, m_max_value); } - } - // short ticks from the last tick to the end - draw_short_ticks(dc, short_tick, m_max_value); - } dc.SetTextForeground(old_clr); } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9db946043..0e3375df3 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2965,7 +2965,7 @@ void TabPrinter::toggle_options() // retract lift above / below only applies if using retract lift vec.resize(0); - vec = { "retract_lift_above", "retract_lift_below", "retract_lift_top" }; + vec = { "retract_lift_above", "retract_lift_below", "retract_lift_top", "retract_lift_first_layer" }; for (auto el : vec) { field = get_field(el, i); if (field) -- cgit v1.2.3