Ported Flow to XS

This commit is contained in:
Alessandro Ranellucci 2014-01-05 13:16:13 +01:00
parent 87342d324c
commit 036badf932
16 changed files with 360 additions and 201 deletions

80
xs/xsp/Flow.xsp Normal file
View file

@ -0,0 +1,80 @@
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Flow.hpp"
%}
%name{Slic3r::Flow} class Flow {
~Flow();
%name{_new} Flow(float width, float spacing, float nozzle_diameter);
void set_bridge(bool bridge)
%code{% THIS->bridge = bridge; %};
Flow* clone()
%code{% const char* CLASS = "Slic3r::Flow"; RETVAL = new Flow(*THIS); %};
float width()
%code{% RETVAL = THIS->width; %};
float spacing()
%code{% RETVAL = THIS->spacing; %};
float nozzle_diameter()
%code{% RETVAL = THIS->nozzle_diameter; %};
bool bridge()
%code{% RETVAL = THIS->bridge; %};
long scaled_width()
%code{% RETVAL = THIS->scaled_width; %};
long scaled_spacing()
%code{% RETVAL = THIS->scaled_spacing; %};
double mm3_per_mm(float height);
%{
Flow*
_new_from_width(CLASS, role, width, nozzle_diameter, height, bridge_flow_ratio)
char* CLASS;
FlowRole role;
std::string width;
float nozzle_diameter;
float height;
float bridge_flow_ratio;
CODE:
ConfigOptionFloatOrPercent optwidth;
optwidth.deserialize(width);
RETVAL = new Flow(Flow::new_from_config_width(role, optwidth, nozzle_diameter, height, bridge_flow_ratio));
OUTPUT:
RETVAL
Flow*
_new_from_spacing(CLASS, spacing, nozzle_diameter, height, bridge)
char* CLASS;
float spacing;
float nozzle_diameter;
float height;
bool bridge;
CODE:
RETVAL = new Flow(Flow::new_from_spacing(spacing, nozzle_diameter, height, bridge));
OUTPUT:
RETVAL
%}
};
%package{Slic3r::Flow};
%{
IV
_constant()
ALIAS:
FLOW_ROLE_PERIMETER = frPerimeter
FLOW_ROLE_INFILL = frInfill
FLOW_ROLE_SOLID_INFILL = frSolidInfill
FLOW_ROLE_TOP_SOLID_INFILL = frTopSolidInfill
FLOW_ROLE_SUPPORT_MATERIAL = frSupportMaterial
FLOW_ROLE_SUPPORT_MATERIAL_INTERFACE = frSupportMaterialInterface
PROTOTYPE:
CODE:
RETVAL = ix;
OUTPUT: RETVAL
%}

View file

@ -18,11 +18,13 @@ ExPolygonCollection* O_OBJECT
ExtrusionEntityCollection* O_OBJECT
ExtrusionPath* O_OBJECT
ExtrusionLoop* O_OBJECT
Flow* O_OBJECT
PrintState* O_OBJECT
Surface* O_OBJECT
SurfaceCollection* O_OBJECT
ExtrusionRole T_UV
FlowRole T_UV
PrintStep T_UV
SurfaceType T_UV
ClipperLib::JoinType T_UV

View file

@ -15,6 +15,7 @@
%typemap{FullPrintConfig*};
%typemap{ExPolygon*};
%typemap{ExPolygonCollection*};
%typemap{Flow*};
%typemap{Line*};
%typemap{Polyline*};
%typemap{Polygon*};
@ -43,6 +44,12 @@
$CVar = (ExtrusionRole)SvUV($PerlVar);
%};
};
%typemap{FlowRole}{parsed}{
%cpp_type{FlowRole};
%precall_code{%
$CVar = (FlowRole)SvUV($PerlVar);
%};
};
%typemap{PrintStep}{parsed}{
%cpp_type{PrintStep};
%precall_code{%