ENH: improve auto-arrange compactness around wipe tower

1. improve auto-arrange compactness around wipe tower
2. do not show "Avoid extrusion calibration region" for P1P
3. encourage objects with similar height to be arranged together

Jira: STUDIO-1364

Change-Id: I5efa61a676c453618cdb3915fb98928d07138deb
(cherry picked from commit 571ee0c6d91d8a5f6a60838052f09d49d85f12ed)
This commit is contained in:
Arthur 2022-11-21 15:00:01 +08:00 committed by Lane.Wei
parent a06de19577
commit 869b93e270
4 changed files with 24 additions and 14 deletions

View File

@ -425,12 +425,20 @@ protected:
Item& p = m_items[i];
if (p.is_virt_object) {
// Better not put items above wipe tower
if (p.is_wipe_tower)
score += ibb.maxCorner().y() > p.boundingBox().maxCorner().y();
if (p.is_wipe_tower) {
if (ibb.maxCorner().y() > p.boundingBox().maxCorner().y())
score += 1;
else if(m_pilebb.defined)
score += norm(pl::distance(ibb.center(), m_pilebb.center()));
}
else
continue;
} else
} else {
// 高度接近的件尽量摆到一起
score += (1- std::abs(item.height - p.height) / params.printable_height)
* norm(pl::distance(ibb.center(), p.boundingBox().center()));
score += LARGE_COST_TO_REJECT * (item.bed_temp - p.bed_temp != 0);
}
}
}

View File

@ -124,6 +124,7 @@ struct ArrangeParams {
float clearance_height_to_rod = 0;
float clearance_height_to_lid = 0;
float cleareance_radius = 0;
float printable_height = 256.0;
ArrangePolygons excluded_regions; // regions cant't be used
ArrangePolygons nonprefered_regions; // regions can be used but not prefered

View File

@ -5195,10 +5195,17 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
settings_changed = true;
}
if (imgui->bbl_checkbox(_L("Avoid extrusion calibration region"), settings.avoid_extrusion_cali_region)) {
settings_out.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
appcfg->set("arrange", avoid_extrusion_key.c_str(), settings_out.avoid_extrusion_cali_region ? "1" : "0");
settings_changed = true;
// only show this option if the printer has micro Lidar and can do first layer scan
DynamicPrintConfig &current_config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto op = current_config.option("scan_first_layer");
if (op && op->getBool()) {
if (imgui->bbl_checkbox(_L("Avoid extrusion calibration region"), settings.avoid_extrusion_cali_region)) {
settings_out.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
appcfg->set("arrange", avoid_extrusion_key.c_str(), settings_out.avoid_extrusion_cali_region ? "1" : "0");
settings_changed = true;
}
} else {
settings_out.avoid_extrusion_cali_region = false;
}
ImGui::Separator();

View File

@ -388,6 +388,7 @@ void ArrangeJob::prepare()
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_radius.value;
params.printable_height = print.config().printable_height.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;
@ -563,13 +564,6 @@ void ArrangeJob::process()
update_status(num_finished, _L("Arranging") + " " + str);
};
if(!params.is_seq_print)
{
// force all heights be the same, so items are sorted by area
for (auto& ap : m_selected) ap.height = 1;
for (auto& ap : m_unselected) ap.height = 1;
}
{
BOOST_LOG_TRIVIAL(debug) << "items selected before arrange: ";
for (auto selected : m_selected)