NEW: add best_object_pos for auto-arranging
For i3 printers, best object position may not be the bed center, we need to align objects to the specified best_object_pos. Jira: STUDIO-4133 Change-Id: I06e31e597d2dd8288eb24a52d836cc8a134a4111
This commit is contained in:
parent
c2f8993828
commit
142499871e
|
@ -33,7 +33,6 @@
|
||||||
"z_hop": [
|
"z_hop": [
|
||||||
"0.2"
|
"0.2"
|
||||||
],
|
],
|
||||||
"printer_structure": "corexy",
|
|
||||||
"upward_compatible_machine": [
|
"upward_compatible_machine": [
|
||||||
"Bambu Lab P1S 0.4 nozzle",
|
"Bambu Lab P1S 0.4 nozzle",
|
||||||
"Bambu Lab X1 0.4 nozzle",
|
"Bambu Lab X1 0.4 nozzle",
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
"z_hop": [
|
"z_hop": [
|
||||||
"0.2"
|
"0.2"
|
||||||
],
|
],
|
||||||
"printer_structure": "corexy",
|
|
||||||
"upward_compatible_machine": [
|
"upward_compatible_machine": [
|
||||||
"Bambu Lab P1P 0.4 nozzle",
|
"Bambu Lab P1P 0.4 nozzle",
|
||||||
"Bambu Lab X1 0.4 nozzle",
|
"Bambu Lab X1 0.4 nozzle",
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
"z_hop": [
|
"z_hop": [
|
||||||
"0.2"
|
"0.2"
|
||||||
],
|
],
|
||||||
"printer_structure": "corexy",
|
|
||||||
"upward_compatible_machine": [
|
"upward_compatible_machine": [
|
||||||
"Bambu Lab P1P 0.4 nozzle",
|
"Bambu Lab P1P 0.4 nozzle",
|
||||||
"Bambu Lab P1S 0.4 nozzle",
|
"Bambu Lab P1S 0.4 nozzle",
|
||||||
|
|
|
@ -118,6 +118,8 @@
|
||||||
"printer_settings_id": "",
|
"printer_settings_id": "",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.4",
|
"printer_variant": "0.4",
|
||||||
|
"printer_structure": "corexy",
|
||||||
|
"best_object_pos":"0.5x0.5",
|
||||||
"retraction_minimum_travel": [
|
"retraction_minimum_travel": [
|
||||||
"1"
|
"1"
|
||||||
],
|
],
|
||||||
|
|
|
@ -37,8 +37,9 @@ struct NfpPConfig {
|
||||||
BOTTOM_RIGHT,
|
BOTTOM_RIGHT,
|
||||||
TOP_LEFT,
|
TOP_LEFT,
|
||||||
TOP_RIGHT,
|
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.
|
//! default object function.
|
||||||
|
USER_DEFINED
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Which angles to try out for better results.
|
/// Which angles to try out for better results.
|
||||||
|
@ -50,6 +51,8 @@ struct NfpPConfig {
|
||||||
/// Where to start putting objects in the bin.
|
/// Where to start putting objects in the bin.
|
||||||
Alignment starting_point;
|
Alignment starting_point;
|
||||||
|
|
||||||
|
TPoint<RawShape> best_object_pos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A function object representing the fitting function in the
|
* @brief A function object representing the fitting function in the
|
||||||
* placement optimization process. (Optional)
|
* placement optimization process. (Optional)
|
||||||
|
@ -1100,6 +1103,11 @@ private:
|
||||||
cb = bbin.maxCorner();
|
cb = bbin.maxCorner();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Config::Alignment::USER_DEFINED: {
|
||||||
|
ci = bb.center();
|
||||||
|
cb = config_.best_object_pos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: ; // DONT_ALIGN
|
default: ; // DONT_ALIGN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,14 +245,14 @@ Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParam
|
||||||
template<class PConf>
|
template<class PConf>
|
||||||
void fill_config(PConf& pcfg, const ArrangeParams ¶ms) {
|
void fill_config(PConf& pcfg, const ArrangeParams ¶ms) {
|
||||||
|
|
||||||
if (params.is_seq_print) {
|
if (params.is_seq_print) {
|
||||||
// Start placing the items from the center of the print bed
|
// Start placing the items from the center of the print bed
|
||||||
pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT;
|
pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Start placing the items from the center of the print bed
|
// Start placing the items from the center of the print bed
|
||||||
pcfg.starting_point = PConf::Alignment::TOP_RIGHT;
|
pcfg.starting_point = PConf::Alignment::TOP_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.do_final_align) {
|
if (params.do_final_align) {
|
||||||
// Align the arranged pile into the center of the bin
|
// Align the arranged pile into the center of the bin
|
||||||
|
@ -655,6 +655,14 @@ public:
|
||||||
m_norm = std::sqrt(m_bin_area);
|
m_norm = std::sqrt(m_bin_area);
|
||||||
fill_config(m_pconf, params);
|
fill_config(m_pconf, params);
|
||||||
this->params = 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) {
|
for (auto& region : m_pconf.m_excluded_regions) {
|
||||||
Box bb = region.boundingBox();
|
Box bb = region.boundingBox();
|
||||||
m_excluded_and_extruCali_regions.emplace_back(bb);
|
m_excluded_and_extruCali_regions.emplace_back(bb);
|
||||||
|
|
|
@ -128,6 +128,7 @@ struct ArrangeParams {
|
||||||
float clearance_height_to_lid = 0;
|
float clearance_height_to_lid = 0;
|
||||||
float cleareance_radius = 0;
|
float cleareance_radius = 0;
|
||||||
float printable_height = 256.0;
|
float printable_height = 256.0;
|
||||||
|
Vec2d align_center{ 0.5,0.5 };
|
||||||
|
|
||||||
ArrangePolygons excluded_regions; // regions cant't be used
|
ArrangePolygons excluded_regions; // regions cant't be used
|
||||||
ArrangePolygons nonprefered_regions; // regions can be used but not prefered
|
ArrangePolygons nonprefered_regions; // regions can be used but not prefered
|
||||||
|
|
|
@ -853,6 +853,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
||||||
// BBS
|
// BBS
|
||||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
|
"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",
|
||||||
|
"best_object_pos",
|
||||||
//OrcaSlicer
|
//OrcaSlicer
|
||||||
"host_type", "print_host", "printhost_apikey",
|
"host_type", "print_host", "printhost_apikey",
|
||||||
"print_host_webui",
|
"print_host_webui",
|
||||||
|
|
|
@ -1765,6 +1765,12 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comDevelop;
|
def->mode = comDevelop;
|
||||||
def->set_default_value(new ConfigOptionEnum<PrinterStructure>(psUndefine));
|
def->set_default_value(new ConfigOptionEnum<PrinterStructure>(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 = this->add("auxiliary_fan", coBool);
|
||||||
def->label = L("Auxiliary part cooling fan");
|
def->label = L("Auxiliary part cooling fan");
|
||||||
def->tooltip = L("Enable this option if machine has auxiliary part cooling fan");
|
def->tooltip = L("Enable this option if machine has auxiliary part cooling fan");
|
||||||
|
|
|
@ -957,6 +957,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||||
((ConfigOptionInts, fan_min_speed))
|
((ConfigOptionInts, fan_min_speed))
|
||||||
((ConfigOptionFloats, min_layer_height))
|
((ConfigOptionFloats, min_layer_height))
|
||||||
((ConfigOptionFloat, printable_height))
|
((ConfigOptionFloat, printable_height))
|
||||||
|
((ConfigOptionPoint, best_object_pos))
|
||||||
((ConfigOptionFloats, slow_down_min_speed))
|
((ConfigOptionFloats, slow_down_min_speed))
|
||||||
((ConfigOptionFloats, nozzle_diameter))
|
((ConfigOptionFloats, nozzle_diameter))
|
||||||
((ConfigOptionBool, reduce_infill_retraction))
|
((ConfigOptionBool, reduce_infill_retraction))
|
||||||
|
|
|
@ -745,11 +745,13 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
|
||||||
arrangement::ArrangeParams params;
|
arrangement::ArrangeParams params;
|
||||||
const GLCanvas3D::ArrangeSettings &settings = static_cast<const GLCanvas3D *>(p->canvas3D())->get_arrange_settings();
|
const GLCanvas3D::ArrangeSettings &settings = static_cast<const GLCanvas3D *>(p->canvas3D())->get_arrange_settings();
|
||||||
auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
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_rod = print_config.extruder_clearance_height_to_rod.value;
|
||||||
params.clearance_height_to_lid = print.config().extruder_clearance_height_to_lid.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.cleareance_radius = print_config.extruder_clearance_max_radius.value;
|
||||||
params.printable_height = print.config().printable_height.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_rotations = settings.enable_rotation;
|
||||||
params.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate;
|
params.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate;
|
||||||
params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
|
params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
|
||||||
|
|
|
@ -2452,7 +2452,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
"layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height",
|
"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",
|
"brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers",
|
||||||
"enable_support", "support_filament", "support_interface_filament",
|
"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))
|
, sidebar(new Sidebar(q))
|
||||||
, notification_manager(std::make_unique<NotificationManager>(q))
|
, notification_manager(std::make_unique<NotificationManager>(q))
|
||||||
|
|
|
@ -2997,6 +2997,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->append_single_option_line(option);
|
optgroup->append_single_option_line(option);
|
||||||
optgroup->append_single_option_line("printable_height");
|
optgroup->append_single_option_line("printable_height");
|
||||||
optgroup->append_single_option_line("nozzle_volume");
|
optgroup->append_single_option_line("nozzle_volume");
|
||||||
|
optgroup->append_single_option_line("best_object_pos");
|
||||||
// BBS
|
// BBS
|
||||||
#if 0
|
#if 0
|
||||||
//optgroup->append_single_option_line("z_offset");
|
//optgroup->append_single_option_line("z_offset");
|
||||||
|
|
Loading…
Reference in New Issue