2013-07-14 11:05:55 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-07 23:39:54 +00:00
|
|
|
#include <xsinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/Surface.hpp"
|
|
|
|
#include "libslic3r/ClipperUtils.hpp"
|
2013-07-14 11:05:55 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::Surface} class Surface {
|
2013-08-08 00:10:34 +00:00
|
|
|
~Surface();
|
2014-04-27 17:18:53 +00:00
|
|
|
Ref<ExPolygon> expolygon()
|
|
|
|
%code{% RETVAL = &(THIS->expolygon); %};
|
2013-07-14 11:05:55 +00:00
|
|
|
double thickness()
|
|
|
|
%code{% RETVAL = THIS->thickness; %};
|
|
|
|
unsigned short thickness_layers()
|
|
|
|
%code{% RETVAL = THIS->thickness_layers; %};
|
2013-09-06 16:36:38 +00:00
|
|
|
double area();
|
2013-11-22 23:07:04 +00:00
|
|
|
bool is_solid() const;
|
2014-02-10 12:19:44 +00:00
|
|
|
bool is_external() const;
|
2014-12-24 00:29:36 +00:00
|
|
|
bool is_internal() const;
|
2014-03-25 00:11:28 +00:00
|
|
|
bool is_bottom() const;
|
2013-11-22 23:07:04 +00:00
|
|
|
bool is_bridge() const;
|
2013-07-14 11:05:55 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
Surface*
|
|
|
|
_new(CLASS, expolygon, surface_type, thickness, thickness_layers, bridge_angle, extra_perimeters)
|
|
|
|
char* CLASS;
|
|
|
|
ExPolygon* expolygon;
|
|
|
|
SurfaceType surface_type;
|
|
|
|
double thickness;
|
|
|
|
unsigned short thickness_layers;
|
|
|
|
double bridge_angle;
|
|
|
|
unsigned short extra_perimeters;
|
|
|
|
CODE:
|
2014-11-09 15:23:50 +00:00
|
|
|
RETVAL = new Surface (surface_type, *expolygon);
|
2013-07-14 11:05:55 +00:00
|
|
|
RETVAL->thickness = thickness;
|
|
|
|
RETVAL->thickness_layers = thickness_layers;
|
|
|
|
RETVAL->bridge_angle = bridge_angle;
|
|
|
|
RETVAL->extra_perimeters = extra_perimeters;
|
2013-08-08 00:10:34 +00:00
|
|
|
// we don't delete expolygon here because it's referenced by a Perl SV
|
|
|
|
// whose DESTROY will take care of destruction
|
2013-07-14 11:05:55 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SurfaceType
|
|
|
|
Surface::surface_type(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->surface_type = (SurfaceType)SvUV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->surface_type;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
double
|
|
|
|
Surface::bridge_angle(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->bridge_angle = (double)SvNV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->bridge_angle;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
unsigned short
|
|
|
|
Surface::extra_perimeters(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->extra_perimeters = (double)SvUV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->extra_perimeters;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-08-26 21:03:00 +00:00
|
|
|
Polygons
|
|
|
|
Surface::polygons()
|
|
|
|
CODE:
|
|
|
|
RETVAL.push_back(THIS->expolygon.contour);
|
|
|
|
for (Polygons::iterator it = THIS->expolygon.holes.begin(); it != THIS->expolygon.holes.end(); ++it) {
|
|
|
|
RETVAL.push_back((*it));
|
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-11-23 17:29:25 +00:00
|
|
|
Surfaces
|
2016-11-28 16:33:17 +00:00
|
|
|
Surface::offset(delta, joinType = ClipperLib::jtMiter, miterLimit = 3)
|
2013-11-23 17:29:25 +00:00
|
|
|
const float delta
|
2021-04-23 09:02:16 +00:00
|
|
|
Slic3r::ClipperLib::JoinType joinType
|
2013-11-23 17:29:25 +00:00
|
|
|
double miterLimit
|
|
|
|
CODE:
|
2016-12-13 18:22:23 +00:00
|
|
|
surfaces_append(RETVAL, offset_ex(THIS->expolygon, delta, joinType, miterLimit), *THIS);
|
2013-11-23 17:29:25 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-14 11:05:55 +00:00
|
|
|
%}
|
|
|
|
};
|
|
|
|
|
|
|
|
%package{Slic3r::Surface};
|
|
|
|
%{
|
|
|
|
|
|
|
|
IV
|
|
|
|
_constant()
|
|
|
|
ALIAS:
|
|
|
|
S_TYPE_TOP = stTop
|
|
|
|
S_TYPE_BOTTOM = stBottom
|
2014-03-25 00:11:28 +00:00
|
|
|
S_TYPE_BOTTOMBRIDGE = stBottomBridge
|
2013-07-14 11:05:55 +00:00
|
|
|
S_TYPE_INTERNAL = stInternal
|
|
|
|
S_TYPE_INTERNALSOLID = stInternalSolid
|
|
|
|
S_TYPE_INTERNALBRIDGE = stInternalBridge
|
|
|
|
S_TYPE_INTERNALVOID = stInternalVoid
|
2016-09-26 11:58:47 +00:00
|
|
|
S_TYPW_PERIMETER = stPerimeter
|
2013-07-14 11:05:55 +00:00
|
|
|
PROTOTYPE:
|
|
|
|
CODE:
|
|
|
|
RETVAL = ix;
|
|
|
|
OUTPUT: RETVAL
|
|
|
|
|
|
|
|
%}
|
|
|
|
|