bugfix dense infill

This commit is contained in:
supermerill 2019-02-09 17:00:06 +01:00
parent aab7dd32f3
commit b489f86f95

View File

@ -709,15 +709,24 @@ ExPolygons fit_to_size(ExPolygon polygon_to_cover, ExPolygon polygon_to_check, c
return intersection_ex(polygon_reduced, growing_area);
}
//FIXME: cerify it works if the part is split in 2 in the Z axis
void PrintObject::count_distance_solid() {
//if dense area * COEFF_SPLIT > sparse area then fill all with dense
// sparse area = layer's fill area - solid area
const float COEFF_SPLIT = 2;
const int NB_DENSE_LAYERS = 1;
for (size_t idx_region = 0; idx_region < this->m_print->regions().size(); ++idx_region) {
for (const PrintRegion *region : this->m_print->regions()) {
//count how many surface there are on each one
LayerRegion *previousOne = NULL;
if (this->layers().size() > 1) previousOne = this->layers()[this->layers().size() - 1]->get_region(idx_region);
size_t top_z = this->layers().size() - 1;
for (; top_z < this->layers().size() && previousOne == NULL; --top_z){
for (LayerRegion * lregion : this->layers()[top_z]->regions()){
if (lregion->region() == region){
previousOne = lregion;
break;
}
}
}
if (previousOne != NULL && previousOne->region()->config().infill_dense.getBool() && previousOne->region()->config().fill_density<40) {
for (Surface &surf : previousOne->fill_surfaces.surfaces) {
if (surf.is_solid()) {
@ -725,7 +734,16 @@ void PrintObject::count_distance_solid() {
}
}
for (size_t idx_layer = this->layers().size() - 2; idx_layer < this->layers().size() - 1; --idx_layer) {
LayerRegion *layerm = this->layers()[idx_layer]->get_region(idx_region);
LayerRegion *layerm = NULL;
for (LayerRegion * lregion : this->layers()[top_z]->regions()){
if (lregion->region() == region){
layerm = lregion;
break;
}
}
if (layerm == NULL){
continue;
}
Surfaces surf_to_add;
for (Surface &surf : layerm->fill_surfaces.surfaces) {
if (!surf.is_solid()){