Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Enable detection of collision with circular printbed in backend

This commit is contained in:
enricoturri1966 2021-09-30 14:51:09 +02:00
parent 430c7a69b3
commit 13ef817a99
6 changed files with 111 additions and 53 deletions

View file

@ -2946,12 +2946,19 @@ void Plater::priv::schedule_background_process()
void Plater::priv::update_print_volume_state()
{
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
const ConfigOptionPoints* opt = dynamic_cast<const ConfigOptionPoints*>(this->config->option("bed_shape"));
const Polygon bed_poly = offset(Polygon::new_scale(opt->values), static_cast<float>(scale_(BedEpsilon))).front();
const float bed_height = this->config->opt_float("max_print_height");
this->q->model().update_print_volume_state(bed_poly, bed_height);
#else
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(this->config->opt<ConfigOptionPoints>("bed_shape")->values));
BoundingBoxf3 print_volume(unscale(bed_box_2D.min(0), bed_box_2D.min(1), 0.0), unscale(bed_box_2D.max(0), bed_box_2D.max(1), scale_(this->config->opt_float("max_print_height"))));
// Allow the objects to protrude below the print bed, only the part of the object above the print bed will be sliced.
print_volume.offset(BedEpsilon);
print_volume.min(2) = -1e10;
this->q->model().update_print_volume_state(print_volume);
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
}