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 64e28e26b..e7e5cc1ec 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 @@ -50,10 +50,8 @@ "179" ], "printer_structure": "i3", - "retract_lift_below": [ - "179" - ], "scan_first_layer": "0", + "best_object_pos":"0.85x0.5", "upward_compatible_machine": [ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1P 0.4 nozzle", diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json index 1f8e83f0d..247608475 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json @@ -31,7 +31,6 @@ "z_hop": [ "0.4" ], - "printer_structure": "corexy", "upward_compatible_machine": [ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json index 71da6c820..8fd2c82da 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json @@ -30,7 +30,6 @@ "z_hop": [ "0.4" ], - "printer_structure": "corexy", "upward_compatible_machine": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json index 233fb1650..69975f20e 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json @@ -31,7 +31,6 @@ "z_hop": [ "0.4" ], - "printer_structure": "corexy", "upward_compatible_machine": [ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1P 0.4 nozzle", diff --git a/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json b/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json index be8f3ef4e..4d61d88f8 100644 --- a/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json +++ b/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json @@ -107,6 +107,8 @@ "extruder_clearance_max_radius": "68", "extruder_clearance_height_to_lid": "90", "nozzle_volume": "107", + "printer_structure": "corexy", + "best_object_pos":"0.5x0.5", "retraction_minimum_travel": [ "1" ], diff --git a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index 1a6339477..f247cf715 100644 --- a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -37,8 +37,9 @@ struct NfpPConfig { BOTTOM_RIGHT, TOP_LEFT, TOP_RIGHT, - DONT_ALIGN //!> Warning: parts may end up outside the bin with the + DONT_ALIGN, //!> Warning: parts may end up outside the bin with the //! default object function. + USER_DEFINED }; /// Which angles to try out for better results. @@ -50,6 +51,8 @@ struct NfpPConfig { /// Where to start putting objects in the bin. Alignment starting_point; + TPoint best_object_pos; + /** * @brief A function object representing the fitting function in the * placement optimization process. (Optional) @@ -1100,6 +1103,11 @@ private: cb = bbin.maxCorner(); break; } + case Config::Alignment::USER_DEFINED: { + ci = bb.center(); + cb = config_.best_object_pos; + break; + } default: ; // DONT_ALIGN } diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 9ee55e591..a2f307a78 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -153,16 +153,16 @@ Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParam // Slic3r. template void fill_config(PConf& pcfg, const ArrangeParams ¶ms) { - - if (params.is_seq_print) { - // Start placing the items from the center of the print bed - pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT; - } - else { - // Start placing the items from the center of the print bed - pcfg.starting_point = PConf::Alignment::TOP_RIGHT; - } - + + if (params.is_seq_print) { + // Start placing the items from the center of the print bed + pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT; + } + else { + // Start placing the items from the center of the print bed + pcfg.starting_point = PConf::Alignment::TOP_RIGHT; + } + if (params.do_final_align) { // Align the arranged pile into the center of the bin pcfg.alignment = PConf::Alignment::CENTER; @@ -564,6 +564,14 @@ public: m_norm = std::sqrt(m_bin_area); fill_config(m_pconf, params); this->params = params; + + // if best object center is not bed center, specify starting point here + if (std::abs(this->params.align_center.x() - 0.5) > 0.001 || std::abs(this->params.align_center.y() - 0.5) > 0.001) { + auto binbb = sl::boundingBox(m_bin); + m_pconf.best_object_pos = binbb.minCorner() + Point{ binbb.width() * this->params.align_center.x(), binbb.height() * this->params.align_center.y() }; + m_pconf.alignment = PConfig::Alignment::USER_DEFINED; + } + for (auto& region : m_pconf.m_excluded_regions) { Box bb = region.boundingBox(); m_excluded_and_extruCali_regions.emplace_back(bb); diff --git a/src/libslic3r/Arrange.hpp b/src/libslic3r/Arrange.hpp index be3d67e97..8df6a0827 100644 --- a/src/libslic3r/Arrange.hpp +++ b/src/libslic3r/Arrange.hpp @@ -127,6 +127,7 @@ struct ArrangeParams { float clearance_height_to_lid = 0; float cleareance_radius = 0; float printable_height = 256.0; + Vec2d align_center{ 0.5,0.5 }; ArrangePolygons excluded_regions; // regions cant't be used ArrangePolygons nonprefered_regions; // regions can be used but not prefered diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c01232930..f9d4956f0 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -853,6 +853,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", //OrcaSlicer "host_type", "print_host", "printhost_apikey", "print_host_webui", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e2284f71c..0638018a8 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -502,7 +502,7 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->cli = ConfigOptionDef::nocli; def->set_default_value(new ConfigOptionEnum(atKeyPassword)); - + // temporary workaround for compatibility with older Slicer { def = this->add("preset_name", coString); @@ -1761,6 +1761,12 @@ void PrintConfigDef::init_fff_params() def->mode = comDevelop; def->set_default_value(new ConfigOptionEnum(psUndefine)); + def = this->add("best_object_pos", coPoint); + def->label = L("Best object position"); + def->tooltip = L("Best auto arranging position in range [0,1] w.r.t. bed shape."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionPoint(Vec2d(0.5, 0.5))); + def = this->add("auxiliary_fan", coBool); def->label = L("Auxiliary part cooling fan"); def->tooltip = L("Enable this option if machine has auxiliary part cooling fan"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index a012ad949..d66a17995 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -956,6 +956,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInts, fan_min_speed)) ((ConfigOptionFloats, min_layer_height)) ((ConfigOptionFloat, printable_height)) + ((ConfigOptionPoint, best_object_pos)) ((ConfigOptionFloats, slow_down_min_speed)) ((ConfigOptionFloats, nozzle_diameter)) ((ConfigOptionBool, reduce_infill_retraction)) diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.cpp b/src/slic3r/GUI/Jobs/ArrangeJob.cpp index 13c74c0bc..2c6681a47 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.cpp @@ -739,11 +739,13 @@ arrangement::ArrangeParams init_arrange_params(Plater *p) arrangement::ArrangeParams params; const GLCanvas3D::ArrangeSettings &settings = static_cast(p->canvas3D())->get_arrange_settings(); auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); + const PrintConfig& print_config = print.config(); - params.clearance_height_to_rod = print.config().extruder_clearance_height_to_rod.value; - params.clearance_height_to_lid = print.config().extruder_clearance_height_to_lid.value; - params.cleareance_radius = print.config().extruder_clearance_max_radius.value; - params.printable_height = print.config().printable_height.value; + params.clearance_height_to_rod = print_config.extruder_clearance_height_to_rod.value; + params.clearance_height_to_lid = print_config.extruder_clearance_height_to_lid.value; + params.cleareance_radius = print_config.extruder_clearance_max_radius.value; + params.printable_height = print_config.printable_height.value; + params.align_center = print_config.best_object_pos.value; params.allow_rotations = settings.enable_rotation; params.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate; params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ab94cee19..611df8497 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2331,7 +2331,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height", "brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers", "enable_support", "support_filament", "support_interface_filament", - "support_top_z_distance", "support_bottom_z_distance", "raft_layers" + "support_top_z_distance", "support_bottom_z_distance", "raft_layers", + "best_object_pos" })) , sidebar(new Sidebar(q)) , notification_manager(std::make_unique(q)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 1a3f9a9bf..193da1677 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2994,6 +2994,7 @@ void TabPrinter::build_fff() optgroup->append_single_option_line(option); optgroup->append_single_option_line("printable_height"); optgroup->append_single_option_line("nozzle_volume"); + optgroup->append_single_option_line("best_object_pos"); // BBS #if 0 //optgroup->append_single_option_line("z_offset");