Consider extrusion width in Print::total_bounding_box()

This commit is contained in:
Alessandro Ranellucci 2014-12-12 19:25:50 +01:00
parent e8ab9ac13a
commit 93d9ee9205

View File

@ -670,17 +670,27 @@ Print::total_bounding_box() const
// get objects bounding box // get objects bounding box
BoundingBox bb = this->bounding_box(); BoundingBox bb = this->bounding_box();
// check how much we need to increase it // we need to offset the objects bounding box by at least half the perimeters extrusion width
double extra = 0; // unscaled Flow perimeter_flow = this->objects.front()->get_layer(0)->get_region(0)->flow(frPerimeter);
if (this->has_support_material()) double extra = perimeter_flow.width/2;
extra = SUPPORT_MATERIAL_MARGIN;
extra = std::max(extra, this->config.brim_width.value); // consider support material
if (this->config.skirts > 0) { if (this->has_support_material()) {
Flow skirt_flow = this->skirt_flow(); extra = std::max(extra, SUPPORT_MATERIAL_MARGIN);
}
// consider brim and skirt
Flow skirt_flow = this->skirt_flow();
if (this->config.brim_width.value > 0) {
extra = std::max(extra, this->config.brim_width.value + skirt_flow.width/2);
}
if (this->config.skirts.value > 0) {
extra = std::max( extra = std::max(
extra, extra,
this->config.brim_width.value + this->config.skirt_distance.value + (this->config.skirts.value * skirt_flow.spacing()) this->config.brim_width.value
+ this->config.skirt_distance.value
+ this->config.skirts.value * skirt_flow.spacing()
+ skirt_flow.width/2
); );
} }