Introduce a ->count method for all collections to save time
This commit is contained in:
parent
d69c956e75
commit
e0da81e8bf
@ -191,7 +191,7 @@ sub make_fill {
|
||||
}
|
||||
|
||||
# add thin fill regions
|
||||
if (@{ $layerm->thin_fills }) {
|
||||
if ($layerm->thin_fills->count > 0) {
|
||||
push @fills, Slic3r::ExtrusionPath::Collection->new(@{$layerm->thin_fills});
|
||||
push @fills_ordering_points, $fills[-1]->first_point;
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ sub process_layer {
|
||||
# extrude support material before other things because it might use a lower Z
|
||||
# and also because we avoid travelling on other things when printing it
|
||||
if ($self->print->has_support_material && $layer->isa('Slic3r::Layer::Support')) {
|
||||
if ($layer->support_interface_fills) {
|
||||
if ($layer->support_interface_fills->count > 0) {
|
||||
$gcode .= $self->gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_interface_extruder-1]);
|
||||
$gcode .= $self->gcodegen->extrude_path($_, 'support material interface')
|
||||
for @{$layer->support_interface_fills->chained_path_from($self->gcodegen->last_pos, 0)};
|
||||
}
|
||||
if ($layer->support_fills) {
|
||||
if ($layer->support_fills->count > 0) {
|
||||
$gcode .= $self->gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_extruder-1]);
|
||||
$gcode .= $self->gcodegen->extrude_path($_, 'support material')
|
||||
for @{$layer->support_fills->chained_path_from($self->gcodegen->last_pos, 0)};
|
||||
|
@ -177,7 +177,7 @@ sub validate {
|
||||
for my $copy (@{$self->objects->[$obj_idx]->copies}) {
|
||||
my $copy_clearance = $clearance->clone;
|
||||
$copy_clearance->translate(@$copy);
|
||||
if (@{ intersection_ex(\@a, [$copy_clearance]) }) {
|
||||
if (@{ intersection(\@a, [$copy_clearance]) }) {
|
||||
die "Some objects are too close; your extruder will collide with them.\n";
|
||||
}
|
||||
@a = map @$_, @{union_ex([ @a, $copy_clearance ])};
|
||||
|
@ -14,6 +14,8 @@
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void rotate(double angle, Point* center);
|
||||
int count()
|
||||
%code{% RETVAL = THIS->expolygons.size(); %};
|
||||
%{
|
||||
|
||||
ExPolygonCollection*
|
||||
|
@ -18,6 +18,8 @@
|
||||
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->first_point(); %};
|
||||
Point* last_point()
|
||||
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->last_point(); %};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->entities.size(); %};
|
||||
%{
|
||||
|
||||
void
|
||||
|
@ -15,6 +15,8 @@
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = THIS->chained_path(no_reverse); %};
|
||||
PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = THIS->chained_path_from(start_near, no_reverse); %};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->polylines.size(); %};
|
||||
%{
|
||||
|
||||
PolylineCollection*
|
||||
|
@ -9,6 +9,8 @@
|
||||
~SurfaceCollection();
|
||||
void clear()
|
||||
%code{% THIS->surfaces.clear(); %};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->surfaces.size(); %};
|
||||
%{
|
||||
|
||||
SurfaceCollection*
|
||||
|
Loading…
Reference in New Issue
Block a user