mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 13:31:58 +08:00
Ported PrintObject::prepare_infill() to C++
This commit is contained in:
parent
aac9c2481c
commit
c0465d0434
@ -34,47 +34,6 @@ sub support_layers {
|
|||||||
return [ map $self->get_support_layer($_), 0..($self->support_layer_count - 1) ];
|
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 {
|
sub generate_support_material {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
@ -1054,9 +1054,6 @@ PrintObject::slice()
|
|||||||
void
|
void
|
||||||
PrintObject::make_perimeters()
|
PrintObject::make_perimeters()
|
||||||
{
|
{
|
||||||
// prerequisites
|
|
||||||
this->slice();
|
|
||||||
|
|
||||||
if (this->state.is_done(posPerimeters)) return;
|
if (this->state.is_done(posPerimeters)) return;
|
||||||
this->state.set_started(posPerimeters);
|
this->state.set_started(posPerimeters);
|
||||||
|
|
||||||
@ -1066,6 +1063,9 @@ PrintObject::make_perimeters()
|
|||||||
if (this->typed_slices)
|
if (this->typed_slices)
|
||||||
this->state.invalidate(posSlice);
|
this->state.invalidate(posSlice);
|
||||||
|
|
||||||
|
// prerequisites
|
||||||
|
this->slice();
|
||||||
|
|
||||||
// merge slices if they were split into types
|
// merge slices if they were split into types
|
||||||
// This is not currently taking place because since merge_slices + detect_surfaces_type
|
// 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
|
// are not truly idempotent we are invalidating posSlice here (see the Perl part of
|
||||||
@ -1209,7 +1209,8 @@ PrintObject::infill()
|
|||||||
void
|
void
|
||||||
PrintObject::prepare_infill()
|
PrintObject::prepare_infill()
|
||||||
{
|
{
|
||||||
if (this->state.is_done(posInfill)) return;
|
if (this->state.is_done(posPrepareInfill)) return;
|
||||||
|
|
||||||
// This prepare_infill() is not really idempotent.
|
// This prepare_infill() is not really idempotent.
|
||||||
// TODO: It should clear and regenerate fill_surfaces at every run
|
// TODO: It should clear and regenerate fill_surfaces at every run
|
||||||
// instead of modifying it in place.
|
// instead of modifying it in place.
|
||||||
@ -1222,16 +1223,13 @@ PrintObject::prepare_infill()
|
|||||||
// prerequisites
|
// prerequisites
|
||||||
this->detect_surfaces_type();
|
this->detect_surfaces_type();
|
||||||
|
|
||||||
if (this->print()->status_cb != nullptr)
|
if (this->_print->status_cb != nullptr)
|
||||||
this->print()->status_cb(30, "Preparing infill");
|
this->_print->status_cb(30, "Preparing infill");
|
||||||
|
|
||||||
|
|
||||||
// decide what surfaces are to be filled
|
// decide what surfaces are to be filled
|
||||||
for (auto& layer : this->layers) {
|
for (auto& layer : this->layers)
|
||||||
for (auto& region : layer->regions) {
|
for (auto& layerm : layer->regions)
|
||||||
region->prepare_fill_surfaces();
|
layerm->prepare_fill_surfaces();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this will detect bridges and reverse bridges
|
// this will detect bridges and reverse bridges
|
||||||
// and rearrange top/bottom/internal surfaces
|
// and rearrange top/bottom/internal surfaces
|
||||||
|
@ -154,6 +154,7 @@ _constant()
|
|||||||
RETVAL = (SV*)newRV_noinc((SV*)layers_av);
|
RETVAL = (SV*)newRV_noinc((SV*)layers_av);
|
||||||
%};
|
%};
|
||||||
void make_perimeters();
|
void make_perimeters();
|
||||||
|
void prepare_infill();
|
||||||
void infill();
|
void infill();
|
||||||
void _simplify_slices(double distance);
|
void _simplify_slices(double distance);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user