Refactor all_objects_are_short

This commit is contained in:
vovodroid
2024-08-22 09:59:39 +03:00
parent 83346aaffa
commit 0b6a1d3636
7 changed files with 9 additions and 12 deletions

View File

@@ -103,10 +103,8 @@ void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPri
BoundingBox bedbb = Polygon(bedpts).bounding_box();
// set obj distance for auto seq_print
if (params.is_seq_print) {
bool all_objects_are_short = std::all_of(selected.begin(), selected.end(), [&](ArrangePolygon& ap) { return ap.height < params.nozzle_height; });
if (all_objects_are_short) {
if (params.all_objects_are_short)
params.min_obj_distance = std::max(params.min_obj_distance, scaled(double(MAX_OUTER_NOZZLE_DIAMETER)/2+0.001));
}
else
params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.clearance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error
}

View File

@@ -133,6 +133,7 @@ struct ArrangeParams {
float clearance_height_to_lid = 0;
float clearance_radius = 0;
float nozzle_height = 0;
bool all_objects_are_short = false;
float printable_height = 256.0;
Vec2d align_center{ 0.5,0.5 };

View File

@@ -578,10 +578,9 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
polygons->clear();
std::vector<size_t> intersecting_idxs;
bool all_objects_are_short = print.is_all_objects_are_short();
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
float obj_distance = all_objects_are_short ? scale_(0.5*MAX_OUTER_NOZZLE_DIAMETER-0.1) : scale_(0.5*print.config().extruder_clearance_radius.value-0.1);
float obj_distance = print.is_all_objects_are_short() ? scale_(0.5*MAX_OUTER_NOZZLE_DIAMETER-0.1) : scale_(0.5*print.config().extruder_clearance_radius.value-0.1);
for (const PrintObject *print_object : print.objects()) {
assert(! print_object->model_object()->instances.empty());

View File

@@ -38,7 +38,6 @@ class SupportLayer;
class TreeSupportData;
class TreeSupport;
#define MARGIN_HEIGHT 1.5
#define MAX_OUTER_NOZZLE_DIAMETER 4
// BBS: move from PrintObjectSlice.cpp
struct VolumeSlices

View File

@@ -1613,7 +1613,7 @@ void PrintConfigDef::init_fff_params()
def->sidetext = L("mm");
def->min = 0;
def->mode = comDevelop;
def->set_default_value(new ConfigOptionFloat(4));
def->set_default_value(new ConfigOptionFloat(2.5));
def = this->add("bed_mesh_min", coPoint);
def->label = L("Bed mesh min");