Suppress ColorPrint for the multi-material printing

This commit is contained in:
YuSanka 2018-11-28 16:02:29 +01:00
parent 360133246c
commit c010e14460
5 changed files with 25 additions and 5 deletions

View File

@ -1326,7 +1326,7 @@ void GCode::process_layer(
m_colorprint_heights.erase(m_colorprint_heights.begin()); m_colorprint_heights.erase(m_colorprint_heights.begin());
colorprint_change = true; colorprint_change = true;
} }
if (colorprint_change) if (colorprint_change && print.extruders().size()==1)
gcode += "M600\n"; gcode += "M600\n";

View File

@ -426,6 +426,14 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool for
m_slider->SetTicksValues(ticks_from_config); m_slider->SetTicksValues(ticks_from_config);
set_double_slider_thumbs(layers_z, z_low, z_high); set_double_slider_thumbs(layers_z, z_low, z_high);
bool color_print_enable = (wxGetApp().plater()->printer_technology() == ptFFF);
if (color_print_enable) {
const auto& config = wxGetApp().preset_bundle->full_config();
if (config.opt<ConfigOptionFloats>("nozzle_diameter")->values.size() > 1)
color_print_enable = false;
}
m_slider->EnableTickManipulation(color_print_enable);
} }
void Preview::fill_slider_values(std::vector<std::pair<int, double>> &values, void Preview::fill_slider_values(std::vector<std::pair<int, double>> &values,

View File

@ -1606,6 +1606,10 @@ void Plater::priv::reset()
sidebar->obj_list()->delete_all_objects_from_list(); sidebar->obj_list()->delete_all_objects_from_list();
object_list_changed(); object_list_changed();
update(); update();
auto& config = wxGetApp().preset_bundle->project_config;
config.option<ConfigOptionFloats>("colorprint_heights")->values.clear();
} }
void Plater::priv::mirror(Axis axis) void Plater::priv::mirror(Axis axis)

View File

@ -1569,6 +1569,7 @@ void PrusaDoubleSlider::draw_info_line_with_icon(wxDC& dc, const wxPoint& pos, c
dc.DrawLine(pt_beg, pt_end); dc.DrawLine(pt_beg, pt_end);
//draw action icon //draw action icon
if (m_is_enabled_tick_manipulation)
draw_action_icon(dc, pt_beg, pt_end); draw_action_icon(dc, pt_beg, pt_end);
} }
} }
@ -1677,7 +1678,7 @@ void PrusaDoubleSlider::draw_thumbs(wxDC& dc, const wxCoord& lower_pos, const wx
void PrusaDoubleSlider::draw_ticks(wxDC& dc) void PrusaDoubleSlider::draw_ticks(wxDC& dc)
{ {
dc.SetPen(DARK_GREY_PEN); dc.SetPen(m_is_enabled_tick_manipulation ? DARK_GREY_PEN : LIGHT_GREY_PEN );
int height, width; int height, width;
get_size(&width, &height); get_size(&width, &height);
const wxCoord mid = is_horizontal() ? 0.5*height : 0.5*width; const wxCoord mid = is_horizontal() ? 0.5*height : 0.5*width;
@ -1794,7 +1795,7 @@ void PrusaDoubleSlider::OnLeftDown(wxMouseEvent& event)
this->CaptureMouse(); this->CaptureMouse();
wxClientDC dc(this); wxClientDC dc(this);
wxPoint pos = event.GetLogicalPosition(dc); wxPoint pos = event.GetLogicalPosition(dc);
if (is_point_in_rect(pos, m_rect_tick_action)) { if (is_point_in_rect(pos, m_rect_tick_action) && m_is_enabled_tick_manipulation) {
action_tick(taOnIcon); action_tick(taOnIcon);
return; return;
} }
@ -1812,7 +1813,7 @@ void PrusaDoubleSlider::OnLeftDown(wxMouseEvent& event)
else else
detect_selected_slider(pos); detect_selected_slider(pos);
if (!m_selection) { if (!m_selection && m_is_enabled_tick_manipulation) {
const auto tick = is_point_near_tick(pos); const auto tick = is_point_near_tick(pos);
if (tick >= 0) if (tick >= 0)
{ {

View File

@ -683,6 +683,12 @@ public:
void ChangeOneLayerLock(); void ChangeOneLayerLock();
std::vector<double> GetTicksValues() const; std::vector<double> GetTicksValues() const;
void SetTicksValues(const std::vector<double>& heights); void SetTicksValues(const std::vector<double>& heights);
void EnableTickManipulation(bool enable = true) {
m_is_enabled_tick_manipulation = enable;
}
void DisableTickManipulation() {
EnableTickManipulation(false);
}
void OnPaint(wxPaintEvent& ) { render();} void OnPaint(wxPaintEvent& ) { render();}
void OnLeftDown(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& event);
@ -753,6 +759,7 @@ private:
bool m_is_focused = false; bool m_is_focused = false;
bool m_is_action_icon_focesed = false; bool m_is_action_icon_focesed = false;
bool m_is_one_layer_icon_focesed = false; bool m_is_one_layer_icon_focesed = false;
bool m_is_enabled_tick_manipulation = true;
wxRect m_rect_lower_thumb; wxRect m_rect_lower_thumb;
wxRect m_rect_higher_thumb; wxRect m_rect_higher_thumb;