FIX: auto arranging short objects gives overlapping results
jira: STUDIO-5778 Change-Id: I6761875d653fbed1beadd6480d37b97f71dfdf24
This commit is contained in:
parent
472640c1f1
commit
3ef065a4ed
|
@ -89,10 +89,18 @@ void update_arrange_params(ArrangeParams& params, const DynamicPrintConfig* prin
|
|||
params.brim_skirt_distance = skirt_distance;
|
||||
params.bed_shrink_x += params.brim_skirt_distance;
|
||||
params.bed_shrink_y += params.brim_skirt_distance;
|
||||
// for sequential print, we need to inflate the bed because cleareance_radius is so large
|
||||
if (params.is_seq_print) {
|
||||
params.bed_shrink_x -= params.cleareance_radius / 2;
|
||||
params.bed_shrink_y -= params.cleareance_radius / 2;
|
||||
// set obj distance for auto seq_print
|
||||
bool all_objects_are_short = std::all_of(selected.begin(), selected.end(), [¶ms](auto& ap) { return ap.height < params.nozzle_height; });
|
||||
if (all_objects_are_short) {
|
||||
params.min_obj_distance = std::max(params.min_obj_distance, scaled(MAX_OUTER_NOZZLE_RADIUS + 0.001));
|
||||
}
|
||||
else
|
||||
params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error
|
||||
|
||||
// for sequential print, we need to inflate the bed because cleareance_radius is so large
|
||||
params.bed_shrink_x -= unscale_(params.min_obj_distance / 2);
|
||||
params.bed_shrink_y -= unscale_(params.min_obj_distance / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,15 +108,6 @@ void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPri
|
|||
// do not inflate brim_width. Objects are allowed to have overlapped brim.
|
||||
Points bedpts = get_shrink_bedpts(print_cfg, params);
|
||||
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) {
|
||||
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.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error
|
||||
}
|
||||
double brim_max = 0;
|
||||
bool plate_has_tree_support = false;
|
||||
std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) {
|
||||
|
@ -134,8 +133,8 @@ void update_unselected_items_inflation(ArrangePolygons& unselected, const Dynami
|
|||
{
|
||||
float exclusion_gap = 1.f;
|
||||
if (params.is_seq_print) {
|
||||
// bed_shrink_x is typically (-params.cleareance_radius / 2+5) for seq_print
|
||||
exclusion_gap = std::max(exclusion_gap, params.cleareance_radius / 2 + params.bed_shrink_x + 1.f); // +1mm gap so the exclusion region is not too close
|
||||
// bed_shrink_x is typically (-params.min_obj_distance / 2+5) for seq_print
|
||||
exclusion_gap = std::max(exclusion_gap, params.min_obj_distance / 2 + params.bed_shrink_x + 1.f); // +1mm gap so the exclusion region is not too close
|
||||
// dont forget to move the excluded region
|
||||
for (auto& region : unselected) {
|
||||
if (region.is_virt_object) region.poly.translate(scaled(params.bed_shrink_x), scaled(params.bed_shrink_y));
|
||||
|
|
|
@ -519,7 +519,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
|
|||
bool all_objects_are_short = std::all_of(print.objects().begin(), print.objects().end(), [&](PrintObject* obj) { return obj->height() < scale_(print.config().nozzle_height.value - MARGIN_HEIGHT); });
|
||||
// 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 = all_objects_are_short ? scale_(0.5*MAX_OUTER_NOZZLE_RADIUS-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());
|
||||
|
|
|
@ -36,7 +36,7 @@ class TreeSupportData;
|
|||
class TreeSupport;
|
||||
|
||||
#define MARGIN_HEIGHT 1.5
|
||||
#define MAX_OUTER_NOZZLE_DIAMETER 4
|
||||
#define MAX_OUTER_NOZZLE_RADIUS 4
|
||||
// BBS: move from PrintObjectSlice.cpp
|
||||
struct VolumeSlices
|
||||
{
|
||||
|
|
|
@ -5089,7 +5089,7 @@ void GLCanvas3D::update_sequential_clearance()
|
|||
[&](PrintObject* obj) { return obj->height() < scale_(fff_print()->config().nozzle_height.value - MARGIN_HEIGHT); });
|
||||
float shrink_factor;
|
||||
if (all_objects_are_short)
|
||||
shrink_factor = scale_(0.5 * MAX_OUTER_NOZZLE_DIAMETER - 0.1);
|
||||
shrink_factor = scale_(0.5 * MAX_OUTER_NOZZLE_RADIUS - 0.1);
|
||||
else
|
||||
shrink_factor = static_cast<float>(scale_(0.5 * fff_print()->config().extruder_clearance_max_radius.value - EPSILON));
|
||||
|
||||
|
|
Loading…
Reference in New Issue