Skip to content

Commit

Permalink
Allow end user to disable automatic insertion of the first layer scan
Browse files Browse the repository at this point in the history
  • Loading branch information
sschwetz committed Mar 1, 2025
1 parent 602b512 commit 9e26a39
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2363,6 +2363,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato

if (print.calib_params().mode == CalibMode::Calib_PA_Line) {
this->placeholder_parser().set("scan_first_layer", new ConfigOptionBool(false));
this->placeholder_parser().set("run_first_layer_scan_from_gcode", new ConfigOptionBool(false));
}
}
std::string machine_start_gcode = this->placeholder_parser_process("machine_start_gcode", print.config().machine_start_gcode.value, initial_extruder_id);
Expand Down Expand Up @@ -3776,8 +3777,8 @@ LayerResult GCode::process_layer(
gcode += "; open powerlost recovery\n";
gcode += "M1003 S1\n";
}
// BBS: open first layer inspection at second layer
if (print.config().scan_first_layer.value) {
// BBS: open first layer inspection at second layer unless the user has specified that they will run it from their gcode
if (print.config().scan_first_layer.value && ! print.config().run_first_layer_scan_from_gcode) {
// BBS: retract first to avoid droping when scan model
gcode += this->retract();
gcode += "M976 S1 P1 ; scan model before printing 2nd layer\n";
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ static std::vector<std::string> s_Preset_printer_options {
"nozzle_height",
"default_print_profile", "inherits",
"silent_mode",
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_tool_change_time", "time_cost", "machine_pause_gcode", "template_custom_gcode",
"scan_first_layer", "run_first_layer_scan_from_gcode", "machine_load_filament_time", "machine_unload_filament_time", "machine_tool_change_time", "time_cost", "machine_pause_gcode", "template_custom_gcode",
"nozzle_type", "nozzle_hrc","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types", "travel_slope", "retract_lift_enforce","support_chamber_temp_control","support_air_filtration","printer_structure",
"best_object_pos","head_wrap_detect_zone",
"host_type", "print_host", "printhost_apikey", "bbl_use_printhost",
Expand Down
9 changes: 9 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2853,6 +2853,15 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("run_first_layer_scan_from_gcode", coBool);
def->label = L("First level scan from gcode");
def->mode = comAdvanced;
def->tooltip = L("In it's default state to maintain backwards compatibility, will automatically run the first level scan. "
"lHowever, this means that if you are unable to place the gcode for the 1st level scan in the layer change gcode.\n\n"
"Enabling this will stop the slicer from adding M976 S1 P1 to perform the first layer scan. "
"To perform the first layer scan, you will need to call M976 S1 P1 from your customised layer change gcode" );
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(0));

//BBS
// def = this->add("spaghetti_detector", coBool);
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloats, filament_max_volumetric_speed))
((ConfigOptionInts, required_nozzle_HRC))
// BBS
((ConfigOptionBool, run_first_layer_scan_from_gcode))
((ConfigOptionBool, scan_first_layer))
((ConfigOptionPoints, thumbnail_size))
// ((ConfigOptionBool, spaghetti_detector))
Expand Down
3 changes: 2 additions & 1 deletion src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3761,6 +3761,7 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line("pellet_modded_printer", "pellet-flow-coefficient");
optgroup->append_single_option_line("bbl_use_printhost");
optgroup->append_single_option_line("scan_first_layer");
optgroup->append_single_option_line("run_first_layer_scan_from_gcode");
optgroup->append_single_option_line("disable_m73");
option = optgroup->get_option("thumbnails");
option.opt.full_width = true;
Expand Down Expand Up @@ -4511,7 +4512,7 @@ void TabPrinter::toggle_options()
if (m_active_page->title() == L("Basic information")) {

// SoftFever: hide BBL specific settings
for (auto el : {"scan_first_layer", "bbl_calib_mark_logo", "bbl_use_printhost"})
for (auto el : {"scan_first_layer", "bbl_calib_mark_logo", "bbl_use_printhost", "run_first_layer_scan_from_gcode"})
toggle_line(el, is_BBL_printer);

// SoftFever: hide non-BBL settings
Expand Down

0 comments on commit 9e26a39

Please sign in to comment.