mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-18 22:31:13 -06:00
ENH: support thumbnail in gcode for 3rd printers
Thanks @slynn1324 1. Add thumbnail size in printer params page 2. Optimize writing thumbnail data in gcode jira:STUDIO-3942 Github: #2166 Github pull request: #2333 Change-Id: I6897cfddfa6a1b0c95decf67329a486d40ec0cc2
This commit is contained in:
parent
d01a94c9f7
commit
105eda5238
11 changed files with 41 additions and 20 deletions
|
@ -1293,16 +1293,13 @@ namespace DoExport {
|
|||
output((boost::format("; thumbnail begin %dx%d %d\n") % data.width % data.height % encoded.size()).str().c_str());
|
||||
|
||||
unsigned int row_count = 0;
|
||||
while (encoded.size() > max_row_length)
|
||||
{
|
||||
output((boost::format("; %s\n") % encoded.substr(0, max_row_length)).str().c_str());
|
||||
encoded = encoded.substr(max_row_length);
|
||||
//BBS: optimize performance ,reduce too much memeory operation
|
||||
size_t current_index = 0;
|
||||
while(current_index<encoded.size()){
|
||||
output((boost::format("; %s\n") % encoded.substr(current_index, max_row_length)).str().c_str());
|
||||
current_index+=std::min(max_row_length,encoded.size()-current_index);
|
||||
++row_count;
|
||||
}
|
||||
|
||||
if (encoded.size() > 0)
|
||||
output((boost::format("; %s\n") % encoded).str().c_str());
|
||||
|
||||
output("; thumbnail end\n");
|
||||
output("; THUMBNAIL_BLOCK_END\n\n");
|
||||
|
||||
|
@ -1563,10 +1560,11 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
}
|
||||
|
||||
//BBS: add plate id into thumbnail render logic
|
||||
//DoExport::export_thumbnails_to_file(thumbnail_cb, print.get_plate_index(), THUMBNAIL_SIZE,
|
||||
// [&file](const char* sz) { file.write(sz); },
|
||||
// [&print]() { print.throw_if_canceled(); });
|
||||
|
||||
if(!print.is_BBL_Printer()){
|
||||
DoExport::export_thumbnails_to_file(thumbnail_cb, print.get_plate_index(), print.full_print_config().option<ConfigOptionPoints>("thumbnail_size")->values,
|
||||
[&file](const char* sz) { file.write(sz); },
|
||||
[&print]() { print.throw_if_canceled(); });
|
||||
}
|
||||
|
||||
// Write some terse information on the slicing parameters.
|
||||
const PrintObject *first_object = print.objects().front();
|
||||
|
|
|
@ -852,7 +852,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
|||
"silent_mode",
|
||||
// BBS
|
||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
|
||||
"nozzle_type","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types","support_chamber_temp_control","support_air_filtration","printer_structure",
|
||||
"nozzle_type","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types","support_chamber_temp_control","support_air_filtration","printer_structure","thumbnail_size",
|
||||
//OrcaSlicer
|
||||
"host_type", "print_host", "printhost_apikey",
|
||||
"print_host_webui",
|
||||
|
@ -2365,7 +2365,7 @@ inline t_config_option_keys deep_diff(const ConfigBase &config_this, const Confi
|
|||
if (this_opt != nullptr && other_opt != nullptr && *this_opt != *other_opt)
|
||||
{
|
||||
//BBS: add bed_exclude_area
|
||||
if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "compatible_prints" || opt_key == "compatible_printers") {
|
||||
if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "compatible_prints" || opt_key == "compatible_printers"|| opt_key == "thumbnail_size") {
|
||||
// Scalar variable, or a vector variable, which is independent from number of extruders,
|
||||
// thus the vector is presented to the user as a single input.
|
||||
diff.emplace_back(opt_key);
|
||||
|
|
|
@ -88,7 +88,7 @@ PresetBundle::PresetBundle()
|
|||
for (size_t i = 0; i < 1; ++i) {
|
||||
// The following ugly switch is to avoid printers.preset(0) to return the edited instance, as the 0th default is the current one.
|
||||
Preset &preset = this->printers.default_preset(i);
|
||||
for (const char *key : {"printer_settings_id", "printer_model", "printer_variant"}) preset.config.optptr(key, true);
|
||||
for (const char *key : {"printer_settings_id", "printer_model", "printer_variant","thumbnail_size"}) preset.config.optptr(key, true);
|
||||
//if (i == 0) {
|
||||
preset.config.optptr("default_print_profile", true);
|
||||
preset.config.option<ConfigOptionStrings>("default_filament_profile", true);
|
||||
|
|
|
@ -76,6 +76,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
"printable_area",
|
||||
//BBS: add bed_exclude_area
|
||||
"bed_exclude_area",
|
||||
"thumbnail_size",
|
||||
"before_layer_change_gcode",
|
||||
"enable_pressure_advance",
|
||||
"pressure_advance",
|
||||
|
|
|
@ -1708,6 +1708,15 @@ void PrintConfigDef::init_fff_params()
|
|||
def->tooltip = L("Enable this to enable the camera on printer to check the quality of first layer");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
// BBS
|
||||
def = this->add("thumbnail_size", coPoints);
|
||||
def->label = L("Thumbnail size");
|
||||
def->tooltip = L("Decides the size of thumbnail stored in gcode files");
|
||||
def->mode = comDevelop;
|
||||
def->gui_type = ConfigOptionDef::GUIType::one_string;
|
||||
def->set_default_value(new ConfigOptionPoints{ Vec2d(50,50) });
|
||||
|
||||
//BBS
|
||||
// def = this->add("spaghetti_detector", coBool);
|
||||
// def->label = L("Enable spaghetti detector");
|
||||
|
|
|
@ -851,6 +851,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionFloats, filament_minimal_purge_on_wipe_tower))
|
||||
// BBS
|
||||
((ConfigOptionBool, scan_first_layer))
|
||||
((ConfigOptionPoints, thumbnail_size))
|
||||
// ((ConfigOptionBool, spaghetti_detector))
|
||||
((ConfigOptionBool, gcode_add_line_number))
|
||||
((ConfigOptionBool, bbl_bed_temperature_gcode))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue