Ported PrintObject::prepare_infill() to C++

This commit is contained in:
Alessandro Ranellucci 2018-11-26 23:45:19 +01:00
parent aac9c2481c
commit c0465d0434
3 changed files with 11 additions and 53 deletions

View File

@ -34,47 +34,6 @@ sub support_layers {
return [ map $self->get_support_layer($_), 0..($self->support_layer_count - 1) ];
}
sub prepare_infill {
my ($self) = @_;
return if $self->step_done(STEP_PREPARE_INFILL);
# This prepare_infill() is not really idempotent.
# TODO: It should clear and regenerate fill_surfaces at every run
# instead of modifying it in place.
$self->invalidate_step(STEP_PERIMETERS);
$self->make_perimeters;
# Do this after invalidating STEP_PERIMETERS because that would re-invalidate STEP_PREPARE_INFILL
$self->set_step_started(STEP_PREPARE_INFILL);
# prerequisites
$self->detect_surfaces_type;
$self->print->status_cb->(30, "Preparing infill");
# decide what surfaces are to be filled
$_->prepare_fill_surfaces for map @{$_->regions}, @{$self->layers};
# this will detect bridges and reverse bridges
# and rearrange top/bottom/internal surfaces
$self->process_external_surfaces;
# detect which fill surfaces are near external layers
# they will be split in internal and internal-solid surfaces
$self->discover_horizontal_shells;
$self->clip_fill_surfaces;
# the following step needs to be done before combination because it may need
# to remove only half of the combined infill
$self->bridge_over_infill;
# combine fill surfaces to honor the "infill every N layers" option
$self->combine_infill;
$self->set_step_done(STEP_PREPARE_INFILL);
}
sub generate_support_material {
my $self = shift;

View File

@ -1054,9 +1054,6 @@ PrintObject::slice()
void
PrintObject::make_perimeters()
{
// prerequisites
this->slice();
if (this->state.is_done(posPerimeters)) return;
this->state.set_started(posPerimeters);
@ -1066,6 +1063,9 @@ PrintObject::make_perimeters()
if (this->typed_slices)
this->state.invalidate(posSlice);
// prerequisites
this->slice();
// merge slices if they were split into types
// This is not currently taking place because since merge_slices + detect_surfaces_type
// are not truly idempotent we are invalidating posSlice here (see the Perl part of
@ -1209,7 +1209,8 @@ PrintObject::infill()
void
PrintObject::prepare_infill()
{
if (this->state.is_done(posInfill)) return;
if (this->state.is_done(posPrepareInfill)) return;
// This prepare_infill() is not really idempotent.
// TODO: It should clear and regenerate fill_surfaces at every run
// instead of modifying it in place.
@ -1222,16 +1223,13 @@ PrintObject::prepare_infill()
// prerequisites
this->detect_surfaces_type();
if (this->print()->status_cb != nullptr)
this->print()->status_cb(30, "Preparing infill");
if (this->_print->status_cb != nullptr)
this->_print->status_cb(30, "Preparing infill");
// decide what surfaces are to be filled
for (auto& layer : this->layers) {
for (auto& region : layer->regions) {
region->prepare_fill_surfaces();
}
}
for (auto& layer : this->layers)
for (auto& layerm : layer->regions)
layerm->prepare_fill_surfaces();
// this will detect bridges and reverse bridges
// and rearrange top/bottom/internal surfaces

View File

@ -154,6 +154,7 @@ _constant()
RETVAL = (SV*)newRV_noinc((SV*)layers_av);
%};
void make_perimeters();
void prepare_infill();
void infill();
void _simplify_slices(double distance);