Ported Slic3r::GCode::OozePrevention storage to XS

This commit is contained in:
Alessandro Ranellucci 2015-07-01 21:01:42 +02:00
parent b43dd92766
commit 280f3f38d7
8 changed files with 42 additions and 6 deletions

View File

@ -195,6 +195,7 @@ sub thread_cleanup {
*Slic3r::ExtrusionPath::Collection::DESTROY = sub {};
*Slic3r::Flow::DESTROY = sub {};
*Slic3r::GCode::AvoidCrossingPerimeters::DESTROY = sub {};
*Slic3r::GCode::OozePrevention::DESTROY = sub {};
*Slic3r::GCode::PlaceholderParser::DESTROY = sub {};
*Slic3r::GCode::Wipe::DESTROY = sub {};
*Slic3r::GCode::Writer::DESTROY = sub {};

View File

@ -504,13 +504,11 @@ sub set_extruder {
}
package Slic3r::GCode::OozePrevention;
use Moo;
use strict;
use warnings;
use Slic3r::Geometry qw(scale);
has 'enable' => (is => 'rw', default => sub { 0 });
has 'standby_points' => (is => 'rw');
sub pre_toolchange {
my ($self, $gcodegen) = @_;

View File

@ -212,8 +212,8 @@ sub export {
}
my $convex_hull = convex_hull([ map @$_, @skirts ]);
$gcodegen->ooze_prevention->enable(1);
$gcodegen->ooze_prevention->standby_points(
$gcodegen->ooze_prevention->set_enable(1);
$gcodegen->ooze_prevention->set_standby_points(
[ map @{$_->equally_spaced_points(scale 10)}, @{offset([$convex_hull], scale 3)} ]
);

View File

@ -216,6 +216,7 @@ for my $class (qw(
Slic3r::ExtrusionPath::Collection
Slic3r::Flow
Slic3r::GCode::AvoidCrossingPerimeters
Slic3r::GCode::OozePrevention
Slic3r::GCode::PlaceholderParser
Slic3r::GCode::Wipe
Slic3r::Geometry::BoundingBox

View File

@ -67,6 +67,15 @@ AvoidCrossingPerimeters::travel_to(Point point, const Pointf &gcodegen_origin,
REGISTER_CLASS(AvoidCrossingPerimeters, "GCode::AvoidCrossingPerimeters");
#endif
OozePrevention::OozePrevention()
: enable(false)
{
}
#ifdef SLIC3RXS
REGISTER_CLASS(OozePrevention, "GCode::OozePrevention");
#endif
Wipe::Wipe()
: enable(false)
{

View File

@ -35,6 +35,14 @@ class AvoidCrossingPerimeters {
MotionPlanner* _layer_mp;
};
class OozePrevention {
public:
bool enable;
Points standby_points;
OozePrevention();
};
class Wipe {
public:
bool enable;

View File

@ -30,6 +30,21 @@
%code{% THIS->disable_once = value; %};
};
%name{Slic3r::GCode::OozePrevention} class OozePrevention {
OozePrevention();
~OozePrevention();
bool enable()
%code{% RETVAL = THIS->enable; %};
void set_enable(bool value)
%code{% THIS->enable = value; %};
Points standby_points()
%code{% RETVAL = THIS->standby_points; %};
void set_standby_points(Points points)
%code{% THIS->standby_points = points; %};
};
%name{Slic3r::GCode::Wipe} class Wipe {
Wipe();
~Wipe();

View File

@ -178,6 +178,10 @@ Wipe* O_OBJECT_SLIC3R
Ref<Wipe> O_OBJECT_SLIC3R_T
Clone<Wipe> O_OBJECT_SLIC3R_T
OozePrevention* O_OBJECT_SLIC3R
Ref<OozePrevention> O_OBJECT_SLIC3R_T
Clone<OozePrevention> O_OBJECT_SLIC3R_T
MotionPlanner* O_OBJECT_SLIC3R
Ref<MotionPlanner> O_OBJECT_SLIC3R_T
Clone<MotionPlanner> O_OBJECT_SLIC3R_T