Merge pull request #1968 from sapir/extrudercpp

Translate Extruder class to C++
This commit is contained in:
Alessandro Ranellucci 2014-04-28 21:45:53 +02:00
commit 4c330b6c59
16 changed files with 314 additions and 74 deletions

51
xs/xsp/Extruder.xsp Normal file
View file

@ -0,0 +1,51 @@
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Extruder.hpp"
%}
%name{Slic3r::Extruder} class Extruder {
Extruder(int id, PrintConfig *config);
~Extruder();
void reset();
double extrude(double dE);
int id() const
%code%{ RETVAL = THIS->id; %};
double E() const
%code%{ RETVAL = THIS->E; %};
double set_E(double val) const
%code%{ RETVAL = THIS->E = val; %};
double absolute_E() const
%code%{ RETVAL = THIS->absolute_E; %};
double set_absolute_E(double val) const
%code%{ RETVAL = THIS->absolute_E = val; %};
double retracted() const
%code%{ RETVAL = THIS->retracted; %};
double set_retracted(double val) const
%code%{ RETVAL = THIS->retracted = val; %};
double restart_extra() const
%code%{ RETVAL = THIS->restart_extra; %};
double set_restart_extra(double val) const
%code%{ RETVAL = THIS->restart_extra = val; %};
Clone<Pointf> extruder_offset() const;
double nozzle_diameter() const;
double filament_diameter() const;
double extrusion_multiplier() const;
int temperature() const;
int first_layer_temperature() const;
double retract_length() const;
double retract_lift() const;
int retract_speed() const;
double retract_restart_extra() const;
double retract_before_travel() const;
bool retract_layer_change() const;
double retract_length_toolchange() const;
double retract_restart_extra_toolchange() const;
bool wipe() const;
};

View file

@ -25,7 +25,7 @@
bool is_perimeter();
bool is_fill();
bool is_bridge();
std::string gcode(SV* extruder, double e, double F,
std::string gcode(Extruder* extruder, double e, double F,
double xofs, double yofs, std::string extrusion_axis,
std::string gcode_line_suffix);
%{

View file

@ -56,6 +56,17 @@ Point::coincides_with(point_sv)
};
%name{Slic3r::Pointf} class Pointf {
Pointf(double _x = 0, double _y = 0);
~Pointf();
Clone<Pointf> clone()
%code{% RETVAL = THIS; %};
double x()
%code{% RETVAL = THIS->x; %};
double y()
%code{% RETVAL = THIS->y; %};
};
%name{Slic3r::Pointf3} class Pointf3 {
Pointf3(double _x = 0, double _y = 0, double _z = 0);
~Pointf3();

View file

@ -25,6 +25,10 @@ Point* O_OBJECT_SLIC3R
Ref<Point> O_OBJECT_SLIC3R_T
Clone<Point> O_OBJECT_SLIC3R_T
Pointf* O_OBJECT_SLIC3R
Ref<Pointf> O_OBJECT_SLIC3R_T
Clone<Pointf> O_OBJECT_SLIC3R_T
Pointf3* O_OBJECT_SLIC3R
Ref<Pointf3> O_OBJECT_SLIC3R_T
Clone<Pointf3> O_OBJECT_SLIC3R_T
@ -77,6 +81,8 @@ Clone<Surface> O_OBJECT_SLIC3R_T
SurfaceCollection* O_OBJECT_SLIC3R
Extruder* O_OBJECT_SLIC3R
ExtrusionRole T_UV
FlowRole T_UV
PrintStep T_UV

View file

@ -12,6 +12,9 @@
%typemap{Point*};
%typemap{Ref<Point>}{simple};
%typemap{Clone<Point>}{simple};
%typemap{Pointf*};
%typemap{Ref<Pointf>}{simple};
%typemap{Clone<Pointf>}{simple};
%typemap{Pointf3*};
%typemap{Ref<Pointf3>}{simple};
%typemap{Clone<Pointf3>}{simple};
@ -70,6 +73,7 @@
%typemap{Surfaces};
%typemap{Polygons*};
%typemap{TriangleMeshPtrs};
%typemap{Extruder*};
%typemap{SurfaceType}{parsed}{
%cpp_type{SurfaceType};