Ported three PrintObject methods to XS
This commit is contained in:
parent
f8986d0ef5
commit
33fe53fd7c
@ -571,7 +571,7 @@ sub increase {
|
|||||||
scaling_factor => $last_instance->scaling_factor,
|
scaling_factor => $last_instance->scaling_factor,
|
||||||
rotation => $last_instance->rotation,
|
rotation => $last_instance->rotation,
|
||||||
);
|
);
|
||||||
$self->{print}->objects->[$obj_idx]->add_copy(@{$i->offset});
|
$self->{print}->objects->[$obj_idx]->add_copy($i->offset);
|
||||||
$self->{list}->SetItem($obj_idx, 1, $model_object->instances_count);
|
$self->{list}->SetItem($obj_idx, 1, $model_object->instances_count);
|
||||||
|
|
||||||
# only autoarrange if user has autocentering enabled
|
# only autoarrange if user has autocentering enabled
|
||||||
|
@ -32,26 +32,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) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
# in unscaled coordinates
|
|
||||||
sub add_copy {
|
|
||||||
my ($self, $x, $y) = @_;
|
|
||||||
my @copies = @{$self->copies};
|
|
||||||
push @copies, Slic3r::Point->new_scale($x, $y);
|
|
||||||
return $self->set_copies(\@copies);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub delete_last_copy {
|
|
||||||
my ($self) = @_;
|
|
||||||
my @copies = $self->copies;
|
|
||||||
pop @copies;
|
|
||||||
return $self->set_copies(\@copies);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub delete_all_copies {
|
|
||||||
my ($self) = @_;
|
|
||||||
return $self->set_copies([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
# this is the *total* layer count (including support layers)
|
# this is the *total* layer count (including support layers)
|
||||||
# this value is not supposed to be compared with $layer->id
|
# this value is not supposed to be compared with $layer->id
|
||||||
# since they have different semantics
|
# since they have different semantics
|
||||||
|
@ -103,6 +103,9 @@ class PrintObject
|
|||||||
ModelObject* model_object();
|
ModelObject* model_object();
|
||||||
|
|
||||||
Points copies() const;
|
Points copies() const;
|
||||||
|
bool add_copy(const Pointf &point);
|
||||||
|
bool delete_last_copy();
|
||||||
|
bool delete_all_copies();
|
||||||
bool set_copies(const Points &points);
|
bool set_copies(const Points &points);
|
||||||
bool reload_model_instances();
|
bool reload_model_instances();
|
||||||
|
|
||||||
|
@ -53,6 +53,29 @@ PrintObject::copies() const
|
|||||||
return this->_copies;
|
return this->_copies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PrintObject::add_copy(const Pointf &point)
|
||||||
|
{
|
||||||
|
Points points = this->_copies;
|
||||||
|
points.push_back(Point::new_scale(point.x, point.y));
|
||||||
|
return this->set_copies(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PrintObject::delete_last_copy()
|
||||||
|
{
|
||||||
|
Points points = this->_copies;
|
||||||
|
points.pop_back();
|
||||||
|
return this->set_copies(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PrintObject::delete_all_copies()
|
||||||
|
{
|
||||||
|
Points points;
|
||||||
|
return this->set_copies(points);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PrintObject::set_copies(const Points &points)
|
PrintObject::set_copies(const Points &points)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,10 @@ _constant()
|
|||||||
void set_shifted_copies(Points value)
|
void set_shifted_copies(Points value)
|
||||||
%code%{ THIS->_shifted_copies = value; %};
|
%code%{ THIS->_shifted_copies = value; %};
|
||||||
|
|
||||||
|
bool add_copy(Pointf* point)
|
||||||
|
%code%{ RETVAL = THIS->add_copy(*point); %};
|
||||||
|
bool delete_last_copy();
|
||||||
|
bool delete_all_copies();
|
||||||
bool set_copies(Points copies);
|
bool set_copies(Points copies);
|
||||||
bool reload_model_instances();
|
bool reload_model_instances();
|
||||||
void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges)
|
void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges)
|
||||||
|
Loading…
Reference in New Issue
Block a user