mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 22:00:39 +08:00
Move binary gcode checkbox to Printer Settings
This commit is contained in:
parent
1d9bd1c62c
commit
2d130c71b6
@ -868,7 +868,7 @@ static inline GCode::SmoothPathCache smooth_path_interpolate_global(const Print&
|
|||||||
|
|
||||||
void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGeneratorCallback thumbnail_cb)
|
void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGeneratorCallback thumbnail_cb)
|
||||||
{
|
{
|
||||||
const bool export_to_binary_gcode = print.full_print_config().option<ConfigOptionBool>("gcode_binary")->value;
|
const bool export_to_binary_gcode = print.full_print_config().option<ConfigOptionBool>("binary_gcode")->value;
|
||||||
// if exporting gcode in binary format:
|
// if exporting gcode in binary format:
|
||||||
// we generate here the data to be passed to the post-processor, who is responsible to export them to file
|
// we generate here the data to be passed to the post-processor, who is responsible to export them to file
|
||||||
// 1) generate the thumbnails
|
// 1) generate the thumbnails
|
||||||
|
@ -572,8 +572,8 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
|||||||
{
|
{
|
||||||
m_parser.apply_config(config);
|
m_parser.apply_config(config);
|
||||||
|
|
||||||
m_binarizer.set_enabled(config.gcode_binary);
|
m_binarizer.set_enabled(config.binary_gcode);
|
||||||
m_result.is_binary_file = config.gcode_binary;
|
m_result.is_binary_file = config.binary_gcode;
|
||||||
|
|
||||||
m_producer = EProducer::PrusaSlicer;
|
m_producer = EProducer::PrusaSlicer;
|
||||||
m_flavor = config.gcode_flavor;
|
m_flavor = config.gcode_flavor;
|
||||||
|
@ -462,7 +462,7 @@ static std::vector<std::string> s_Preset_print_options {
|
|||||||
"support_tree_angle", "support_tree_angle_slow", "support_tree_branch_diameter", "support_tree_branch_diameter_angle", "support_tree_branch_diameter_double_wall",
|
"support_tree_angle", "support_tree_angle_slow", "support_tree_branch_diameter", "support_tree_branch_diameter_angle", "support_tree_branch_diameter_double_wall",
|
||||||
"support_tree_top_rate", "support_tree_branch_distance", "support_tree_tip_diameter",
|
"support_tree_top_rate", "support_tree_branch_distance", "support_tree_tip_diameter",
|
||||||
"dont_support_bridges", "thick_bridges", "notes", "complete_objects", "extruder_clearance_radius",
|
"dont_support_bridges", "thick_bridges", "notes", "complete_objects", "extruder_clearance_radius",
|
||||||
"extruder_clearance_height", "gcode_comments", "gcode_label_objects", "output_filename_format", "post_process", "gcode_substitutions", "gcode_binary", "perimeter_extruder",
|
"extruder_clearance_height", "gcode_comments", "gcode_label_objects", "output_filename_format", "post_process", "gcode_substitutions", "perimeter_extruder",
|
||||||
"infill_extruder", "solid_infill_extruder", "support_material_extruder", "support_material_interface_extruder",
|
"infill_extruder", "solid_infill_extruder", "support_material_extruder", "support_material_interface_extruder",
|
||||||
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
|
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
|
||||||
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
|
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
|
||||||
@ -503,7 +503,7 @@ static std::vector<std::string> s_Preset_machine_limits_options {
|
|||||||
|
|
||||||
static std::vector<std::string> s_Preset_printer_options {
|
static std::vector<std::string> s_Preset_printer_options {
|
||||||
"printer_technology", "autoemit_temperature_commands",
|
"printer_technology", "autoemit_temperature_commands",
|
||||||
"bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset", "gcode_flavor", "use_relative_e_distances",
|
"bed_shape", "bed_custom_texture", "bed_custom_model", "binary_gcode", "z_offset", "gcode_flavor", "use_relative_e_distances",
|
||||||
"use_firmware_retraction", "use_volumetric_e", "variable_layer_height",
|
"use_firmware_retraction", "use_volumetric_e", "variable_layer_height",
|
||||||
//FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset.
|
//FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset.
|
||||||
"host_type", "print_host", "printhost_apikey", "printhost_cafile",
|
"host_type", "print_host", "printhost_apikey", "printhost_cafile",
|
||||||
|
@ -86,6 +86,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||||||
"bed_temperature",
|
"bed_temperature",
|
||||||
"before_layer_gcode",
|
"before_layer_gcode",
|
||||||
"between_objects_gcode",
|
"between_objects_gcode",
|
||||||
|
"binary_gcode",
|
||||||
"bridge_acceleration",
|
"bridge_acceleration",
|
||||||
"bridge_fan_speed",
|
"bridge_fan_speed",
|
||||||
"enable_dynamic_fan_speeds",
|
"enable_dynamic_fan_speeds",
|
||||||
@ -139,7 +140,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||||||
"perimeter_acceleration",
|
"perimeter_acceleration",
|
||||||
"post_process",
|
"post_process",
|
||||||
"gcode_substitutions",
|
"gcode_substitutions",
|
||||||
"gcode_binary",
|
|
||||||
"printer_notes",
|
"printer_notes",
|
||||||
"travel_ramping_lift",
|
"travel_ramping_lift",
|
||||||
"travel_initial_part_length",
|
"travel_initial_part_length",
|
||||||
@ -1598,7 +1598,15 @@ std::string Print::output_filename(const std::string &filename_base) const
|
|||||||
DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders();
|
DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders();
|
||||||
config.set_key_value("num_extruders", new ConfigOptionInt((int)m_config.nozzle_diameter.size()));
|
config.set_key_value("num_extruders", new ConfigOptionInt((int)m_config.nozzle_diameter.size()));
|
||||||
config.set_key_value("default_output_extension", new ConfigOptionString(".gcode"));
|
config.set_key_value("default_output_extension", new ConfigOptionString(".gcode"));
|
||||||
return this->PrintBase::output_filename(m_config.output_filename_format.value, ".gcode", filename_base, &config);
|
|
||||||
|
// Handle output_filename_format. There is a hack related to binary G-codes: gcode / bgcode substitution.
|
||||||
|
std::string output_filename_format = m_config.output_filename_format.value;
|
||||||
|
if (m_config.binary_gcode && boost::iends_with(output_filename_format, ".gcode"))
|
||||||
|
output_filename_format.insert(output_filename_format.end()-5, 'b');
|
||||||
|
if (! m_config.binary_gcode && boost::iends_with(output_filename_format, ".bgcode"))
|
||||||
|
output_filename_format.erase(output_filename_format.end()-6);
|
||||||
|
|
||||||
|
return this->PrintBase::output_filename(output_filename_format, ".gcode", filename_base, &config);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string PrintStatistics::FilamentUsedG = "filament used [g]";
|
const std::string PrintStatistics::FilamentUsedG = "filament used [g]";
|
||||||
|
@ -1510,12 +1510,6 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
def->set_default_value(new ConfigOptionStrings());
|
def->set_default_value(new ConfigOptionStrings());
|
||||||
|
|
||||||
def = this->add("gcode_binary", coBool);
|
|
||||||
def->label = L("Export as binary G-code");
|
|
||||||
def->tooltip = L("Export G-code in binary format.");
|
|
||||||
def->mode = comExpert;
|
|
||||||
def->set_default_value(new ConfigOptionBool(0));
|
|
||||||
|
|
||||||
def = this->add("high_current_on_filament_swap", coBool);
|
def = this->add("high_current_on_filament_swap", coBool);
|
||||||
def->label = L("High extruder current on filament swap");
|
def->label = L("High extruder current on filament swap");
|
||||||
def->tooltip = L("It may be beneficial to increase the extruder motor current during the filament exchange"
|
def->tooltip = L("It may be beneficial to increase the extruder motor current during the filament exchange"
|
||||||
@ -1791,6 +1785,12 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
def->set_default_value(new ConfigOptionBool(true));
|
def->set_default_value(new ConfigOptionBool(true));
|
||||||
|
|
||||||
|
def = this->add("binary_gcode", coBool);
|
||||||
|
def->label = L("Supports binary G-code");
|
||||||
|
def->tooltip = L("The firmware supports binary G-code format (bgcode). This can be overridden in Preferences.");
|
||||||
|
def->mode = comExpert;
|
||||||
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("machine_limits_usage", coEnum);
|
def = this->add("machine_limits_usage", coEnum);
|
||||||
def->label = L("How to apply limits");
|
def->label = L("How to apply limits");
|
||||||
def->full_label = L("Purpose of Machine Limits");
|
def->full_label = L("Purpose of Machine Limits");
|
||||||
@ -4320,6 +4320,7 @@ static std::set<std::string> PrintConfigDef_ignore = {
|
|||||||
"ensure_vertical_shell_thickness",
|
"ensure_vertical_shell_thickness",
|
||||||
// Disabled in 2.6.0-alpha6, this option is problematic
|
// Disabled in 2.6.0-alpha6, this option is problematic
|
||||||
"infill_only_where_needed",
|
"infill_only_where_needed",
|
||||||
|
"gcode_binary" // Introduced in 2.7.0-alpha1, removed in 2.7.1 (replaced by binary_gcode).
|
||||||
};
|
};
|
||||||
|
|
||||||
void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value)
|
void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value)
|
||||||
|
@ -703,6 +703,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||||||
((ConfigOptionBool, autoemit_temperature_commands))
|
((ConfigOptionBool, autoemit_temperature_commands))
|
||||||
((ConfigOptionString, before_layer_gcode))
|
((ConfigOptionString, before_layer_gcode))
|
||||||
((ConfigOptionString, between_objects_gcode))
|
((ConfigOptionString, between_objects_gcode))
|
||||||
|
((ConfigOptionBool, binary_gcode))
|
||||||
((ConfigOptionFloats, deretract_speed))
|
((ConfigOptionFloats, deretract_speed))
|
||||||
((ConfigOptionString, end_gcode))
|
((ConfigOptionString, end_gcode))
|
||||||
((ConfigOptionStrings, end_filament_gcode))
|
((ConfigOptionStrings, end_filament_gcode))
|
||||||
@ -739,7 +740,6 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||||||
// i - case insensitive
|
// i - case insensitive
|
||||||
// w - whole word
|
// w - whole word
|
||||||
((ConfigOptionStrings, gcode_substitutions))
|
((ConfigOptionStrings, gcode_substitutions))
|
||||||
((ConfigOptionBool, gcode_binary))
|
|
||||||
((ConfigOptionString, layer_gcode))
|
((ConfigOptionString, layer_gcode))
|
||||||
((ConfigOptionFloat, max_print_speed))
|
((ConfigOptionFloat, max_print_speed))
|
||||||
((ConfigOptionFloat, max_volumetric_speed))
|
((ConfigOptionFloat, max_volumetric_speed))
|
||||||
|
@ -205,9 +205,11 @@ wxString Field::get_tooltip_text(const wxString& default_string)
|
|||||||
opt_id += "]";
|
opt_id += "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool newline_after_name = boost::iends_with(opt_id, "_gcode") && opt_id != "binary_gcode";
|
||||||
|
|
||||||
return from_u8(m_opt.tooltip) + "\n" + _L("default value") + "\t: " +
|
return from_u8(m_opt.tooltip) + "\n" + _L("default value") + "\t: " +
|
||||||
(boost::iends_with(opt_id, "_gcode") ? "\n" : "") + default_string +
|
(newline_after_name ? "\n" : "") + default_string +
|
||||||
(boost::iends_with(opt_id, "_gcode") ? "" : "\n") +
|
(newline_after_name ? "" : "\n") +
|
||||||
_L("parameter name") + "\t: " + opt_id;
|
_L("parameter name") + "\t: " + opt_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2019,7 +2019,7 @@ void GLCanvas3D::render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_BINARIZED_GCODE_DEBUG_WINDOW
|
#if ENABLE_BINARIZED_GCODE_DEBUG_WINDOW
|
||||||
if (wxGetApp().plater()->is_view3D_shown() && current_printer_technology() != ptSLA && fff_print()->config().gcode_binary)
|
if (wxGetApp().plater()->is_view3D_shown() && current_printer_technology() != ptSLA && fff_print()->config().binary_gcode)
|
||||||
show_binary_gcode_debug_window();
|
show_binary_gcode_debug_window();
|
||||||
#endif // ENABLE_BINARIZED_GCODE_DEBUG_WINDOW
|
#endif // ENABLE_BINARIZED_GCODE_DEBUG_WINDOW
|
||||||
|
|
||||||
|
@ -6797,7 +6797,7 @@ void Plater::export_gcode(bool prefer_removable)
|
|||||||
_L("The following characters are not allowed by a FAT file system:") + " <>:/\\|?*\"";
|
_L("The following characters are not allowed by a FAT file system:") + " <>:/\\|?*\"";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
err_out = check_binary_vs_ascii_gcode_extension(printer_technology(), ext, wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary"));
|
err_out = check_binary_vs_ascii_gcode_extension(printer_technology(), ext, wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_bool("binary_gcode"));
|
||||||
return !err_out.IsEmpty();
|
return !err_out.IsEmpty();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -6806,7 +6806,7 @@ void Plater::export_gcode(bool prefer_removable)
|
|||||||
ErrorDialog(this, error_str, [this](const std::string& key) -> void { sidebar().jump_to_option(key); }).ShowModal();
|
ErrorDialog(this, error_str, [this](const std::string& key) -> void { sidebar().jump_to_option(key); }).ShowModal();
|
||||||
output_path.clear();
|
output_path.clear();
|
||||||
} else {
|
} else {
|
||||||
alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary"),
|
alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_bool("binary_gcode"),
|
||||||
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_notes"));
|
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_notes"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7358,7 +7358,7 @@ void Plater::send_gcode()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const std::string ext = boost::algorithm::to_lower_copy(dlg.filename().extension().string());
|
const std::string ext = boost::algorithm::to_lower_copy(dlg.filename().extension().string());
|
||||||
const bool binary_output = wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary");
|
const bool binary_output = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_bool("binary_gcode");
|
||||||
const wxString error_str = check_binary_vs_ascii_gcode_extension(printer_technology(), ext, binary_output);
|
const wxString error_str = check_binary_vs_ascii_gcode_extension(printer_technology(), ext, binary_output);
|
||||||
if (! error_str.IsEmpty()) {
|
if (! error_str.IsEmpty()) {
|
||||||
ErrorDialog(this, error_str, t_kill_focus([](const std::string& key) -> void { wxGetApp().sidebar().jump_to_option(key); })).ShowModal();
|
ErrorDialog(this, error_str, t_kill_focus([](const std::string& key) -> void { wxGetApp().sidebar().jump_to_option(key); })).ShowModal();
|
||||||
@ -7366,7 +7366,7 @@ void Plater::send_gcode()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary"),
|
alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_bool("binary_gcode"),
|
||||||
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_notes"));
|
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_notes"));
|
||||||
|
|
||||||
upload_job.upload_data.upload_path = dlg.filename();
|
upload_job.upload_data.upload_path = dlg.filename();
|
||||||
|
@ -1711,34 +1711,8 @@ void TabPrint::build()
|
|||||||
Option option = optgroup->get_option("output_filename_format");
|
Option option = optgroup->get_option("output_filename_format");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
optgroup->append_single_option_line(option);
|
optgroup->append_single_option_line(option);
|
||||||
optgroup->append_single_option_line("gcode_binary");
|
|
||||||
|
|
||||||
optgroup->m_on_change = [this](const t_config_option_key& opt_key, boost::any value)
|
|
||||||
{
|
|
||||||
if (opt_key == "gcode_binary") {
|
|
||||||
const bool is_binary = m_config->opt_bool("gcode_binary");
|
|
||||||
std::string output_filename_format = m_config->opt_string("output_filename_format");
|
|
||||||
bool modified = false;
|
|
||||||
if (is_binary && boost::iends_with(output_filename_format, ".gcode")) {
|
|
||||||
output_filename_format = output_filename_format.substr(0, output_filename_format.length() - 5) + "bgcode";
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
else if (!is_binary && boost::iends_with(output_filename_format, ".bgcode")) {
|
|
||||||
output_filename_format = output_filename_format.substr(0, output_filename_format.length() - 6) + "gcode";
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (modified) {
|
|
||||||
DynamicPrintConfig new_conf = *m_config;
|
|
||||||
auto off_option = static_cast<ConfigOptionString*>(m_config->option("output_filename_format")->clone());
|
|
||||||
off_option->value = output_filename_format;
|
|
||||||
new_conf.set_key_value("output_filename_format", off_option);
|
|
||||||
load_config(new_conf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update_dirty();
|
|
||||||
update();
|
|
||||||
};
|
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Other"));
|
optgroup = page->new_optgroup(L("Other"));
|
||||||
|
|
||||||
@ -2733,6 +2707,7 @@ void TabPrinter::build_fff()
|
|||||||
|
|
||||||
optgroup->append_single_option_line("silent_mode");
|
optgroup->append_single_option_line("silent_mode");
|
||||||
optgroup->append_single_option_line("remaining_times");
|
optgroup->append_single_option_line("remaining_times");
|
||||||
|
optgroup->append_single_option_line("binary_gcode");
|
||||||
|
|
||||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
||||||
wxTheApp->CallAfter([this, opt_key, value]() {
|
wxTheApp->CallAfter([this, opt_key, value]() {
|
||||||
|
@ -62,7 +62,7 @@ use Slic3r::Test qw(_eq);
|
|||||||
{
|
{
|
||||||
my $config = Slic3r::Config->new;
|
my $config = Slic3r::Config->new;
|
||||||
$config->set('fill_density', 0); # just for making the test faster
|
$config->set('fill_density', 0); # just for making the test faster
|
||||||
$config->set('gcode_binary', 0);
|
$config->set('binary_gcode', 0);
|
||||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $config, scale => 2);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config, scale => 2);
|
||||||
|
|
||||||
my @z = ();
|
my @z = ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user