Refactor all_objects_are_short
This commit is contained in:
parent
83346aaffa
commit
0b6a1d3636
7 changed files with 9 additions and 12 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -5223,13 +5223,12 @@ void GLCanvas3D::update_sequential_clearance()
|
|||
// the results are then cached for following displacements
|
||||
if (m_sequential_print_clearance_first_displacement) {
|
||||
m_sequential_print_clearance.m_hull_2d_cache.clear();
|
||||
bool all_objects_are_short = std::all_of(fff_print()->objects().begin(), fff_print()->objects().end(), \
|
||||
[&](PrintObject* obj) { return obj->height() < scale_(fff_print()->config().nozzle_height.value - MARGIN_HEIGHT); });
|
||||
auto [object_skirt_offset, _] = fff_print()->object_skirt_offset();
|
||||
float shrink_factor;
|
||||
if (all_objects_are_short)
|
||||
shrink_factor = scale_(0.5 * MAX_OUTER_NOZZLE_DIAMETER - 0.1);
|
||||
if (fff_print()->is_all_objects_are_short())
|
||||
shrink_factor = scale_(std::max(0.5f * MAX_OUTER_NOZZLE_DIAMETER, object_skirt_offset) - 0.1);
|
||||
else
|
||||
shrink_factor = static_cast<float>(scale_(0.5 * fff_print()->config().extruder_clearance_radius.value - EPSILON));
|
||||
shrink_factor = static_cast<float>(scale_(0.5 * fff_print()->config().extruder_clearance_radius.value - 0.1));
|
||||
|
||||
double mitter_limit = scale_(0.1);
|
||||
m_sequential_print_clearance.m_hull_2d_cache.reserve(m_model->objects.size());
|
||||
|
|
|
@ -772,6 +772,7 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
|
|||
params.printable_height = print_config.printable_height.value;
|
||||
params.allow_rotations = settings.enable_rotation;
|
||||
params.nozzle_height = print.config().nozzle_height.value;
|
||||
params.all_objects_are_short = print.is_all_objects_are_short();
|
||||
params.align_center = print_config.best_object_pos.value;
|
||||
params.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate;
|
||||
params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
|
||||
|
|
Loading…
Reference in a new issue