mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-15 02:21:49 +08:00
update
This commit is contained in:
parent
873e4fea31
commit
d355df4be5
@ -1865,7 +1865,7 @@ void GCode::process_layer(
|
|||||||
|
|
||||||
if (custom_code == ColorChangeCode && m_custom_gcode_per_print_z.front().extruder > 0)
|
if (custom_code == ColorChangeCode && m_custom_gcode_per_print_z.front().extruder > 0)
|
||||||
m600_before_extruder = m_custom_gcode_per_print_z.front().extruder - 1;
|
m600_before_extruder = m_custom_gcode_per_print_z.front().extruder - 1;
|
||||||
if (custom_code == PausePrintCode)
|
if (custom_code == GCodeWriter::PausePrintCode)
|
||||||
pause_print_msg = m_custom_gcode_per_print_z.front().color;
|
pause_print_msg = m_custom_gcode_per_print_z.front().color;
|
||||||
|
|
||||||
m_custom_gcode_per_print_z.erase(m_custom_gcode_per_print_z.begin());
|
m_custom_gcode_per_print_z.erase(m_custom_gcode_per_print_z.begin());
|
||||||
@ -1900,7 +1900,7 @@ void GCode::process_layer(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (custom_code == PausePrintCode) // Pause print
|
if (custom_code == GCodeWriter::PausePrintCode) // Pause print
|
||||||
{
|
{
|
||||||
// add tag for analyzer
|
// add tag for analyzer
|
||||||
gcode += "; " + GCodeAnalyzer::Pause_Print_Tag + "\n";
|
gcode += "; " + GCodeAnalyzer::Pause_Print_Tag + "\n";
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
std::string GCodeWriter::PausePrintCode = "M601";
|
||||||
|
|
||||||
void GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
void GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
||||||
{
|
{
|
||||||
this->config.apply(print_config, true);
|
this->config.apply(print_config, true);
|
||||||
|
@ -12,11 +12,12 @@ namespace Slic3r {
|
|||||||
|
|
||||||
// Additional Codes which can be set by user using DoubleSlider
|
// Additional Codes which can be set by user using DoubleSlider
|
||||||
static constexpr char ColorChangeCode[] = "M600";
|
static constexpr char ColorChangeCode[] = "M600";
|
||||||
static constexpr char PausePrintCode[] = "M601";
|
//static constexpr char PausePrintCode[] = "M601";
|
||||||
static constexpr char ExtruderChangeCode[] = "tool_change";
|
static constexpr char ExtruderChangeCode[] = "tool_change";
|
||||||
|
|
||||||
class GCodeWriter {
|
class GCodeWriter {
|
||||||
public:
|
public:
|
||||||
|
static std::string PausePrintCode;
|
||||||
GCodeConfig config;
|
GCodeConfig config;
|
||||||
bool multiple_extruders;
|
bool multiple_extruders;
|
||||||
|
|
||||||
|
@ -5406,7 +5406,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
{
|
{
|
||||||
const std::string& code = it->gcode;
|
const std::string& code = it->gcode;
|
||||||
// pause print or custom Gcode
|
// pause print or custom Gcode
|
||||||
if (code == PausePrintCode ||
|
if (code == GCodeWriter::PausePrintCode ||
|
||||||
(code != ColorChangeCode && code != ExtruderChangeCode))
|
(code != ColorChangeCode && code != ExtruderChangeCode))
|
||||||
return number_tools()-1; // last color item is a gray color for pause print or custom G-code
|
return number_tools()-1; // last color item is a gray color for pause print or custom G-code
|
||||||
|
|
||||||
|
@ -3090,6 +3090,10 @@ void TabPrinter::update_fff()
|
|||||||
else
|
else
|
||||||
sm->disable();
|
sm->disable();
|
||||||
}
|
}
|
||||||
|
if (m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfKlipper)
|
||||||
|
GCodeWriter::PausePrintCode = "PAUSE";
|
||||||
|
else
|
||||||
|
GCodeWriter::PausePrintCode = "M601";
|
||||||
|
|
||||||
if (m_use_silent_mode != m_config->opt_bool("silent_mode")) {
|
if (m_use_silent_mode != m_config->opt_bool("silent_mode")) {
|
||||||
m_rebuild_kinematics_page = true;
|
m_rebuild_kinematics_page = true;
|
||||||
|
@ -2824,7 +2824,7 @@ void DoubleSlider::draw_ticks(wxDC& dc)
|
|||||||
// Draw icon for "Pause print" or "Custom Gcode"
|
// Draw icon for "Pause print" or "Custom Gcode"
|
||||||
if (tick.gcode != Slic3r::ColorChangeCode && tick.gcode != Slic3r::ExtruderChangeCode)
|
if (tick.gcode != Slic3r::ColorChangeCode && tick.gcode != Slic3r::ExtruderChangeCode)
|
||||||
{
|
{
|
||||||
wxBitmap icon = create_scaled_bitmap(this, tick.gcode == Slic3r::PausePrintCode ? "pause_print" : "edit_gcode");
|
wxBitmap icon = create_scaled_bitmap(this, tick.gcode == Slic3r::GCodeWriter::PausePrintCode ? "pause_print" : "edit_gcode");
|
||||||
|
|
||||||
wxCoord x_draw, y_draw;
|
wxCoord x_draw, y_draw;
|
||||||
is_horizontal() ? x_draw = pos - 0.5 * m_tick_icon_dim : y_draw = pos - 0.5 * m_tick_icon_dim;
|
is_horizontal() ? x_draw = pos - 0.5 * m_tick_icon_dim : y_draw = pos - 0.5 * m_tick_icon_dim;
|
||||||
@ -3469,7 +3469,7 @@ void DoubleSlider::OnRightUp(wxMouseEvent& event)
|
|||||||
[this](wxCommandEvent&) { add_code(Slic3r::ColorChangeCode); }, "colorchange_add_m", &menu);
|
[this](wxCommandEvent&) { add_code(Slic3r::ColorChangeCode); }, "colorchange_add_m", &menu);
|
||||||
|
|
||||||
append_menu_item(&menu, wxID_ANY, _(L("Add pause print")) + " (M601)", "",
|
append_menu_item(&menu, wxID_ANY, _(L("Add pause print")) + " (M601)", "",
|
||||||
[this](wxCommandEvent&) { add_code(Slic3r::PausePrintCode); }, "pause_print", &menu);
|
[this](wxCommandEvent&) { add_code(Slic3r::GCodeWriter::PausePrintCode); }, "pause_print", &menu);
|
||||||
|
|
||||||
append_menu_item(&menu, wxID_ANY, _(L("Add custom G-code")), "",
|
append_menu_item(&menu, wxID_ANY, _(L("Add custom G-code")), "",
|
||||||
[this](wxCommandEvent&) { add_code(""); }, "edit_gcode", &menu);
|
[this](wxCommandEvent&) { add_code(""); }, "edit_gcode", &menu);
|
||||||
@ -3485,12 +3485,12 @@ void DoubleSlider::OnRightUp(wxMouseEvent& event)
|
|||||||
const bool is_color_change = it->gcode == Slic3r::ColorChangeCode;
|
const bool is_color_change = it->gcode == Slic3r::ColorChangeCode;
|
||||||
|
|
||||||
append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Edit color")) :
|
append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Edit color")) :
|
||||||
it->gcode == Slic3r::PausePrintCode ? _(L("Edit pause print message")) :
|
it->gcode == Slic3r::GCodeWriter::PausePrintCode ? _(L("Edit pause print message")) :
|
||||||
_(L("Edit custom G-code")), "",
|
_(L("Edit custom G-code")), "",
|
||||||
[this](wxCommandEvent&) { edit_tick(); }, "edit_uni", &menu);
|
[this](wxCommandEvent&) { edit_tick(); }, "edit_uni", &menu);
|
||||||
|
|
||||||
append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Delete color change")) :
|
append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Delete color change")) :
|
||||||
it->gcode == Slic3r::PausePrintCode ? _(L("Delete pause print")) :
|
it->gcode == Slic3r::GCodeWriter::PausePrintCode ? _(L("Delete pause print")) :
|
||||||
_(L("Delete custom G-code")), "",
|
_(L("Delete custom G-code")), "",
|
||||||
[this](wxCommandEvent&) { action_tick(taDel); }, "colorchange_del_f", &menu);
|
[this](wxCommandEvent&) { action_tick(taDel); }, "colorchange_del_f", &menu);
|
||||||
|
|
||||||
@ -3581,7 +3581,7 @@ void DoubleSlider::add_code(std::string code, int selected_extruder/* = -1*/)
|
|||||||
if (color.empty())
|
if (color.empty())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (code == Slic3r::PausePrintCode)
|
else if (code == Slic3r::GCodeWriter::PausePrintCode)
|
||||||
{
|
{
|
||||||
/* PausePrintCode doesn't need a color, so
|
/* PausePrintCode doesn't need a color, so
|
||||||
* this field is used for save a short message shown on Printer display
|
* this field is used for save a short message shown on Printer display
|
||||||
@ -3625,7 +3625,7 @@ void DoubleSlider::edit_tick()
|
|||||||
std::string edited_value;
|
std::string edited_value;
|
||||||
if (it->gcode == Slic3r::ColorChangeCode)
|
if (it->gcode == Slic3r::ColorChangeCode)
|
||||||
edited_value = get_new_color(it->color);
|
edited_value = get_new_color(it->color);
|
||||||
else if (it->gcode == Slic3r::PausePrintCode)
|
else if (it->gcode == Slic3r::GCodeWriter::PausePrintCode)
|
||||||
edited_value = get_pause_print_msg(it->color, m_values[it->tick]);
|
edited_value = get_pause_print_msg(it->color, m_values[it->tick]);
|
||||||
else
|
else
|
||||||
edited_value = get_custom_code(it->gcode, m_values[it->tick]);
|
edited_value = get_custom_code(it->gcode, m_values[it->tick]);
|
||||||
@ -3634,7 +3634,7 @@ void DoubleSlider::edit_tick()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TICK_CODE changed_tick = *it;
|
TICK_CODE changed_tick = *it;
|
||||||
if (it->gcode == Slic3r::ColorChangeCode || it->gcode == Slic3r::PausePrintCode) {
|
if (it->gcode == Slic3r::ColorChangeCode || it->gcode == Slic3r::GCodeWriter::PausePrintCode) {
|
||||||
if (it->color == edited_value)
|
if (it->color == edited_value)
|
||||||
return;
|
return;
|
||||||
changed_tick.color = edited_value;
|
changed_tick.color = edited_value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user