From 99bb1c213bb0a91bc45a64bb039cf18ff6ab2864 Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Mon, 13 Nov 2023 12:11:18 +0800 Subject: [PATCH] ENH: support for head wrap detect 1.Add "in_head_wrap_detect_zone".Detect if the model projection enters a specified area. jira:[NEW] Signed-off-by: xun.zhang Change-Id: I6aed5a782d2f33f023bdc19cf06dff0957828eeb --- .../BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json | 6 ++++++ src/libslic3r/GCode.cpp | 10 ++++++++-- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 9 +++++++++ src/libslic3r/PrintConfig.hpp | 1 + 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json index 3ebba9cc6..024d1d5c6 100644 --- a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json @@ -20,6 +20,12 @@ "extruder_clearance_height_to_rod": "25", "extruder_clearance_max_radius": "73", "extruder_clearance_radius": "73", + "head_wrap_detect_zone" : [ + "0x150", + "30x150", + "0x180", + "30x180" + ], "machine_load_filament_time": "28", "machine_max_acceleration_z": [ "1500", diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index b61ccb1dc..d24e52b41 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1929,11 +1929,17 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato pts->values.emplace_back(unscale(pt)); BoundingBoxf bbox = first_layer_projection(print); + BoundingBoxf bbox_without_plate_offset{ + {bbox.min.x() - plate_offset.x(),bbox.min.y() - plate_offset.y()}, + {bbox.max.x() - plate_offset.x(),bbox.max.y() - plate_offset.y()} + }; + BoundingBoxf bbox_head_wrap_zone (print.config().head_wrap_detect_zone.values); m_placeholder_parser.set("first_layer_print_convex_hull", pts.release()); - m_placeholder_parser.set("first_layer_print_min", new ConfigOptionFloats({bbox.min.x() - plate_offset.x(), bbox.min.y() - plate_offset.y()})); - m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({bbox.max.x() - plate_offset.x(), bbox.max.y() - plate_offset.y()})); + m_placeholder_parser.set("first_layer_print_min", new ConfigOptionFloats({ bbox_without_plate_offset.min.x(),bbox_without_plate_offset.min.y() })); + m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({ bbox_without_plate_offset.max.x(),bbox_without_plate_offset.max.y() })); m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() })); + m_placeholder_parser.set("in_head_wrap_detect_zone",bbox_head_wrap_zone.overlap(bbox_without_plate_offset)); // get center without wipe tower BoundingBoxf bbox_wo_wt;// bounding box without wipe tower for (auto& objPtr : print.objects()) { diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index f676e650e..ebb3a01ff 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -890,7 +890,7 @@ static std::vector s_Preset_printer_options { // 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","thumbnail_size", - "best_object_pos", + "best_object_pos","head_wrap_detect_zone", //OrcaSlicer "host_type", "print_host", "printhost_apikey", "print_host_webui", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a32f378bc..410df24f4 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3327,6 +3327,15 @@ void PrintConfigDef::init_fff_params() def->max = max_temp; def->set_default_value(new ConfigOptionInts { 240 }); + def = this->add("head_wrap_detect_zone", coPoints); + def->label ="Head wrap detect zone"; //do not need translation + def->mode = comDevelop; + def->set_default_value(new ConfigOptionPoints{ + Vec2d(0,150), + Vec2d(30,150), + Vec2d(0,180), + Vec2d(30,180) + }); def = this->add("detect_thin_wall", coBool); def->label = L("Detect thin wall"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 25ee0f2a9..c74f91b16 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -938,6 +938,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionPoints, printable_area)) //BBS: add bed_exclude_area ((ConfigOptionPoints, bed_exclude_area)) + ((ConfigOptionPoints, head_wrap_detect_zone)) // BBS ((ConfigOptionString, bed_custom_texture)) ((ConfigOptionString, bed_custom_model))