Ported Slic3r::GCode::Wipe storage to XS

This commit is contained in:
Alessandro Ranellucci 2015-07-01 20:57:16 +02:00
parent 76b2e88551
commit b43dd92766
8 changed files with 69 additions and 11 deletions

View file

@ -217,6 +217,7 @@ for my $class (qw(
Slic3r::Flow
Slic3r::GCode::AvoidCrossingPerimeters
Slic3r::GCode::PlaceholderParser
Slic3r::GCode::Wipe
Slic3r::Geometry::BoundingBox
Slic3r::Geometry::BoundingBoxf
Slic3r::Geometry::BoundingBoxf3

View file

@ -67,4 +67,25 @@ AvoidCrossingPerimeters::travel_to(Point point, const Pointf &gcodegen_origin,
REGISTER_CLASS(AvoidCrossingPerimeters, "GCode::AvoidCrossingPerimeters");
#endif
Wipe::Wipe()
: enable(false)
{
}
bool
Wipe::has_path()
{
return !this->path.points.empty();
}
void
Wipe::reset_path()
{
this->path = Polyline();
}
#ifdef SLIC3RXS
REGISTER_CLASS(Wipe, "GCode::Wipe");
#endif
}

View file

@ -35,6 +35,17 @@ class AvoidCrossingPerimeters {
MotionPlanner* _layer_mp;
};
class Wipe {
public:
bool enable;
Polyline path;
Wipe();
bool has_path();
void reset_path();
//std::string wipe(GCode &gcodegen, bool toolchange = false);
};
}
#endif

View file

@ -29,3 +29,21 @@
void set_disable_once(bool value)
%code{% THIS->disable_once = value; %};
};
%name{Slic3r::GCode::Wipe} class Wipe {
Wipe();
~Wipe();
bool has_path();
void reset_path();
bool enable()
%code{% RETVAL = THIS->enable; %};
void set_enable(bool value)
%code{% THIS->enable = value; %};
Ref<Polyline> path()
%code{% RETVAL = &(THIS->path); %};
void set_path(Polyline* value)
%code{% THIS->path = *value; %};
};

View file

@ -174,6 +174,10 @@ AvoidCrossingPerimeters* O_OBJECT_SLIC3R
Ref<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
Clone<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
Wipe* O_OBJECT_SLIC3R
Ref<Wipe> O_OBJECT_SLIC3R_T
Clone<Wipe> O_OBJECT_SLIC3R_T
MotionPlanner* O_OBJECT_SLIC3R
Ref<MotionPlanner> O_OBJECT_SLIC3R_T
Clone<MotionPlanner> O_OBJECT_SLIC3R_T

View file

@ -129,6 +129,10 @@
%typemap{Ref<AvoidCrossingPerimeters>}{simple};
%typemap{Clone<AvoidCrossingPerimeters>}{simple};
%typemap{Wipe*};
%typemap{Ref<Wipe>}{simple};
%typemap{Clone<Wipe>}{simple};
%typemap{Points};
%typemap{Pointfs};