ENH: auto adapt distance in arrangement
JIRA: STUDIO-4408 1. if min_obj_distance is 0, use auto mode 2. normal support, 5mm gap, tree support, 22mm gap, no support, 0.1mm gap Change-Id: I906ccf267bef1f33a946572614d658fd50cfcda3 (cherry picked from commit 771efc935da625d8faa4cc5b77fedc5055f93c6c)
This commit is contained in:
parent
5e912dc541
commit
a939c6e434
|
@ -2614,10 +2614,7 @@ int CLI::run(int argc, char **argv)
|
||||||
arrange_cfg.clearance_height_to_lid = height_to_lid;
|
arrange_cfg.clearance_height_to_lid = height_to_lid;
|
||||||
arrange_cfg.cleareance_radius = cleareance_radius;
|
arrange_cfg.cleareance_radius = cleareance_radius;
|
||||||
arrange_cfg.printable_height = print_height;
|
arrange_cfg.printable_height = print_height;
|
||||||
if (arrange_cfg.is_seq_print)
|
arrange_cfg.min_obj_distance = 0;
|
||||||
arrange_cfg.min_obj_distance = std::max(arrange_cfg.min_obj_distance, scaled(arrange_cfg.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error
|
|
||||||
else
|
|
||||||
arrange_cfg.min_obj_distance = scaled(22.0);
|
|
||||||
|
|
||||||
if (auto printer_structure_opt = m_print_config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure")) {
|
if (auto printer_structure_opt = m_print_config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure")) {
|
||||||
arrange_cfg.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
arrange_cfg.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||||
|
|
|
@ -103,7 +103,7 @@ void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPri
|
||||||
Points bedpts = get_shrink_bedpts(print_cfg, params);
|
Points bedpts = get_shrink_bedpts(print_cfg, params);
|
||||||
BoundingBox bedbb = Polygon(bedpts).bounding_box();
|
BoundingBox bedbb = Polygon(bedpts).bounding_box();
|
||||||
std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) {
|
std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) {
|
||||||
ap.inflation = std::max(scaled(ap.brim_width), params.min_obj_distance / 2);
|
ap.inflation = params.min_obj_distance == 0 ? scaled(ap.brim_width) : params.min_obj_distance / 2;
|
||||||
BoundingBox apbb = ap.poly.contour.bounding_box();
|
BoundingBox apbb = ap.poly.contour.bounding_box();
|
||||||
auto diffx = bedbb.size().x() - apbb.size().x() - 5;
|
auto diffx = bedbb.size().x() - apbb.size().x() - 5;
|
||||||
auto diffy = bedbb.size().y() - apbb.size().y() - 5;
|
auto diffy = bedbb.size().y() - apbb.size().y() - 5;
|
||||||
|
@ -130,7 +130,7 @@ void update_unselected_items_inflation(ArrangePolygons& unselected, const Dynami
|
||||||
// 其他物体的膨胀轮廓是可以跟它们重叠的。
|
// 其他物体的膨胀轮廓是可以跟它们重叠的。
|
||||||
double scaled_exclusion_gap = scale_(1);
|
double scaled_exclusion_gap = scale_(1);
|
||||||
std::for_each(unselected.begin(), unselected.end(),
|
std::for_each(unselected.begin(), unselected.end(),
|
||||||
[&](auto& ap) { ap.inflation = !ap.is_virt_object ? std::max(scaled(ap.brim_width), params.min_obj_distance / 2)
|
[&](auto& ap) { ap.inflation = !ap.is_virt_object ? (params.min_obj_distance == 0 ? scaled(ap.brim_width) : params.min_obj_distance / 2)
|
||||||
: (ap.is_extrusion_cali_object ? 0 : scaled_exclusion_gap); });
|
: (ap.is_extrusion_cali_object ? 0 : scaled_exclusion_gap); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,12 +156,19 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
|
||||||
ap.brim_width = 0;
|
ap.brim_width = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ap.brim_width = 0;
|
ap.brim_width = 1.0;
|
||||||
// For by-layer printing, need to shrink bed a little, so the support won't go outside bed.
|
// For by-layer printing, need to shrink bed a little, so the support won't go outside bed.
|
||||||
// We set it to 5mm because that's how much a normal support will grow by default.
|
// We set it to 5mm because that's how much a normal support will grow by default.
|
||||||
|
// normal support 5mm, other support 22mm, no support 0mm
|
||||||
auto supp_type_ptr = obj->get_config_value<ConfigOptionBool>(config, "enable_support");
|
auto supp_type_ptr = obj->get_config_value<ConfigOptionBool>(config, "enable_support");
|
||||||
if (supp_type_ptr && supp_type_ptr->getBool())
|
auto support_type_ptr = obj->get_config_value<ConfigOptionEnum<SupportType>>(config, "support_type");
|
||||||
|
auto support_type = support_type_ptr->value;
|
||||||
|
auto enable_support = supp_type_ptr->getBool();
|
||||||
|
int support_int = support_type_ptr->getInt();
|
||||||
|
|
||||||
|
if (enable_support && (support_type == stNormalAuto || support_type == stNormal))
|
||||||
ap.brim_width = 5.0;
|
ap.brim_width = 5.0;
|
||||||
|
else if(enable_support) ap.brim_width = 22.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ap.height = obj->bounding_box().size().z();
|
ap.height = obj->bounding_box().size().z();
|
||||||
|
|
|
@ -5406,7 +5406,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
|
||||||
//BBS:
|
//BBS:
|
||||||
seq_print = true;
|
seq_print = true;
|
||||||
} else {
|
} else {
|
||||||
dist_min = 0.1f;
|
dist_min = 0.0f;
|
||||||
postfix = "_fff";
|
postfix = "_fff";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -473,7 +473,7 @@ public:
|
||||||
|
|
||||||
struct ArrangeSettings
|
struct ArrangeSettings
|
||||||
{
|
{
|
||||||
float distance = 5.;
|
float distance = 0.f;
|
||||||
// float distance_sla = 6.;
|
// float distance_sla = 6.;
|
||||||
float accuracy = 0.65f; // Unused currently
|
float accuracy = 0.65f; // Unused currently
|
||||||
bool enable_rotation = false;
|
bool enable_rotation = false;
|
||||||
|
|
Loading…
Reference in New Issue