mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
118
xs/xsp/BoundingBox.xsp
Normal file
118
xs/xsp/BoundingBox.xsp
Normal file
|
@ -0,0 +1,118 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/Point.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Geometry::BoundingBox} class BoundingBox {
|
||||
BoundingBox();
|
||||
~BoundingBox();
|
||||
Clone<BoundingBox> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void merge(BoundingBox* bb) %code{% THIS->merge(*bb); %};
|
||||
void merge_point(Point* point) %code{% THIS->merge(*point); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void offset(double delta);
|
||||
bool contains_point(Point* point) %code{% RETVAL = THIS->contains(*point); %};
|
||||
bool overlap(BoundingBox* bbox) %code{% RETVAL = THIS->overlap(*bbox); %};
|
||||
Clone<Polygon> polygon();
|
||||
Clone<Point> size();
|
||||
Clone<Point> center();
|
||||
bool empty() %code{% RETVAL = empty(*THIS); %};
|
||||
double radius();
|
||||
Clone<Point> min_point() %code{% RETVAL = THIS->min; %};
|
||||
Clone<Point> max_point() %code{% RETVAL = THIS->max; %};
|
||||
int x_min() %code{% RETVAL = THIS->min(0); %};
|
||||
int x_max() %code{% RETVAL = THIS->max(0); %};
|
||||
int y_min() %code{% RETVAL = THIS->min(1); %};
|
||||
int y_max() %code{% RETVAL = THIS->max(1); %};
|
||||
void set_x_min(double val) %code{% THIS->min(0) = val; %};
|
||||
void set_x_max(double val) %code{% THIS->max(0) = val; %};
|
||||
void set_y_min(double val) %code{% THIS->min(1) = val; %};
|
||||
void set_y_max(double val) %code{% THIS->max(1) = val; %};
|
||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%ld,%ld;%ld,%ld", THIS->min(0), THIS->min(1), THIS->max(0), THIS->max(1)); RETVAL = buf; %};
|
||||
bool defined() %code{% RETVAL = THIS->defined; %};
|
||||
|
||||
%{
|
||||
|
||||
BoundingBox*
|
||||
new_from_points(CLASS, points)
|
||||
char* CLASS
|
||||
Points points
|
||||
CODE:
|
||||
RETVAL = new BoundingBox(points);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%name{Slic3r::Geometry::BoundingBoxf} class BoundingBoxf {
|
||||
BoundingBoxf();
|
||||
~BoundingBoxf();
|
||||
Clone<BoundingBoxf> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void merge(BoundingBoxf* bb) %code{% THIS->merge(*bb); %};
|
||||
void merge_point(Vec2d* point) %code{% THIS->merge(*point); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
Clone<Vec2d> size();
|
||||
Clone<Vec2d> center();
|
||||
double radius();
|
||||
bool empty() %code{% RETVAL = empty(*THIS); %};
|
||||
Clone<Vec2d> min_point() %code{% RETVAL = THIS->min; %};
|
||||
Clone<Vec2d> max_point() %code{% RETVAL = THIS->max; %};
|
||||
double x_min() %code{% RETVAL = THIS->min(0); %};
|
||||
double x_max() %code{% RETVAL = THIS->max(0); %};
|
||||
double y_min() %code{% RETVAL = THIS->min(1); %};
|
||||
double y_max() %code{% RETVAL = THIS->max(1); %};
|
||||
void set_x_min(double val) %code{% THIS->min(0) = val; %};
|
||||
void set_x_max(double val) %code{% THIS->max(0) = val; %};
|
||||
void set_y_min(double val) %code{% THIS->min(1) = val; %};
|
||||
void set_y_max(double val) %code{% THIS->max(1) = val; %};
|
||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf;%lf,%lf", THIS->min(0), THIS->min(1), THIS->max(0), THIS->max(1)); RETVAL = buf; %};
|
||||
bool defined() %code{% RETVAL = THIS->defined; %};
|
||||
|
||||
%{
|
||||
|
||||
BoundingBoxf*
|
||||
new_from_points(CLASS, points)
|
||||
char* CLASS
|
||||
Pointfs points
|
||||
CODE:
|
||||
RETVAL = new BoundingBoxf(points);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%name{Slic3r::Geometry::BoundingBoxf3} class BoundingBoxf3 {
|
||||
BoundingBoxf3();
|
||||
~BoundingBoxf3();
|
||||
Clone<BoundingBoxf3> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void merge(BoundingBoxf3* bb) %code{% THIS->merge(*bb); %};
|
||||
void merge_point(Vec3d* point) %code{% THIS->merge(*point); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y, double z);
|
||||
void offset(double delta);
|
||||
bool contains_point(Vec3d* point) %code{% RETVAL = THIS->contains(*point); %};
|
||||
Clone<Vec3d> size();
|
||||
Clone<Vec3d> center();
|
||||
double radius();
|
||||
bool empty() %code{% RETVAL = empty(*THIS); %};
|
||||
Clone<Vec3d> min_point() %code{% RETVAL = THIS->min; %};
|
||||
Clone<Vec3d> max_point() %code{% RETVAL = THIS->max; %};
|
||||
double x_min() %code{% RETVAL = THIS->min(0); %};
|
||||
double x_max() %code{% RETVAL = THIS->max(0); %};
|
||||
double y_min() %code{% RETVAL = THIS->min(1); %};
|
||||
double y_max() %code{% RETVAL = THIS->max(1); %};
|
||||
double z_min() %code{% RETVAL = THIS->min(2); %};
|
||||
double z_max() %code{% RETVAL = THIS->max(2); %};
|
||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf,%lf;%lf,%lf,%lf", THIS->min(0), THIS->min(1), THIS->min(2), THIS->max(0), THIS->max(1), THIS->max(2)); RETVAL = buf; %};
|
||||
bool defined() %code{% RETVAL = THIS->defined; %};
|
||||
};
|
43
xs/xsp/BridgeDetector.xsp
Normal file
43
xs/xsp/BridgeDetector.xsp
Normal file
|
@ -0,0 +1,43 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/BridgeDetector.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::BridgeDetector} class BridgeDetector {
|
||||
~BridgeDetector();
|
||||
|
||||
bool detect_angle();
|
||||
Polygons coverage();
|
||||
%name{coverage_by_angle} Polygons coverage(double angle);
|
||||
Polylines unsupported_edges();
|
||||
%name{unsupported_edges_by_angle} Polylines unsupported_edges(double angle);
|
||||
double angle()
|
||||
%code{% RETVAL = THIS->angle; %};
|
||||
double resolution()
|
||||
%code{% RETVAL = THIS->resolution; %};
|
||||
%{
|
||||
|
||||
BridgeDetector*
|
||||
BridgeDetector::new(expolygon, lower_slices, extrusion_width)
|
||||
ExPolygon* expolygon;
|
||||
ExPolygonCollection* lower_slices;
|
||||
int extrusion_width;
|
||||
CODE:
|
||||
RETVAL = new BridgeDetector(*expolygon, lower_slices->expolygons, extrusion_width);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
BridgeDetector*
|
||||
BridgeDetector::new_expolygons(expolygons, lower_slices, extrusion_width)
|
||||
ExPolygonCollection* expolygons;
|
||||
ExPolygonCollection* lower_slices;
|
||||
int extrusion_width;
|
||||
CODE:
|
||||
RETVAL = new BridgeDetector(expolygons->expolygons, lower_slices->expolygons, extrusion_width);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
132
xs/xsp/Clipper.xsp
Normal file
132
xs/xsp/Clipper.xsp
Normal file
|
@ -0,0 +1,132 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
%}
|
||||
|
||||
%package{Slic3r::Geometry::Clipper};
|
||||
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
JT_MITER = jtMiter
|
||||
JT_ROUND = jtRound
|
||||
JT_SQUARE = jtSquare
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
Polygons
|
||||
offset(polygons, delta, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
|
||||
Polygons polygons
|
||||
const float delta
|
||||
Slic3r::ClipperLib::JoinType joinType
|
||||
double miterLimit
|
||||
CODE:
|
||||
RETVAL = offset(polygons, delta, joinType, miterLimit);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExPolygons
|
||||
offset_ex(polygons, delta, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
|
||||
Polygons polygons
|
||||
const float delta
|
||||
Slic3r::ClipperLib::JoinType joinType
|
||||
double miterLimit
|
||||
CODE:
|
||||
RETVAL = offset_ex(polygons, delta, joinType, miterLimit);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExPolygons
|
||||
offset2_ex(polygons, delta1, delta2, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
|
||||
Polygons polygons
|
||||
const float delta1
|
||||
const float delta2
|
||||
Slic3r::ClipperLib::JoinType joinType
|
||||
double miterLimit
|
||||
CODE:
|
||||
RETVAL = offset2_ex(union_ex(polygons), delta1, delta2, joinType, miterLimit);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygons
|
||||
diff(subject, clip, safety_offset = false)
|
||||
Polygons subject
|
||||
Polygons clip
|
||||
bool safety_offset
|
||||
CODE:
|
||||
RETVAL = diff(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExPolygons
|
||||
diff_ex(subject, clip, safety_offset = false)
|
||||
Polygons subject
|
||||
Polygons clip
|
||||
bool safety_offset
|
||||
CODE:
|
||||
RETVAL = diff_ex(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polylines
|
||||
diff_pl(subject, clip)
|
||||
Polylines subject
|
||||
Polygons clip
|
||||
CODE:
|
||||
RETVAL = diff_pl(subject, clip);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygons
|
||||
intersection(subject, clip, safety_offset = false)
|
||||
Polygons subject
|
||||
Polygons clip
|
||||
bool safety_offset
|
||||
CODE:
|
||||
RETVAL = intersection(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExPolygons
|
||||
intersection_ex(subject, clip, safety_offset = false)
|
||||
Polygons subject
|
||||
Polygons clip
|
||||
bool safety_offset
|
||||
CODE:
|
||||
RETVAL = intersection_ex(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polylines
|
||||
intersection_pl(subject, clip)
|
||||
Polylines subject
|
||||
Polygons clip
|
||||
CODE:
|
||||
RETVAL = intersection_pl(subject, clip);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygons
|
||||
union(subject, safety_offset = false)
|
||||
Polygons subject
|
||||
bool safety_offset
|
||||
CODE:
|
||||
RETVAL = safety_offset ? union_safety_offset(subject) : union_(subject);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExPolygons
|
||||
union_ex(subject, safety_offset = false)
|
||||
Polygons subject
|
||||
bool safety_offset
|
||||
CODE:
|
||||
RETVAL = safety_offset ? union_safety_offset_ex(subject) : union_ex(subject);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
222
xs/xsp/Config.xsp
Normal file
222
xs/xsp/Config.xsp
Normal file
|
@ -0,0 +1,222 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Config} class DynamicPrintConfig {
|
||||
DynamicPrintConfig();
|
||||
~DynamicPrintConfig();
|
||||
static DynamicPrintConfig* new_from_defaults()
|
||||
%code{% RETVAL = DynamicPrintConfig::new_from_defaults_keys(FullPrintConfig::defaults().keys()); %};
|
||||
static DynamicPrintConfig* new_from_defaults_keys(std::vector<std::string> keys);
|
||||
DynamicPrintConfig* clone() %code{% RETVAL = new DynamicPrintConfig(*THIS); %};
|
||||
DynamicPrintConfig* clone_only(std::vector<std::string> keys)
|
||||
%code{% RETVAL = new DynamicPrintConfig(); RETVAL->apply_only(*THIS, keys, true); %};
|
||||
bool has(t_config_option_key opt_key);
|
||||
SV* as_hash()
|
||||
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||
SV* get(t_config_option_key opt_key)
|
||||
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||
SV* get_at(t_config_option_key opt_key, int i)
|
||||
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||
SV* get_value(t_config_option_key opt_key)
|
||||
%code{%
|
||||
const ConfigOptionDef *def = THIS->def()->get(opt_key);
|
||||
RETVAL = (def != nullptr && ! def->ratio_over.empty()) ?
|
||||
newSVnv(THIS->get_abs_value(opt_key)) :
|
||||
ConfigBase__get(THIS, opt_key);
|
||||
%};
|
||||
bool set(t_config_option_key opt_key, SV* value)
|
||||
%code{% RETVAL = ConfigBase__set(THIS, opt_key, value); %};
|
||||
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||
std::string opt_serialize(t_config_option_key opt_key);
|
||||
double get_abs_value(t_config_option_key opt_key);
|
||||
%name{get_abs_value_over}
|
||||
double get_abs_value(t_config_option_key opt_key, double ratio_over);
|
||||
void apply(DynamicPrintConfig* other)
|
||||
%code{% THIS->apply(*other, true); %};
|
||||
std::vector<std::string> diff(DynamicPrintConfig* other)
|
||||
%code{% RETVAL = THIS->diff(*other); %};
|
||||
bool equals(DynamicPrintConfig* other)
|
||||
%code{% RETVAL = THIS->equals(*other); %};
|
||||
void apply_static(StaticPrintConfig* other)
|
||||
%code{% THIS->apply(*other, true); %};
|
||||
%name{get_keys} std::vector<std::string> keys();
|
||||
void erase(t_config_option_key opt_key);
|
||||
void normalize_fdm();
|
||||
%name{setenv} void setenv_();
|
||||
double min_object_distance() %code{% RETVAL = Slic3r::min_object_distance(*THIS); %};
|
||||
static DynamicPrintConfig* load(char *path)
|
||||
%code%{
|
||||
auto config = new DynamicPrintConfig();
|
||||
try {
|
||||
config->load(path, ForwardCompatibilitySubstitutionRule::Disable);
|
||||
RETVAL = config;
|
||||
} catch (std::exception& e) {
|
||||
delete config;
|
||||
croak("Error extracting configuration from %s:\n%s\n", path, e.what());
|
||||
}
|
||||
%};
|
||||
void save(std::string file);
|
||||
int validate() %code%{
|
||||
std::string err = THIS->validate();
|
||||
if (! err.empty())
|
||||
croak("Configuration is not valid: %s\n", err.c_str());
|
||||
RETVAL = 1;
|
||||
%};
|
||||
};
|
||||
|
||||
%name{Slic3r::Config::Static} class StaticPrintConfig {
|
||||
static StaticPrintConfig* new_GCodeConfig()
|
||||
%code{% RETVAL = new GCodeConfig(); %};
|
||||
static StaticPrintConfig* new_PrintConfig()
|
||||
%code{% RETVAL = static_cast<GCodeConfig*>(new PrintConfig()); %};
|
||||
static StaticPrintConfig* new_PrintObjectConfig()
|
||||
%code{% RETVAL = new PrintObjectConfig(); %};
|
||||
static StaticPrintConfig* new_PrintRegionConfig()
|
||||
%code{% RETVAL = new PrintRegionConfig(); %};
|
||||
static StaticPrintConfig* new_FullPrintConfig()
|
||||
%code{% RETVAL = static_cast<GCodeConfig*>(new FullPrintConfig()); %};
|
||||
~StaticPrintConfig();
|
||||
bool has(t_config_option_key opt_key);
|
||||
SV* as_hash()
|
||||
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||
SV* get(t_config_option_key opt_key)
|
||||
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||
SV* get_at(t_config_option_key opt_key, int i)
|
||||
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||
bool set(t_config_option_key opt_key, SV* value)
|
||||
%code{% RETVAL = StaticConfig__set(THIS, opt_key, value); %};
|
||||
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||
std::string opt_serialize(t_config_option_key opt_key);
|
||||
double get_abs_value(t_config_option_key opt_key);
|
||||
%name{get_abs_value_over}
|
||||
double get_abs_value(t_config_option_key opt_key, double ratio_over);
|
||||
void apply_static(StaticPrintConfig* other)
|
||||
%code{% THIS->apply(*other, true); %};
|
||||
void apply_dynamic(DynamicPrintConfig* other)
|
||||
%code{% THIS->apply(*other, true); %};
|
||||
%name{get_keys} std::vector<std::string> keys();
|
||||
std::string get_extrusion_axis()
|
||||
%code{%
|
||||
if (GCodeConfig* config = dynamic_cast<GCodeConfig*>(THIS)) {
|
||||
RETVAL = get_extrusion_axis(*config);
|
||||
} else {
|
||||
CONFESS("This StaticConfig object does not provide get_extrusion_axis()");
|
||||
}
|
||||
%};
|
||||
%name{setenv} void setenv_();
|
||||
double min_object_distance() %code{% RETVAL = Slic3r::min_object_distance(*THIS); %};
|
||||
static StaticPrintConfig* load(char *path)
|
||||
%code%{
|
||||
auto config = new FullPrintConfig();
|
||||
try {
|
||||
config->load(path, ForwardCompatibilitySubstitutionRule::Disable);
|
||||
RETVAL = static_cast<GCodeConfig*>(config);
|
||||
} catch (std::exception& e) {
|
||||
delete config;
|
||||
croak("Error extracting configuration from %s:\n%s\n", path, e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
void save(std::string file);
|
||||
};
|
||||
|
||||
%package{Slic3r::Config};
|
||||
|
||||
%{
|
||||
PROTOTYPES: DISABLE
|
||||
|
||||
SV*
|
||||
print_config_def()
|
||||
CODE:
|
||||
t_optiondef_map &def = *const_cast<t_optiondef_map*>(&Slic3r::print_config_def.options);
|
||||
|
||||
HV* options_hv = newHV();
|
||||
for (t_optiondef_map::iterator oit = def.begin(); oit != def.end(); ++oit) {
|
||||
HV* hv = newHV();
|
||||
|
||||
t_config_option_key opt_key = oit->first;
|
||||
ConfigOptionDef* optdef = &oit->second;
|
||||
|
||||
const char* opt_type;
|
||||
if (optdef->type == coFloat || optdef->type == coFloats || optdef->type == coFloatOrPercent) {
|
||||
opt_type = "f";
|
||||
} else if (optdef->type == coPercent || optdef->type == coPercents) {
|
||||
opt_type = "percent";
|
||||
} else if (optdef->type == coInt || optdef->type == coInts) {
|
||||
opt_type = "i";
|
||||
} else if (optdef->type == coString) {
|
||||
opt_type = "s";
|
||||
} else if (optdef->type == coStrings) {
|
||||
opt_type = "s@";
|
||||
} else if (optdef->type == coPoint || optdef->type == coPoints) {
|
||||
opt_type = "point";
|
||||
} else if (optdef->type == coPoint3) {
|
||||
opt_type = "point3";
|
||||
} else if (optdef->type == coBool || optdef->type == coBools) {
|
||||
opt_type = "bool";
|
||||
} else if (optdef->type == coEnum) {
|
||||
opt_type = "select";
|
||||
} else {
|
||||
throw "Unknown option type";
|
||||
}
|
||||
(void)hv_stores( hv, "type", newSVpv(opt_type, 0) );
|
||||
(void)hv_stores( hv, "height", newSViv(optdef->height) );
|
||||
(void)hv_stores( hv, "width", newSViv(optdef->width) );
|
||||
(void)hv_stores( hv, "min", newSViv(optdef->min) );
|
||||
(void)hv_stores( hv, "max", newSViv(optdef->max) );
|
||||
|
||||
// aliases
|
||||
if (!optdef->aliases.empty()) {
|
||||
AV* av = newAV();
|
||||
av_fill(av, optdef->aliases.size()-1);
|
||||
for (std::vector<t_config_option_key>::iterator it = optdef->aliases.begin(); it != optdef->aliases.end(); ++it)
|
||||
av_store(av, it - optdef->aliases.begin(), newSVpvn(it->c_str(), it->length()));
|
||||
(void)hv_stores( hv, "aliases", newRV_noinc((SV*)av) );
|
||||
}
|
||||
|
||||
// shortcut
|
||||
if (!optdef->shortcut.empty()) {
|
||||
AV* av = newAV();
|
||||
av_fill(av, optdef->shortcut.size()-1);
|
||||
for (std::vector<t_config_option_key>::iterator it = optdef->shortcut.begin(); it != optdef->shortcut.end(); ++it)
|
||||
av_store(av, it - optdef->shortcut.begin(), newSVpvn(it->c_str(), it->length()));
|
||||
(void)hv_stores( hv, "shortcut", newRV_noinc((SV*)av) );
|
||||
}
|
||||
|
||||
// enum_values
|
||||
if (!optdef->enum_values.empty()) {
|
||||
AV* av = newAV();
|
||||
av_fill(av, optdef->enum_values.size()-1);
|
||||
for (std::vector<std::string>::iterator it = optdef->enum_values.begin(); it != optdef->enum_values.end(); ++it)
|
||||
av_store(av, it - optdef->enum_values.begin(), newSVpvn(it->c_str(), it->length()));
|
||||
(void)hv_stores( hv, "values", newRV_noinc((SV*)av) );
|
||||
}
|
||||
|
||||
// enum_labels
|
||||
if (!optdef->enum_labels.empty()) {
|
||||
AV* av = newAV();
|
||||
av_fill(av, optdef->enum_labels.size()-1);
|
||||
for (std::vector<std::string>::iterator it = optdef->enum_labels.begin(); it != optdef->enum_labels.end(); ++it)
|
||||
av_store(av, it - optdef->enum_labels.begin(), newSVpvn_utf8(it->c_str(), it->length(), true));
|
||||
(void)hv_stores( hv, "labels", newRV_noinc((SV*)av) );
|
||||
}
|
||||
|
||||
if (optdef->default_value)
|
||||
(void)hv_stores( hv, "default", ConfigOption_to_SV(*optdef->default_value.get(), *optdef) );
|
||||
(void)hv_store( options_hv, opt_key.c_str(), opt_key.length(), newRV_noinc((SV*)hv), 0 );
|
||||
}
|
||||
|
||||
RETVAL = newRV_noinc((SV*)options_hv);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
%}
|
59
xs/xsp/ExPolygon.xsp
Normal file
59
xs/xsp/ExPolygon.xsp
Normal file
|
@ -0,0 +1,59 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExPolygon.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExPolygon} class ExPolygon {
|
||||
~ExPolygon();
|
||||
Clone<ExPolygon> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_AV(THIS); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
Ref<Polygon> contour()
|
||||
%code{% RETVAL = &(THIS->contour); %};
|
||||
Polygons* holes()
|
||||
%code{% RETVAL = &(THIS->holes); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
double area();
|
||||
bool is_valid();
|
||||
bool contains_line(Line* line)
|
||||
%code{% RETVAL = THIS->contains(*line); %};
|
||||
bool contains_polyline(Polyline* polyline)
|
||||
%code{% RETVAL = THIS->contains(*polyline); %};
|
||||
bool contains_point(Point* point)
|
||||
%code{% RETVAL = THIS->contains(*point); %};
|
||||
ExPolygons simplify(double tolerance);
|
||||
Polygons simplify_p(double tolerance);
|
||||
Polylines medial_axis(double max_width, double min_width)
|
||||
%code{% THIS->medial_axis(max_width, min_width, &RETVAL); %};
|
||||
%{
|
||||
|
||||
ExPolygon*
|
||||
ExPolygon::new(...)
|
||||
CODE:
|
||||
RETVAL = new ExPolygon ();
|
||||
// ST(0) is class name, ST(1) is contour and others are holes
|
||||
from_SV_check(ST(1), &RETVAL->contour);
|
||||
RETVAL->holes.resize(items-2);
|
||||
for (unsigned int i = 2; i < items; i++) {
|
||||
from_SV_check(ST(i), &RETVAL->holes[i-2]);
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExPolygon::rotate(angle, center_sv)
|
||||
double angle;
|
||||
SV* center_sv;
|
||||
CODE:
|
||||
Point center;
|
||||
from_SV_check(center_sv, ¢er);
|
||||
THIS->rotate(angle, center);
|
||||
|
||||
%}
|
||||
};
|
81
xs/xsp/ExPolygonCollection.xsp
Normal file
81
xs/xsp/ExPolygonCollection.xsp
Normal file
|
@ -0,0 +1,81 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExPolygonCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
|
||||
~ExPolygonCollection();
|
||||
Clone<ExPolygonCollection> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void clear()
|
||||
%code{% THIS->expolygons.clear(); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void rotate(double angle, Point* center)
|
||||
%code{% THIS->rotate(angle, *center); %};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->expolygons.size(); %};
|
||||
bool contains_point(Point* point)
|
||||
%code{% RETVAL = THIS->contains(*point); %};
|
||||
bool contains_line(Line* line)
|
||||
%code{% RETVAL = THIS->contains(*line); %};
|
||||
bool contains_polyline(Polyline* polyline)
|
||||
%code{% RETVAL = THIS->contains(*polyline); %};
|
||||
void simplify(double tolerance);
|
||||
Polygons polygons()
|
||||
%code{% RETVAL = (Polygons)*THIS; %};
|
||||
Clone<Polygon> convex_hull();
|
||||
%{
|
||||
|
||||
ExPolygonCollection*
|
||||
ExPolygonCollection::new(...)
|
||||
CODE:
|
||||
RETVAL = new ExPolygonCollection ();
|
||||
// ST(0) is class name, others are expolygons
|
||||
RETVAL->expolygons.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
// Note: a COPY of the input is stored
|
||||
from_SV_check(ST(i), &RETVAL->expolygons[i-1]);
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
ExPolygonCollection::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->expolygons.size()-1);
|
||||
int i = 0;
|
||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
ExPolygonCollection::pp()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->expolygons.size()-1);
|
||||
int i = 0;
|
||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, to_SV_pureperl(&*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExPolygonCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
ExPolygon expolygon;
|
||||
from_SV_check(ST(i), &expolygon);
|
||||
THIS->expolygons.push_back(expolygon);
|
||||
}
|
||||
|
||||
%}
|
||||
};
|
106
xs/xsp/ExtrusionEntityCollection.xsp
Normal file
106
xs/xsp/ExtrusionEntityCollection.xsp
Normal file
|
@ -0,0 +1,106 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection {
|
||||
%name{_new} ExtrusionEntityCollection();
|
||||
~ExtrusionEntityCollection();
|
||||
Clone<ExtrusionEntityCollection> clone()
|
||||
%code{% RETVAL = (ExtrusionEntityCollection*)THIS->clone(); %};
|
||||
void reverse();
|
||||
void clear();
|
||||
ExtrusionEntityCollection* chained_path(bool no_reverse, ExtrusionRole role = erMixed)
|
||||
%code{%
|
||||
if (no_reverse)
|
||||
croak("no_reverse must be false");
|
||||
RETVAL = new ExtrusionEntityCollection();
|
||||
*RETVAL = THIS->chained_path_from(THIS->entities.front()->first_point());
|
||||
%};
|
||||
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse, ExtrusionRole role = erMixed)
|
||||
%code{%
|
||||
if (no_reverse)
|
||||
croak("no_reverse must be false");
|
||||
RETVAL = new ExtrusionEntityCollection();
|
||||
*RETVAL = THIS->chained_path_from(*start_near, role);
|
||||
%};
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
int count()
|
||||
%code{% RETVAL = THIS->entities.size(); %};
|
||||
int items_count()
|
||||
%code{% RETVAL = THIS->items_count(); %};
|
||||
ExtrusionEntityCollection* flatten()
|
||||
%code{%
|
||||
RETVAL = new ExtrusionEntityCollection();
|
||||
*RETVAL = THIS->flatten();
|
||||
%};
|
||||
double min_mm3_per_mm();
|
||||
bool empty()
|
||||
%code{% RETVAL = THIS->entities.empty(); %};
|
||||
Polygons polygons_covered_by_width();
|
||||
Polygons polygons_covered_by_spacing();
|
||||
%{
|
||||
|
||||
SV*
|
||||
ExtrusionEntityCollection::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->entities.size()-1);
|
||||
int i = 0;
|
||||
for (ExtrusionEntitiesPtr::iterator it = THIS->entities.begin(); it != THIS->entities.end(); ++it) {
|
||||
SV* sv = newSV(0);
|
||||
// return our item by reference
|
||||
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(*it)) {
|
||||
sv_setref_pv( sv, perl_class_name_ref(path), path );
|
||||
} else if (ExtrusionMultiPath* multipath = dynamic_cast<ExtrusionMultiPath*>(*it)) {
|
||||
sv_setref_pv( sv, perl_class_name_ref(multipath), multipath );
|
||||
} else if (ExtrusionLoop* loop = dynamic_cast<ExtrusionLoop*>(*it)) {
|
||||
sv_setref_pv( sv, perl_class_name_ref(loop), loop );
|
||||
} else if (ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(*it)) {
|
||||
sv_setref_pv( sv, perl_class_name_ref(collection), collection );
|
||||
} else {
|
||||
croak("Unexpected type in ExtrusionEntityCollection");
|
||||
}
|
||||
av_store(av, i++, sv);
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExtrusionEntityCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
if(!sv_isobject( ST(i) ) || (SvTYPE(SvRV( ST(i) )) != SVt_PVMG)) {
|
||||
croak("Argument %d is not object", i);
|
||||
}
|
||||
ExtrusionEntity* entity = (ExtrusionEntity *)SvIV((SV*)SvRV( ST(i) ));
|
||||
// append COPIES
|
||||
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(entity)) {
|
||||
THIS->entities.push_back( new ExtrusionPath(*path) );
|
||||
} else if (ExtrusionMultiPath* multipath = dynamic_cast<ExtrusionMultiPath*>(entity)) {
|
||||
THIS->entities.push_back( new ExtrusionMultiPath(*multipath) );
|
||||
} else if (ExtrusionLoop* loop = dynamic_cast<ExtrusionLoop*>(entity)) {
|
||||
THIS->entities.push_back( new ExtrusionLoop(*loop) );
|
||||
} else if(ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(entity)) {
|
||||
THIS->entities.push_back( collection->clone() );
|
||||
} else {
|
||||
croak("Argument %d is of unknown type", i);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ExtrusionEntityCollection::no_sort(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->no_sort = SvTRUE(ST(1));
|
||||
}
|
||||
RETVAL = THIS->no_sort;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
65
xs/xsp/ExtrusionLoop.xsp
Normal file
65
xs/xsp/ExtrusionLoop.xsp
Normal file
|
@ -0,0 +1,65 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExtrusionEntity.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
|
||||
ExtrusionLoop();
|
||||
~ExtrusionLoop();
|
||||
Clone<ExtrusionLoop> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void reverse();
|
||||
bool make_clockwise();
|
||||
bool make_counter_clockwise();
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
Clone<Polygon> polygon();
|
||||
void append(ExtrusionPath* path)
|
||||
%code{% THIS->paths.push_back(*path); %};
|
||||
double length();
|
||||
bool split_at_vertex(Point* point)
|
||||
%code{% RETVAL = THIS->split_at_vertex(*point); %};
|
||||
void split_at(Point* point, int prefer_non_overhang = 0)
|
||||
%code{% THIS->split_at(*point, prefer_non_overhang != 0); %};
|
||||
ExtrusionPaths clip_end(double distance)
|
||||
%code{% THIS->clip_end(distance, &RETVAL); %};
|
||||
bool has_overhang_point(Point* point)
|
||||
%code{% RETVAL = THIS->has_overhang_point(*point); %};
|
||||
ExtrusionRole role() const;
|
||||
ExtrusionLoopRole loop_role() const;
|
||||
Polygons polygons_covered_by_width();
|
||||
Polygons polygons_covered_by_spacing();
|
||||
%{
|
||||
|
||||
SV*
|
||||
ExtrusionLoop::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->paths.size()-1);
|
||||
for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) {
|
||||
av_store(av, it - THIS->paths.begin(), perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%package{Slic3r::ExtrusionLoop};
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
EXTRL_ROLE_DEFAULT = elrDefault
|
||||
EXTRL_ROLE_CONTOUR_INTERNAL_PERIMETER = elrContourInternalPerimeter
|
||||
EXTRL_ROLE_SKIRT = elrSkirt
|
||||
PROTOTYPE:
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
%}
|
38
xs/xsp/ExtrusionMultiPath.xsp
Normal file
38
xs/xsp/ExtrusionMultiPath.xsp
Normal file
|
@ -0,0 +1,38 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExtrusionEntity.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionMultiPath} class ExtrusionMultiPath {
|
||||
ExtrusionMultiPath();
|
||||
~ExtrusionMultiPath();
|
||||
Clone<ExtrusionMultiPath> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void reverse();
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
void append(ExtrusionPath* path)
|
||||
%code{% THIS->paths.push_back(*path); %};
|
||||
double length();
|
||||
Polygons polygons_covered_by_width();
|
||||
Polygons polygons_covered_by_spacing();
|
||||
Clone<Polyline> polyline()
|
||||
%code{% RETVAL = THIS->as_polyline(); %};
|
||||
%{
|
||||
|
||||
SV*
|
||||
ExtrusionMultiPath::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->paths.size()-1);
|
||||
for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) {
|
||||
av_store(av, it - THIS->paths.begin(), perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
142
xs/xsp/ExtrusionPath.xsp
Normal file
142
xs/xsp/ExtrusionPath.xsp
Normal file
|
@ -0,0 +1,142 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExtrusionEntity.hpp"
|
||||
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
|
||||
~ExtrusionPath();
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_AV(&THIS->polyline); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(&THIS->polyline); %};
|
||||
void pop_back()
|
||||
%code{% THIS->polyline.points.pop_back(); %};
|
||||
void reverse();
|
||||
Lines lines()
|
||||
%code{% RETVAL = THIS->polyline.lines(); %};
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
void clip_end(double distance);
|
||||
void simplify(double tolerance);
|
||||
double length();
|
||||
ExtrusionRole role() const;
|
||||
bool is_bridge()
|
||||
%code{% RETVAL = is_bridge(THIS->role()); %};
|
||||
Polygons polygons_covered_by_width();
|
||||
Polygons polygons_covered_by_spacing();
|
||||
%{
|
||||
|
||||
ExtrusionPath*
|
||||
_new(CLASS, polyline_sv, role, mm3_per_mm, width, height)
|
||||
char* CLASS;
|
||||
SV* polyline_sv;
|
||||
ExtrusionRole role;
|
||||
double mm3_per_mm;
|
||||
float width;
|
||||
float height;
|
||||
CODE:
|
||||
RETVAL = new ExtrusionPath (role);
|
||||
from_SV_check(polyline_sv, &RETVAL->polyline);
|
||||
RETVAL->mm3_per_mm = mm3_per_mm;
|
||||
RETVAL->width = width;
|
||||
RETVAL->height = height;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Ref<Polyline>
|
||||
ExtrusionPath::polyline(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
from_SV_check(ST(1), &THIS->polyline);
|
||||
}
|
||||
RETVAL = &(THIS->polyline);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
double
|
||||
ExtrusionPath::mm3_per_mm(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->mm3_per_mm = (double)SvNV(ST(1));
|
||||
}
|
||||
RETVAL = THIS->mm3_per_mm;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
float
|
||||
ExtrusionPath::width(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->width = (float)SvNV(ST(1));
|
||||
}
|
||||
RETVAL = THIS->width;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
float
|
||||
ExtrusionPath::height(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->height = (float)SvNV(ST(1));
|
||||
}
|
||||
RETVAL = THIS->height;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExtrusionPath::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
Point p;
|
||||
from_SV_check(ST(i), &p);
|
||||
THIS->polyline.points.push_back(p);
|
||||
}
|
||||
|
||||
ExtrusionEntityCollection*
|
||||
ExtrusionPath::intersect_expolygons(ExPolygonCollection* collection)
|
||||
CODE:
|
||||
RETVAL = new ExtrusionEntityCollection ();
|
||||
THIS->intersect_expolygons(*collection, RETVAL);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExtrusionEntityCollection*
|
||||
ExtrusionPath::subtract_expolygons(ExPolygonCollection* collection)
|
||||
CODE:
|
||||
RETVAL = new ExtrusionEntityCollection ();
|
||||
THIS->subtract_expolygons(*collection, RETVAL);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%package{Slic3r::ExtrusionPath};
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
EXTR_ROLE_NONE = erNone
|
||||
EXTR_ROLE_PERIMETER = erPerimeter
|
||||
EXTR_ROLE_EXTERNAL_PERIMETER = erExternalPerimeter
|
||||
EXTR_ROLE_OVERHANG_PERIMETER = erOverhangPerimeter
|
||||
EXTR_ROLE_FILL = erInternalInfill
|
||||
EXTR_ROLE_SOLIDFILL = erSolidInfill
|
||||
EXTR_ROLE_TOPSOLIDFILL = erTopSolidInfill
|
||||
EXTR_ROLE_BRIDGE = erBridgeInfill
|
||||
EXTR_ROLE_GAPFILL = erGapFill
|
||||
EXTR_ROLE_SKIRT = erSkirt
|
||||
EXTR_ROLE_SUPPORTMATERIAL = erSupportMaterial
|
||||
EXTR_ROLE_SUPPORTMATERIAL_INTERFACE = erSupportMaterialInterface
|
||||
EXTR_ROLE_MIXED = erMixed
|
||||
PROTOTYPE:
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
%}
|
||||
|
50
xs/xsp/ExtrusionSimulator.xsp
Normal file
50
xs/xsp/ExtrusionSimulator.xsp
Normal file
|
@ -0,0 +1,50 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/ExtrusionSimulator.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionSimulator} class ExtrusionSimulator {
|
||||
~ExtrusionSimulator();
|
||||
%name{_new} ExtrusionSimulator();
|
||||
|
||||
Clone<ExtrusionSimulator> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
|
||||
void set_image_size(Point *image_size)
|
||||
%code{% THIS->set_image_size(*image_size); %};
|
||||
void set_viewport(BoundingBox *viewport)
|
||||
%code{% THIS->set_viewport(*viewport); %};
|
||||
void set_bounding_box(BoundingBox *bbox)
|
||||
%code{% THIS->set_bounding_box(*bbox); %};
|
||||
|
||||
void reset_accumulator();
|
||||
void extrude_to_accumulator(ExtrusionPath *path, Point *shift, ExtrusionSimulationType simulationType)
|
||||
%code{% THIS->extrude_to_accumulator(*path, *shift, simulationType); %};
|
||||
void evaluate_accumulator(ExtrusionSimulationType simulationType);
|
||||
void* image_ptr()
|
||||
%code{% RETVAL = const_cast<void*>(const_cast<Slic3r::ExtrusionSimulator*>(THIS)->image_ptr()); %};
|
||||
|
||||
%{
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%package{Slic3r::ExtrusionSimulator};
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
EXTRSIM_SIMPLE = ExtrusionSimulationSimple
|
||||
EXTRSIM_DONT_SPREAD = ExtrusionSimulationDontSpread
|
||||
EXTRSIM_SPREAD_NFULL = ExtrisopmSimulationSpreadNotOverfilled
|
||||
EXTRSIM_SPREAD_FULL = ExtrusionSimulationSpreadFull
|
||||
EXTRSIM_SPREAD_EXCESS = ExtrusionSimulationSpreadExcess
|
||||
PROTOTYPE:
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
%}
|
65
xs/xsp/Filler.xsp
Normal file
65
xs/xsp/Filler.xsp
Normal file
|
@ -0,0 +1,65 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Fill/Fill.hpp"
|
||||
#include "libslic3r/ExtrusionEntity.hpp"
|
||||
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Filler} class Filler {
|
||||
~Filler();
|
||||
|
||||
void set_bounding_box(BoundingBox *bbox)
|
||||
%code{% THIS->fill->set_bounding_box(*bbox); %};
|
||||
void set_spacing(coordf_t spacing)
|
||||
%code{% THIS->fill->spacing = spacing; %};
|
||||
coordf_t spacing()
|
||||
%code{% RETVAL = THIS->fill->spacing; %};
|
||||
void set_layer_id(size_t layer_id)
|
||||
%code{% THIS->fill->layer_id = layer_id; %};
|
||||
void set_z(coordf_t z)
|
||||
%code{% THIS->fill->z = z; %};
|
||||
void set_angle(float angle)
|
||||
%code{% THIS->fill->angle = angle; %};
|
||||
void set_link_max_length(coordf_t len)
|
||||
%code{% THIS->fill->link_max_length = len; %};
|
||||
void set_loop_clipping(coordf_t clipping)
|
||||
%code{% THIS->fill->loop_clipping = clipping; %};
|
||||
|
||||
bool use_bridge_flow()
|
||||
%code{% RETVAL = THIS->fill->use_bridge_flow(); %};
|
||||
bool no_sort()
|
||||
%code{% RETVAL = THIS->fill->no_sort(); %};
|
||||
|
||||
void set_density(float density)
|
||||
%code{% THIS->params.density = density; %};
|
||||
void set_dont_adjust(bool dont_adjust)
|
||||
%code{% THIS->params.dont_adjust = dont_adjust; %};
|
||||
|
||||
PolylineCollection* _fill_surface(Surface *surface)
|
||||
%code{%
|
||||
PolylineCollection *pc = NULL;
|
||||
if (THIS->fill != NULL) {
|
||||
pc = new PolylineCollection();
|
||||
pc->polylines = THIS->fill->fill_surface(surface, THIS->params);
|
||||
}
|
||||
RETVAL = pc;
|
||||
%};
|
||||
|
||||
%{
|
||||
|
||||
Filler*
|
||||
new_from_type(CLASS, type)
|
||||
char* CLASS;
|
||||
std::string type;
|
||||
CODE:
|
||||
Filler *filler = new Filler();
|
||||
filler->fill = Fill::new_from_type(type);
|
||||
RETVAL = filler;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
|
||||
};
|
60
xs/xsp/Flow.xsp
Normal file
60
xs/xsp/Flow.xsp
Normal file
|
@ -0,0 +1,60 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Flow.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Flow} class Flow {
|
||||
~Flow();
|
||||
%name{_new} Flow(float width, float height, float nozzle_diameter);
|
||||
Clone<Flow> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
|
||||
float width();
|
||||
float height();
|
||||
float nozzle_diameter();
|
||||
bool bridge();
|
||||
float spacing();
|
||||
int scaled_width();
|
||||
int scaled_spacing();
|
||||
double mm3_per_mm();
|
||||
%{
|
||||
|
||||
Flow*
|
||||
_new_from_width(CLASS, role, width, nozzle_diameter, height)
|
||||
char* CLASS;
|
||||
FlowRole role;
|
||||
std::string width;
|
||||
float nozzle_diameter;
|
||||
float height;
|
||||
CODE:
|
||||
ConfigOptionFloatOrPercent optwidth;
|
||||
optwidth.deserialize(width, ForwardCompatibilitySubstitutionRule::Disable);
|
||||
RETVAL = new Flow(Flow::new_from_config_width(role, optwidth, nozzle_diameter, height));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%package{Slic3r::Flow};
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
FLOW_ROLE_EXTERNAL_PERIMETER = frExternalPerimeter
|
||||
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
|
||||
|
||||
%}
|
||||
|
53
xs/xsp/GCode.xsp
Normal file
53
xs/xsp/GCode.xsp
Normal file
|
@ -0,0 +1,53 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/GCode.hpp"
|
||||
#include "libslic3r/GCode/CoolingBuffer.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::GCode::CoolingBuffer} class CoolingBuffer {
|
||||
CoolingBuffer(GCode* gcode)
|
||||
%code{% RETVAL = new CoolingBuffer(*gcode); %};
|
||||
~CoolingBuffer();
|
||||
std::string process_layer(std::string gcode, size_t layer_id)
|
||||
%code{% RETVAL = THIS->process_layer(std::move(gcode), layer_id, true); %};
|
||||
|
||||
};
|
||||
|
||||
%name{Slic3r::GCode} class GCode {
|
||||
GCode();
|
||||
~GCode();
|
||||
void do_export(Print *print, const char *path)
|
||||
%code%{
|
||||
try {
|
||||
THIS->do_export(print, path);
|
||||
} catch (std::exception& e) {
|
||||
croak("%s\n", e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
Ref<Vec2d> origin()
|
||||
%code{% RETVAL = &(THIS->origin()); %};
|
||||
void set_origin(Vec2d* pointf)
|
||||
%code{% THIS->set_origin(*pointf); %};
|
||||
Ref<Point> last_pos()
|
||||
%code{% RETVAL = &(THIS->last_pos()); %};
|
||||
|
||||
unsigned int layer_count() const;
|
||||
void set_layer_count(unsigned int value);
|
||||
void set_extruders(std::vector<unsigned int> extruders)
|
||||
%code{% THIS->writer().set_extruders(extruders); THIS->writer().set_extruder(0); %};
|
||||
|
||||
void apply_print_config(StaticPrintConfig* print_config)
|
||||
%code{%
|
||||
if (const PrintConfig* config = dynamic_cast<PrintConfig*>(print_config)) {
|
||||
THIS->apply_print_config(*config);
|
||||
} else {
|
||||
CONFESS("A PrintConfig object was not supplied to apply_print_config()");
|
||||
}
|
||||
%};
|
||||
|
||||
Ref<StaticPrintConfig> config()
|
||||
%code{% RETVAL = const_cast<StaticPrintConfig*>(static_cast<const StaticPrintConfig*>(static_cast<const PrintObjectConfig*>(&THIS->config()))); %};
|
||||
};
|
24
xs/xsp/GCodeSender.xsp
Normal file
24
xs/xsp/GCodeSender.xsp
Normal file
|
@ -0,0 +1,24 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/GCodeSender.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::GCode::Sender} class GCodeSender {
|
||||
GCodeSender();
|
||||
~GCodeSender();
|
||||
|
||||
bool connect(std::string port, unsigned int baud_rate);
|
||||
void disconnect();
|
||||
bool is_connected();
|
||||
bool wait_connected(unsigned int timeout = 3);
|
||||
int queue_size();
|
||||
void send(std::string s, bool priority = false);
|
||||
void pause_queue();
|
||||
void resume_queue();
|
||||
void purge_queue(bool priority = false);
|
||||
std::vector<std::string> purge_log();
|
||||
std::string getT();
|
||||
std::string getB();
|
||||
};
|
113
xs/xsp/Geometry.xsp
Normal file
113
xs/xsp/Geometry.xsp
Normal file
|
@ -0,0 +1,113 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/Geometry/ConvexHull.hpp"
|
||||
#include "libslic3r/ShortestPath.hpp"
|
||||
%}
|
||||
|
||||
|
||||
%package{Slic3r::Geometry};
|
||||
|
||||
Pointfs arrange(size_t total_parts, Vec2d* part, coordf_t dist, BoundingBoxf* bb = NULL)
|
||||
%code{%
|
||||
Pointfs points;
|
||||
if (! Slic3r::Geometry::arrange(total_parts, *part, dist, bb, points))
|
||||
CONFESS("%zu parts won't fit in your print area!\n", total_parts);
|
||||
RETVAL = points;
|
||||
%};
|
||||
|
||||
%{
|
||||
|
||||
bool
|
||||
directions_parallel(angle1, angle2)
|
||||
double angle1
|
||||
double angle2
|
||||
CODE:
|
||||
RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
bool
|
||||
directions_parallel_within(angle1, angle2, max_diff)
|
||||
double angle1
|
||||
double angle2
|
||||
double max_diff
|
||||
CODE:
|
||||
RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2, max_diff);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Clone<Polygon>
|
||||
convex_hull(points)
|
||||
Points points
|
||||
CODE:
|
||||
RETVAL = Slic3r::Geometry::convex_hull(points);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
std::vector<Points::size_type>
|
||||
chained_path(points)
|
||||
Points points
|
||||
CODE:
|
||||
RETVAL = chain_points(points);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
std::vector<Points::size_type>
|
||||
chained_path_from(points, start_from)
|
||||
Points points
|
||||
Point* start_from
|
||||
CODE:
|
||||
RETVAL = chain_points(points, start_from);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
double
|
||||
rad2deg(angle)
|
||||
double angle
|
||||
CODE:
|
||||
RETVAL = Slic3r::Geometry::rad2deg(angle);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
double
|
||||
rad2deg_dir(angle)
|
||||
double angle
|
||||
CODE:
|
||||
RETVAL = Slic3r::Geometry::rad2deg_dir(angle);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
double
|
||||
deg2rad(angle)
|
||||
double angle
|
||||
CODE:
|
||||
RETVAL = Slic3r::Geometry::deg2rad(angle);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygons
|
||||
simplify_polygons(polygons, tolerance)
|
||||
Polygons polygons
|
||||
double tolerance
|
||||
CODE:
|
||||
Slic3r::Geometry::simplify_polygons(polygons, tolerance, &RETVAL);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
X = X
|
||||
Y = Y
|
||||
Z = Z
|
||||
PROTOTYPE:
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
%}
|
||||
|
119
xs/xsp/Layer.xsp
Normal file
119
xs/xsp/Layer.xsp
Normal file
|
@ -0,0 +1,119 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Layer.hpp"
|
||||
#include "libslic3r/ExPolygonCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Layer::Region} class LayerRegion {
|
||||
// owned by Layer, no constructor/destructor
|
||||
|
||||
Ref<Layer> layer();
|
||||
Ref<PrintRegion> region()
|
||||
%code%{ RETVAL = &THIS->region(); %};
|
||||
|
||||
Ref<SurfaceCollection> slices()
|
||||
%code%{ RETVAL = &THIS->slices; %};
|
||||
Ref<ExtrusionEntityCollection> thin_fills()
|
||||
%code%{ RETVAL = &THIS->thin_fills; %};
|
||||
Ref<SurfaceCollection> fill_surfaces()
|
||||
%code%{ RETVAL = &THIS->fill_surfaces; %};
|
||||
Ref<ExtrusionEntityCollection> perimeters()
|
||||
%code%{ RETVAL = &THIS->perimeters; %};
|
||||
Ref<ExtrusionEntityCollection> fills()
|
||||
%code%{ RETVAL = &THIS->fills; %};
|
||||
|
||||
Clone<Flow> flow(FlowRole role)
|
||||
%code%{ RETVAL = THIS->flow(role); %};
|
||||
void prepare_fill_surfaces();
|
||||
void make_perimeters(SurfaceCollection* slices, SurfaceCollection* fill_surfaces)
|
||||
%code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
|
||||
double infill_area_threshold();
|
||||
|
||||
void export_region_slices_to_svg(const char *path) const;
|
||||
void export_region_fill_surfaces_to_svg(const char *path) const;
|
||||
void export_region_slices_to_svg_debug(const char *name) const;
|
||||
void export_region_fill_surfaces_to_svg_debug(const char *name) const;
|
||||
};
|
||||
|
||||
%name{Slic3r::Layer} class Layer {
|
||||
// owned by PrintObject, no constructor/destructor
|
||||
|
||||
Ref<Layer> as_layer()
|
||||
%code%{ RETVAL = THIS; %};
|
||||
|
||||
int id();
|
||||
void set_id(int id);
|
||||
Ref<PrintObject> object();
|
||||
bool slicing_errors()
|
||||
%code%{ RETVAL = THIS->slicing_errors; %};
|
||||
coordf_t slice_z()
|
||||
%code%{ RETVAL = THIS->slice_z; %};
|
||||
coordf_t print_z()
|
||||
%code%{ RETVAL = THIS->print_z; %};
|
||||
coordf_t height()
|
||||
%code%{ RETVAL = THIS->height; %};
|
||||
|
||||
size_t region_count();
|
||||
Ref<LayerRegion> get_region(int idx);
|
||||
Ref<LayerRegion> add_region(PrintRegion* print_region);
|
||||
|
||||
ExPolygonCollection* slices()
|
||||
%code%{ RETVAL = new ExPolygonCollection(THIS->lslices); %};
|
||||
|
||||
int ptr()
|
||||
%code%{ RETVAL = (int)(intptr_t)THIS; %};
|
||||
|
||||
Ref<SupportLayer> as_support_layer()
|
||||
%code%{ RETVAL = dynamic_cast<SupportLayer*>(THIS); %};
|
||||
|
||||
void make_slices();
|
||||
void backup_untyped_slices();
|
||||
void restore_untyped_slices();
|
||||
void make_perimeters();
|
||||
void make_fills();
|
||||
|
||||
void export_region_slices_to_svg(const char *path);
|
||||
void export_region_fill_surfaces_to_svg(const char *path);
|
||||
void export_region_slices_to_svg_debug(const char *name);
|
||||
void export_region_fill_surfaces_to_svg_debug(const char *name);
|
||||
};
|
||||
|
||||
%name{Slic3r::Layer::Support} class SupportLayer {
|
||||
// owned by PrintObject, no constructor/destructor
|
||||
|
||||
Ref<Layer> as_layer()
|
||||
%code%{ RETVAL = THIS; %};
|
||||
|
||||
Ref<ExPolygonCollection> support_islands()
|
||||
%code%{ RETVAL = &THIS->support_islands; %};
|
||||
Ref<ExtrusionEntityCollection> support_fills()
|
||||
%code%{ RETVAL = &THIS->support_fills; %};
|
||||
|
||||
// copies of some Layer methods, because the parameter wrapper code
|
||||
// gets confused about getting a Layer::Support instead of a Layer
|
||||
int id();
|
||||
void set_id(int id);
|
||||
Ref<PrintObject> object();
|
||||
bool slicing_errors()
|
||||
%code%{ RETVAL = THIS->slicing_errors; %};
|
||||
coordf_t slice_z()
|
||||
%code%{ RETVAL = THIS->slice_z; %};
|
||||
coordf_t print_z()
|
||||
%code%{ RETVAL = THIS->print_z; %};
|
||||
coordf_t height()
|
||||
%code%{ RETVAL = THIS->height; %};
|
||||
|
||||
size_t region_count();
|
||||
Ref<LayerRegion> get_region(int idx);
|
||||
Ref<LayerRegion> add_region(PrintRegion* print_region);
|
||||
|
||||
ExPolygonCollection* slices()
|
||||
%code%{ RETVAL = new ExPolygonCollection(THIS->lslices); %};
|
||||
|
||||
void export_region_slices_to_svg(const char *path);
|
||||
void export_region_fill_surfaces_to_svg(const char *path);
|
||||
void export_region_slices_to_svg_debug(const char *name);
|
||||
void export_region_fill_surfaces_to_svg_debug(const char *name);
|
||||
};
|
92
xs/xsp/Line.xsp
Normal file
92
xs/xsp/Line.xsp
Normal file
|
@ -0,0 +1,92 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Line.hpp"
|
||||
#include "libslic3r/Polyline.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Line} class Line {
|
||||
~Line();
|
||||
Clone<Line> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_AV(THIS); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
Ref<Point> a()
|
||||
%code{% RETVAL=&THIS->a; %};
|
||||
Ref<Point> b()
|
||||
%code{% RETVAL=&THIS->b; %};
|
||||
void reverse();
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
double length();
|
||||
double atan2_();
|
||||
double orientation();
|
||||
double direction();
|
||||
bool parallel_to(double angle);
|
||||
bool parallel_to_line(Line* line)
|
||||
%code{% RETVAL = THIS->parallel_to(*line); %};
|
||||
Clone<Point> midpoint();
|
||||
Clone<Point> intersection_infinite(Line* other)
|
||||
%code{%
|
||||
Point p;
|
||||
bool res = THIS->intersection_infinite(*other, &p);
|
||||
if (!res) CONFESS("Intersection failed");
|
||||
RETVAL = p;
|
||||
%};
|
||||
Polyline* as_polyline()
|
||||
%code{% RETVAL = new Polyline(THIS->a, THIS->b); %};
|
||||
Clone<Point> normal();
|
||||
Clone<Point> vector();
|
||||
double ccw(Point* point)
|
||||
%code{% RETVAL = THIS->ccw(*point); %};
|
||||
%{
|
||||
|
||||
Line*
|
||||
Line::new(...)
|
||||
CODE:
|
||||
RETVAL = new Line ();
|
||||
// ST(0) is class name, ST(1) and ST(2) are endpoints
|
||||
from_SV_check(ST(1), &RETVAL->a);
|
||||
from_SV_check(ST(2), &RETVAL->b);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
Line::rotate(angle, center_sv)
|
||||
double angle;
|
||||
SV* center_sv;
|
||||
CODE:
|
||||
Point center;
|
||||
from_SV_check(center_sv, ¢er);
|
||||
THIS->rotate(angle, center);
|
||||
|
||||
bool
|
||||
Line::coincides_with(line_sv)
|
||||
SV* line_sv;
|
||||
CODE:
|
||||
Line line;
|
||||
from_SV_check(line_sv, &line);
|
||||
RETVAL = (*THIS) == line;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
|
||||
%name{Slic3r::Linef3} class Linef3 {
|
||||
Linef3(Vec3d* a, Vec3d* b)
|
||||
%code{% RETVAL = new Linef3(*a, *b); %};
|
||||
~Linef3();
|
||||
Clone<Linef3> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
Ref<Vec3d> a()
|
||||
%code{% RETVAL = &THIS->a; %};
|
||||
Ref<Vec3d> b()
|
||||
%code{% RETVAL = &THIS->b; %};
|
||||
Clone<Vec3d> intersect_plane(double z);
|
||||
void scale(double factor);
|
||||
};
|
296
xs/xsp/Model.xsp
Normal file
296
xs/xsp/Model.xsp
Normal file
|
@ -0,0 +1,296 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/ModelArrange.hpp"
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "libslic3r/Slicing.hpp"
|
||||
#include "libslic3r/Format/AMF.hpp"
|
||||
#include "libslic3r/Format/3mf.hpp"
|
||||
#include "libslic3r/Format/OBJ.hpp"
|
||||
#include "libslic3r/Format/STL.hpp"
|
||||
#include "libslic3r/PresetBundle.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Model} class Model {
|
||||
Model();
|
||||
~Model();
|
||||
|
||||
%name{read_from_file} Model(std::string input_file, bool add_default_instances = true)
|
||||
%code%{
|
||||
try {
|
||||
RETVAL = new Model(Model::read_from_file(input_file, nullptr, nullptr, only_if(add_default_instances, Model::LoadAttribute::AddDefaultInstances)));
|
||||
} catch (std::exception& e) {
|
||||
croak("Error while opening %s: %s\n", input_file.c_str(), e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
Clone<Model> clone()
|
||||
%code%{ RETVAL = THIS; %};
|
||||
|
||||
%name{_add_object} Ref<ModelObject> add_object();
|
||||
Ref<ModelObject> _add_object_clone(ModelObject* other, bool copy_volumes = true)
|
||||
%code%{ auto ptr = THIS->add_object(*other); if (! copy_volumes) ptr->clear_volumes(); RETVAL = ptr; %};
|
||||
void delete_object(size_t idx);
|
||||
void clear_objects();
|
||||
size_t objects_count()
|
||||
%code%{ RETVAL = THIS->objects.size(); %};
|
||||
Ref<ModelObject> get_object(int idx)
|
||||
%code%{ RETVAL = THIS->objects.at(idx); %};
|
||||
|
||||
Ref<ModelMaterial> get_material(t_model_material_id material_id)
|
||||
%code%{
|
||||
RETVAL = THIS->get_material(material_id);
|
||||
if (RETVAL == NULL) {
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
%};
|
||||
|
||||
%name{add_material} Ref<ModelMaterial> add_material(t_model_material_id material_id);
|
||||
Ref<ModelMaterial> add_material_clone(t_model_material_id material_id, ModelMaterial* other)
|
||||
%code%{ RETVAL = THIS->add_material(material_id, *other); %};
|
||||
bool has_material(t_model_material_id material_id) const
|
||||
%code%{
|
||||
RETVAL = (THIS->get_material(material_id) != NULL);
|
||||
%};
|
||||
void delete_material(t_model_material_id material_id);
|
||||
void clear_materials();
|
||||
|
||||
std::vector<std::string> material_names() const
|
||||
%code%{
|
||||
for (ModelMaterialMap::iterator i = THIS->materials.begin();
|
||||
i != THIS->materials.end(); ++i)
|
||||
{
|
||||
RETVAL.push_back(i->first);
|
||||
}
|
||||
%};
|
||||
|
||||
size_t material_count() const
|
||||
%code%{ RETVAL = THIS->materials.size(); %};
|
||||
|
||||
bool add_default_instances();
|
||||
Clone<BoundingBoxf3> bounding_box();
|
||||
void center_instances_around_point(Vec2d* point)
|
||||
%code%{ THIS->center_instances_around_point(*point); %};
|
||||
void translate(double x, double y, double z);
|
||||
Clone<TriangleMesh> mesh();
|
||||
|
||||
ModelObjectPtrs* objects()
|
||||
%code%{ RETVAL = &THIS->objects; %};
|
||||
|
||||
bool arrange_objects(double dist, BoundingBoxf* bb = NULL) %code%{ ArrangeParams ap{scaled(dist)}; if (bb) arrange_objects(*THIS, scaled(*bb), ap); else arrange_objects(*THIS, InfiniteBed{}, ap); %};
|
||||
void duplicate(unsigned int copies_num, double dist, BoundingBoxf* bb = NULL) %code%{ ArrangeParams ap{scaled(dist)}; if (bb) duplicate(*THIS, copies_num, scaled(*bb), ap); else duplicate(*THIS, copies_num, InfiniteBed{}, ap); %};
|
||||
void duplicate_objects(unsigned int copies_num, double dist, BoundingBoxf* bb = NULL) %code%{ ArrangeParams ap{scaled(dist)}; if (bb) duplicate_objects(*THIS, copies_num, scaled(*bb), ap); else duplicate_objects(*THIS, copies_num, InfiniteBed{}, ap); %};
|
||||
void duplicate_objects_grid(unsigned int x, unsigned int y, double dist);
|
||||
|
||||
bool looks_like_multipart_object() const;
|
||||
void convert_multipart_object(unsigned int max_extruders);
|
||||
|
||||
bool store_stl(char *path, bool binary)
|
||||
%code%{ TriangleMesh mesh = THIS->mesh(); RETVAL = Slic3r::store_stl(path, &mesh, binary); %};
|
||||
|
||||
%{
|
||||
|
||||
Model*
|
||||
load_stl(CLASS, path, object_name)
|
||||
char* CLASS;
|
||||
char* path;
|
||||
char* object_name;
|
||||
CODE:
|
||||
RETVAL = new Model();
|
||||
if (! load_stl(path, RETVAL, object_name)) {
|
||||
delete RETVAL;
|
||||
RETVAL = NULL;
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%name{Slic3r::Model::Material} class ModelMaterial {
|
||||
Ref<Model> model()
|
||||
%code%{ RETVAL = THIS->get_model(); %};
|
||||
|
||||
Ref<DynamicPrintConfig> config()
|
||||
%code%{ RETVAL = &const_cast<DynamicPrintConfig&>(THIS->config.get()); %};
|
||||
|
||||
std::string get_attribute(std::string name)
|
||||
%code%{ if (THIS->attributes.find(name) != THIS->attributes.end()) RETVAL = THIS->attributes[name]; %};
|
||||
|
||||
void set_attribute(std::string name, std::string value)
|
||||
%code%{ THIS->attributes[name] = value; %};
|
||||
|
||||
%{
|
||||
|
||||
SV*
|
||||
ModelMaterial::attributes()
|
||||
CODE:
|
||||
HV* hv = newHV();
|
||||
for (t_model_material_attributes::const_iterator attr = THIS->attributes.begin(); attr != THIS->attributes.end(); ++attr) {
|
||||
(void)hv_store( hv, attr->first.c_str(), attr->first.length(), newSVpv(attr->second.c_str(), attr->second.length()), 0 );
|
||||
}
|
||||
RETVAL = (SV*)newRV_noinc((SV*)hv);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
%}
|
||||
|
||||
};
|
||||
|
||||
|
||||
%name{Slic3r::Model::Object} class ModelObject {
|
||||
ModelVolumePtrs* volumes()
|
||||
%code%{ RETVAL = &THIS->volumes; %};
|
||||
|
||||
ModelInstancePtrs* instances()
|
||||
%code%{ RETVAL = &THIS->instances; %};
|
||||
|
||||
void invalidate_bounding_box();
|
||||
Clone<TriangleMesh> mesh();
|
||||
Clone<TriangleMesh> raw_mesh();
|
||||
Clone<BoundingBoxf3> instance_bounding_box(int idx)
|
||||
%code%{ RETVAL = THIS->instance_bounding_box(idx, true); %};
|
||||
Clone<BoundingBoxf3> bounding_box();
|
||||
|
||||
%name{_add_volume} Ref<ModelVolume> add_volume(TriangleMesh* mesh)
|
||||
%code%{ RETVAL = THIS->add_volume(*mesh); %};
|
||||
Ref<ModelVolume> _add_volume_clone(ModelVolume* other)
|
||||
%code%{ RETVAL = THIS->add_volume(*other); %};
|
||||
|
||||
void delete_volume(size_t idx);
|
||||
void clear_volumes();
|
||||
int volumes_count()
|
||||
%code%{ RETVAL = THIS->volumes.size(); %};
|
||||
Ref<ModelVolume> get_volume(int idx)
|
||||
%code%{ RETVAL = THIS->volumes.at(idx); %};
|
||||
bool move_volume_up(int idx)
|
||||
%code%{
|
||||
if (idx > 0 && idx < int(THIS->volumes.size())) {
|
||||
std::swap(THIS->volumes[idx-1], THIS->volumes[idx]);
|
||||
RETVAL = true;
|
||||
} else
|
||||
RETVAL = false;
|
||||
%};
|
||||
bool move_volume_down(int idx)
|
||||
%code%{
|
||||
if (idx >= 0 && idx + 1 < int(THIS->volumes.size())) {
|
||||
std::swap(THIS->volumes[idx+1], THIS->volumes[idx]);
|
||||
RETVAL = true;
|
||||
} else
|
||||
RETVAL = false;
|
||||
%};
|
||||
|
||||
%name{_add_instance} Ref<ModelInstance> add_instance();
|
||||
Ref<ModelInstance> _add_instance_clone(ModelInstance* other)
|
||||
%code%{ RETVAL = THIS->add_instance(*other); %};
|
||||
void delete_last_instance();
|
||||
void clear_instances();
|
||||
int instances_count()
|
||||
%code%{ RETVAL = THIS->instances.size(); %};
|
||||
|
||||
std::string name()
|
||||
%code%{ RETVAL = THIS->name; %};
|
||||
void set_name(std::string value)
|
||||
%code%{ THIS->name = value; %};
|
||||
std::string input_file()
|
||||
%code%{ RETVAL = THIS->input_file; %};
|
||||
void set_input_file(std::string value)
|
||||
%code%{ THIS->input_file = value; %};
|
||||
Ref<DynamicPrintConfig> config()
|
||||
%code%{ RETVAL = &const_cast<DynamicPrintConfig&>(THIS->config.get()); %};
|
||||
|
||||
Ref<Model> model()
|
||||
%code%{ RETVAL = THIS->get_model(); %};
|
||||
|
||||
Ref<Vec3d> origin_translation()
|
||||
%code%{ RETVAL = &THIS->origin_translation; %};
|
||||
void set_origin_translation(Vec3d* point)
|
||||
%code%{ THIS->origin_translation = *point; %};
|
||||
|
||||
void ensure_on_bed();
|
||||
int materials_count() const;
|
||||
int facets_count();
|
||||
void center_around_origin();
|
||||
void translate(double x, double y, double z);
|
||||
void scale_xyz(Vec3d* versor)
|
||||
%code{% THIS->scale(*versor); %};
|
||||
void rotate(float angle, Vec3d* axis)
|
||||
%code{% THIS->rotate(angle, *axis); %};
|
||||
void mirror(Axis axis);
|
||||
|
||||
};
|
||||
|
||||
|
||||
%name{Slic3r::Model::Volume} class ModelVolume {
|
||||
Ref<ModelObject> object()
|
||||
%code%{ RETVAL = THIS->get_object(); %};
|
||||
|
||||
std::string name()
|
||||
%code%{ RETVAL = THIS->name; %};
|
||||
void set_name(std::string value)
|
||||
%code%{ THIS->name = value; %};
|
||||
t_model_material_id material_id();
|
||||
void set_material_id(t_model_material_id material_id)
|
||||
%code%{ THIS->set_material_id(material_id); %};
|
||||
Ref<ModelMaterial> material();
|
||||
|
||||
Ref<DynamicPrintConfig> config()
|
||||
%code%{ RETVAL = &const_cast<DynamicPrintConfig&>(THIS->config.get()); %};
|
||||
Ref<TriangleMesh> mesh()
|
||||
%code%{ RETVAL = &THIS->mesh(); %};
|
||||
|
||||
bool modifier()
|
||||
%code%{ RETVAL = THIS->is_modifier(); %};
|
||||
void set_modifier(bool modifier)
|
||||
%code%{ THIS->set_type(modifier ? ModelVolumeType::PARAMETER_MODIFIER : ModelVolumeType::MODEL_PART); %};
|
||||
bool model_part()
|
||||
%code%{ RETVAL = THIS->is_model_part(); %};
|
||||
bool support_enforcer()
|
||||
%code%{ RETVAL = THIS->is_support_enforcer(); %};
|
||||
void set_support_enforcer()
|
||||
%code%{ THIS->set_type(ModelVolumeType::SUPPORT_ENFORCER); %};
|
||||
bool support_blocker()
|
||||
%code%{ RETVAL = THIS->is_support_blocker(); %};
|
||||
void set_support_blocker()
|
||||
%code%{ THIS->set_type(ModelVolumeType::SUPPORT_BLOCKER); %};
|
||||
|
||||
size_t split(unsigned int max_extruders);
|
||||
};
|
||||
|
||||
|
||||
%name{Slic3r::Model::Instance} class ModelInstance {
|
||||
Ref<ModelObject> object()
|
||||
%code%{ RETVAL = THIS->get_object(); %};
|
||||
|
||||
Vec3d* rotation()
|
||||
%code%{ RETVAL = new Vec3d(THIS->get_rotation(X), THIS->get_rotation(Y), THIS->get_rotation(Z)); %};
|
||||
|
||||
Vec3d* scaling_factor()
|
||||
%code%{ RETVAL = new Vec3d(THIS->get_scaling_factor(X), THIS->get_scaling_factor(Y), THIS->get_scaling_factor(Z)); %};
|
||||
|
||||
Vec2d* offset()
|
||||
%code%{ RETVAL = new Vec2d(THIS->get_offset(X), THIS->get_offset(Y)); %};
|
||||
|
||||
void set_rotation(double val)
|
||||
%code%{ THIS->set_rotation(Z, val); THIS->get_object()->invalidate_bounding_box(); %};
|
||||
|
||||
void set_rotations(Vec3d *rotation)
|
||||
%code%{ THIS->set_rotation(*rotation); THIS->get_object()->invalidate_bounding_box(); %};
|
||||
|
||||
void set_scaling_factor(double val)
|
||||
%code%{ THIS->set_scaling_factor(X, val); THIS->set_scaling_factor(Y, val); THIS->set_scaling_factor(Z, val); THIS->get_object()->invalidate_bounding_box(); %};
|
||||
|
||||
void set_scaling_factors(Vec3d *scale)
|
||||
%code%{ THIS->set_scaling_factor(*scale); THIS->get_object()->invalidate_bounding_box(); %};
|
||||
|
||||
void set_offset(Vec2d *offset)
|
||||
%code%{
|
||||
THIS->set_offset(X, (*offset)(0));
|
||||
THIS->set_offset(Y, (*offset)(1));
|
||||
%};
|
||||
|
||||
void transform_mesh(TriangleMesh* mesh, bool dont_translate = false) const;
|
||||
void transform_polygon(Polygon* polygon) const;
|
||||
};
|
40
xs/xsp/PerimeterGenerator.xsp
Normal file
40
xs/xsp/PerimeterGenerator.xsp
Normal file
|
@ -0,0 +1,40 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/PerimeterGenerator.hpp"
|
||||
#include "libslic3r/Layer.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Layer::PerimeterGenerator} class PerimeterGenerator {
|
||||
PerimeterGenerator(SurfaceCollection* slices, double layer_height, Flow* flow,
|
||||
StaticPrintConfig* region_config, StaticPrintConfig* object_config,
|
||||
StaticPrintConfig* print_config, ExtrusionEntityCollection* loops,
|
||||
ExtrusionEntityCollection* gap_fill,
|
||||
SurfaceCollection* fill_surfaces)
|
||||
%code{% RETVAL = new PerimeterGenerator(slices, layer_height, *flow,
|
||||
dynamic_cast<PrintRegionConfig*>(region_config),
|
||||
dynamic_cast<PrintObjectConfig*>(object_config),
|
||||
dynamic_cast<PrintConfig*>(print_config),
|
||||
false,
|
||||
loops, gap_fill, fill_surfaces); %};
|
||||
~PerimeterGenerator();
|
||||
|
||||
void set_lower_slices(ExPolygonCollection* lower_slices)
|
||||
%code{% THIS->lower_slices = &lower_slices->expolygons; %};
|
||||
void set_layer_id(int layer_id)
|
||||
%code{% THIS->layer_id = layer_id; %};
|
||||
void set_perimeter_flow(Flow* flow)
|
||||
%code{% THIS->perimeter_flow = *flow; %};
|
||||
void set_ext_perimeter_flow(Flow* flow)
|
||||
%code{% THIS->ext_perimeter_flow = *flow; %};
|
||||
void set_overhang_flow(Flow* flow)
|
||||
%code{% THIS->overhang_flow = *flow; %};
|
||||
void set_solid_infill_flow(Flow* flow)
|
||||
%code{% THIS->solid_infill_flow = *flow; %};
|
||||
|
||||
Ref<StaticPrintConfig> config()
|
||||
%code{% RETVAL = THIS->config; %};
|
||||
|
||||
void process();
|
||||
};
|
33
xs/xsp/PlaceholderParser.xsp
Normal file
33
xs/xsp/PlaceholderParser.xsp
Normal file
|
@ -0,0 +1,33 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include <vector>
|
||||
#include "libslic3r/PlaceholderParser.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::GCode::PlaceholderParser} class PlaceholderParser {
|
||||
PlaceholderParser();
|
||||
~PlaceholderParser();
|
||||
|
||||
void apply_config(DynamicPrintConfig *config)
|
||||
%code%{ THIS->apply_config(*config); %};
|
||||
void set(std::string key, int value);
|
||||
std::string process(std::string str) const
|
||||
%code%{
|
||||
try {
|
||||
RETVAL = THIS->process(str, 0);
|
||||
} catch (std::exception& e) {
|
||||
croak("%s\n", e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
bool evaluate_boolean_expression(const char *str) const
|
||||
%code%{
|
||||
try {
|
||||
RETVAL = THIS->evaluate_boolean_expression(str, THIS->config());
|
||||
} catch (std::exception& e) {
|
||||
croak("%s\n", e.what());
|
||||
}
|
||||
%};
|
||||
};
|
138
xs/xsp/Point.xsp
Normal file
138
xs/xsp/Point.xsp
Normal file
|
@ -0,0 +1,138 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/Line.hpp"
|
||||
#include "libslic3r/Polygon.hpp"
|
||||
#include "libslic3r/Polyline.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Point} class Point {
|
||||
Point(int _x = 0, int _y = 0);
|
||||
~Point();
|
||||
Clone<Point> clone()
|
||||
%code{% RETVAL=THIS; %};
|
||||
void scale(double factor)
|
||||
%code{% *THIS *= factor; %};
|
||||
void translate(double x, double y)
|
||||
%code{% *THIS += Point(x, y); %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
int x()
|
||||
%code{% RETVAL = (*THIS)(0); %};
|
||||
int y()
|
||||
%code{% RETVAL = (*THIS)(1); %};
|
||||
void set_x(int val)
|
||||
%code{% (*THIS)(0) = val; %};
|
||||
void set_y(int val)
|
||||
%code{% (*THIS)(1) = val; %};
|
||||
int nearest_point_index(Points points);
|
||||
Clone<Point> nearest_point(Points points)
|
||||
%code{% Point p; THIS->nearest_point(points, &p); RETVAL = p; %};
|
||||
double distance_to(Point* point)
|
||||
%code{% RETVAL = (*point - *THIS).cast<double>().norm(); %};
|
||||
double distance_to_line(Line* line)
|
||||
%code{% RETVAL = line->distance_to(*THIS); %};
|
||||
double perp_distance_to_line(Line* line)
|
||||
%code{% RETVAL = line->perp_distance_to(*THIS); %};
|
||||
double ccw(Point* p1, Point* p2)
|
||||
%code{% RETVAL = THIS->ccw(*p1, *p2); %};
|
||||
double ccw_angle(Point* p1, Point* p2)
|
||||
%code{% RETVAL = THIS->ccw_angle(*p1, *p2); %};
|
||||
Point* projection_onto_polygon(Polygon* polygon)
|
||||
%code{% RETVAL = new Point(THIS->projection_onto(*polygon)); %};
|
||||
Point* projection_onto_polyline(Polyline* polyline)
|
||||
%code{% RETVAL = new Point(THIS->projection_onto(*polyline)); %};
|
||||
Point* projection_onto_line(Line* line)
|
||||
%code{% RETVAL = new Point(THIS->projection_onto(*line)); %};
|
||||
Point* negative()
|
||||
%code{% RETVAL = new Point(- *THIS); %};
|
||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%ld,%ld", (*THIS)(0), (*THIS)(1)); RETVAL = buf; %};
|
||||
|
||||
%{
|
||||
|
||||
void
|
||||
Point::rotate(angle, center_sv)
|
||||
double angle;
|
||||
SV* center_sv;
|
||||
CODE:
|
||||
Point center;
|
||||
from_SV_check(center_sv, ¢er);
|
||||
THIS->rotate(angle, center);
|
||||
|
||||
bool
|
||||
Point::coincides_with(point_sv)
|
||||
SV* point_sv;
|
||||
CODE:
|
||||
Point point;
|
||||
from_SV_check(point_sv, &point);
|
||||
RETVAL = (*THIS) == point;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
|
||||
};
|
||||
|
||||
%name{Slic3r::Pointf} class Vec2d {
|
||||
Vec2d(double _x = 0, double _y = 0);
|
||||
~Vec2d();
|
||||
Clone<Vec2d> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
double x()
|
||||
%code{% RETVAL = (*THIS)(0); %};
|
||||
double y()
|
||||
%code{% RETVAL = (*THIS)(1); %};
|
||||
void set_x(double val)
|
||||
%code{% (*THIS)(0) = val; %};
|
||||
void set_y(double val)
|
||||
%code{% (*THIS)(1) = val; %};
|
||||
void translate(double x, double y)
|
||||
%code{% *THIS += Vec2d(x, y); %};
|
||||
void scale(double factor)
|
||||
%code{% *THIS *= factor; %};
|
||||
void rotate(double angle, Vec2d* center)
|
||||
%code{% *THIS = Eigen::Translation2d(*center) * Eigen::Rotation2Dd(angle) * Eigen::Translation2d(- *center) * Eigen::Vector2d((*THIS)(0), (*THIS)(1)); %};
|
||||
Vec2d* negative()
|
||||
%code{% RETVAL = new Vec2d(- *THIS); %};
|
||||
Vec2d* vector_to(Vec2d* point)
|
||||
%code{% RETVAL = new Vec2d(*point - *THIS); %};
|
||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf", (*THIS)(0), (*THIS)(1)); RETVAL = buf; %};
|
||||
};
|
||||
|
||||
%name{Slic3r::Pointf3} class Vec3d {
|
||||
Vec3d(double _x = 0, double _y = 0, double _z = 0);
|
||||
~Vec3d();
|
||||
Clone<Vec3d> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
double x()
|
||||
%code{% RETVAL = (*THIS)(0); %};
|
||||
double y()
|
||||
%code{% RETVAL = (*THIS)(1); %};
|
||||
double z()
|
||||
%code{% RETVAL = (*THIS)(2); %};
|
||||
void set_x(double val)
|
||||
%code{% (*THIS)(0) = val; %};
|
||||
void set_y(double val)
|
||||
%code{% (*THIS)(1) = val; %};
|
||||
void set_z(double val)
|
||||
%code{% (*THIS)(2) = val; %};
|
||||
void translate(double x, double y, double z)
|
||||
%code{% *THIS += Vec3d(x, y, z); %};
|
||||
void scale(double factor)
|
||||
%code{% *THIS *= factor; %};
|
||||
double distance_to(Vec3d* point)
|
||||
%code{% RETVAL = (*point - *THIS).norm(); %};
|
||||
Vec3d* negative()
|
||||
%code{% RETVAL = new Vec3d(- *THIS); %};
|
||||
Vec3d* vector_to(Vec3d* point)
|
||||
%code{% RETVAL = new Vec3d(*point - *THIS); %};
|
||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf,%lf", (*THIS)(0), (*THIS)(1), (*THIS)(2)); RETVAL = buf; %};
|
||||
};
|
82
xs/xsp/Polygon.xsp
Normal file
82
xs/xsp/Polygon.xsp
Normal file
|
@ -0,0 +1,82 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/Polygon.hpp"
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Polygon} class Polygon {
|
||||
~Polygon();
|
||||
Clone<Polygon> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_AV(THIS); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void reverse();
|
||||
Lines lines();
|
||||
Clone<Polyline> split_at_vertex(Point* point)
|
||||
%code{% RETVAL = THIS->split_at_vertex(*point); %};
|
||||
Clone<Polyline> split_at_index(int index);
|
||||
Clone<Polyline> split_at_first_point();
|
||||
Points equally_spaced_points(double distance);
|
||||
double length();
|
||||
double area();
|
||||
bool is_counter_clockwise();
|
||||
bool is_clockwise();
|
||||
bool make_counter_clockwise();
|
||||
bool make_clockwise();
|
||||
bool is_valid();
|
||||
Clone<Point> first_point();
|
||||
bool contains_point(Point* point)
|
||||
%code{% RETVAL = THIS->contains(*point); %};
|
||||
Polygons simplify(double tolerance);
|
||||
Polygons triangulate_convex()
|
||||
%code{% THIS->triangulate_convex(&RETVAL); %};
|
||||
Clone<Point> centroid();
|
||||
Clone<BoundingBox> bounding_box();
|
||||
Points concave_points(double angle);
|
||||
Points convex_points(double angle);
|
||||
Clone<Point> point_projection(Point* point)
|
||||
%code{% RETVAL = THIS->point_projection(*point); %};
|
||||
Clone<Point> intersection(Line* line)
|
||||
%code{%
|
||||
Point p;
|
||||
(void)THIS->intersection(*line, &p);
|
||||
RETVAL = p;
|
||||
%};
|
||||
Clone<Point> first_intersection(Line* line)
|
||||
%code{%
|
||||
Point p;
|
||||
(void)THIS->first_intersection(*line, &p);
|
||||
RETVAL = p;
|
||||
%};
|
||||
%{
|
||||
|
||||
Polygon*
|
||||
Polygon::new(...)
|
||||
CODE:
|
||||
RETVAL = new Polygon ();
|
||||
// ST(0) is class name, ST(1) is first point
|
||||
RETVAL->points.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
from_SV_check(ST(i), &RETVAL->points[i-1]);
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
Polygon::rotate(angle, center_sv)
|
||||
double angle;
|
||||
SV* center_sv;
|
||||
CODE:
|
||||
Point center;
|
||||
from_SV_check(center_sv, ¢er);
|
||||
THIS->rotate(angle, center);
|
||||
|
||||
%}
|
||||
};
|
90
xs/xsp/Polyline.xsp
Normal file
90
xs/xsp/Polyline.xsp
Normal file
|
@ -0,0 +1,90 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
#include "libslic3r/Polyline.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Polyline} class Polyline {
|
||||
~Polyline();
|
||||
Clone<Polyline> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = to_AV(THIS); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void pop_back()
|
||||
%code{% THIS->points.pop_back(); %};
|
||||
void reverse();
|
||||
Lines lines();
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
Points equally_spaced_points(double distance);
|
||||
double length();
|
||||
bool is_valid();
|
||||
void clip_end(double distance);
|
||||
void clip_start(double distance);
|
||||
void extend_end(double distance);
|
||||
void extend_start(double distance);
|
||||
void simplify(double tolerance);
|
||||
void split_at(Point* point, Polyline* p1, Polyline* p2)
|
||||
%code{% THIS->split_at(*point, p1, p2); %};
|
||||
bool is_straight();
|
||||
Clone<BoundingBox> bounding_box();
|
||||
void remove_duplicate_points();
|
||||
%{
|
||||
|
||||
Polyline*
|
||||
Polyline::new(...)
|
||||
CODE:
|
||||
RETVAL = new Polyline ();
|
||||
// ST(0) is class name, ST(1) is first point
|
||||
RETVAL->points.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
from_SV_check(ST(i), &RETVAL->points[i-1]);
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
Polyline::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
Point p;
|
||||
from_SV_check(ST(i), &p);
|
||||
THIS->points.push_back(p);
|
||||
}
|
||||
|
||||
void
|
||||
Polyline::append_polyline(polyline)
|
||||
Polyline* polyline;
|
||||
CODE:
|
||||
for (Points::const_iterator it = polyline->points.begin(); it != polyline->points.end(); ++it) {
|
||||
THIS->points.push_back((*it));
|
||||
}
|
||||
|
||||
void
|
||||
Polyline::rotate(angle, center_sv)
|
||||
double angle;
|
||||
SV* center_sv;
|
||||
CODE:
|
||||
Point center;
|
||||
from_SV_check(center_sv, ¢er);
|
||||
THIS->rotate(angle, center);
|
||||
|
||||
Polygons
|
||||
Polyline::grow(delta, joinType = Slic3r::ClipperLib::jtSquare, miterLimit = 3)
|
||||
const float delta
|
||||
Slic3r::ClipperLib::JoinType joinType
|
||||
double miterLimit
|
||||
CODE:
|
||||
RETVAL = offset(*THIS, delta, joinType, miterLimit);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
81
xs/xsp/PolylineCollection.xsp
Normal file
81
xs/xsp/PolylineCollection.xsp
Normal file
|
@ -0,0 +1,81 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
|
||||
#include "libslic3r.h"
|
||||
#include "Polyline.hpp"
|
||||
#include "ShortestPath.hpp"
|
||||
|
||||
%}
|
||||
|
||||
%name{Slic3r::Polyline::Collection} class PolylineCollection {
|
||||
~PolylineCollection();
|
||||
Clone<PolylineCollection> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void clear()
|
||||
%code{% THIS->polylines.clear(); %};
|
||||
PolylineCollection* chained_path(bool no_reverse)
|
||||
%code{%
|
||||
RETVAL = new PolylineCollection();
|
||||
RETVAL->polylines = chain_polylines(THIS->polylines, &THIS->polylines.front().first_point());
|
||||
%};
|
||||
PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
|
||||
%code{%
|
||||
RETVAL = new PolylineCollection();
|
||||
RETVAL->polylines = chain_polylines(THIS->polylines, start_near);
|
||||
%};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->polylines.size(); %};
|
||||
%{
|
||||
|
||||
PolylineCollection*
|
||||
PolylineCollection::new(...)
|
||||
CODE:
|
||||
RETVAL = new PolylineCollection ();
|
||||
// ST(0) is class name, others are Polylines
|
||||
RETVAL->polylines.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
// Note: a COPY of the input is stored
|
||||
from_SV_check(ST(i), &RETVAL->polylines[i-1]);
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
PolylineCollection::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->polylines.size()-1);
|
||||
int i = 0;
|
||||
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
PolylineCollection::pp()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->polylines.size()-1);
|
||||
int i = 0;
|
||||
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) {
|
||||
av_store(av, i++, to_SV_pureperl(&*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
PolylineCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
Polyline polyline;
|
||||
from_SV_check(ST(i), &polyline);
|
||||
THIS->polylines.push_back(polyline);
|
||||
}
|
||||
|
||||
%}
|
||||
};
|
171
xs/xsp/Print.xsp
Normal file
171
xs/xsp/Print.xsp
Normal file
|
@ -0,0 +1,171 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/PlaceholderParser.hpp"
|
||||
%}
|
||||
|
||||
%package{Slic3r::Print::State};
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
STEP_SLICE = posSlice
|
||||
STEP_PERIMETERS = posPerimeters
|
||||
STEP_PREPARE_INFILL = posPrepareInfill
|
||||
STEP_INFILL = posInfill
|
||||
STEP_SUPPORTMATERIAL = posSupportMaterial
|
||||
STEP_SKIRTBRIM = psSkirtBrim
|
||||
STEP_WIPE_TOWER = psWipeTower
|
||||
PROTOTYPE:
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
%}
|
||||
|
||||
%name{Slic3r::Print::Region} class PrintRegion {
|
||||
// owned by Print, no constructor/destructor
|
||||
|
||||
Ref<StaticPrintConfig> config()
|
||||
%code%{ RETVAL = &THIS->config(); %};
|
||||
};
|
||||
|
||||
%name{Slic3r::Print::Object} class PrintObject {
|
||||
// owned by Print, no constructor/destructor
|
||||
|
||||
Ref<Print> print();
|
||||
Ref<ModelObject> model_object();
|
||||
Ref<StaticPrintConfig> config()
|
||||
%code%{ RETVAL = &THIS->config(); %};
|
||||
Clone<BoundingBox> bounding_box();
|
||||
|
||||
size_t layer_count();
|
||||
Ref<Layer> get_layer(int idx);
|
||||
|
||||
size_t support_layer_count();
|
||||
Ref<SupportLayer> get_support_layer(int idx);
|
||||
|
||||
bool step_done(PrintObjectStep step)
|
||||
%code%{ RETVAL = THIS->is_step_done(step); %};
|
||||
|
||||
void slice();
|
||||
};
|
||||
|
||||
%name{Slic3r::Print} class Print {
|
||||
Print();
|
||||
~Print();
|
||||
|
||||
Ref<Model> model()
|
||||
%code%{ RETVAL = const_cast<Model*>(&THIS->model()); %};
|
||||
Ref<StaticPrintConfig> config()
|
||||
%code%{ RETVAL = const_cast<GCodeConfig*>(static_cast<const GCodeConfig*>(&THIS->config())); %};
|
||||
Ref<PlaceholderParser> placeholder_parser()
|
||||
%code%{ RETVAL = const_cast<PlaceholderParser*>(&THIS->placeholder_parser()); %};
|
||||
Ref<ExtrusionEntityCollection> skirt()
|
||||
%code%{ RETVAL = const_cast<ExtrusionEntityCollection*>(&THIS->skirt()); %};
|
||||
Ref<ExtrusionEntityCollection> brim()
|
||||
%code%{ RETVAL = const_cast<ExtrusionEntityCollection*>(&THIS->brim()); %};
|
||||
// std::string estimated_normal_print_time()
|
||||
// %code%{ RETVAL = THIS->print_statistics().estimated_normal_print_time; %};
|
||||
// std::string estimated_silent_print_time()
|
||||
// %code%{ RETVAL = THIS->print_statistics().estimated_silent_print_time; %};
|
||||
double total_used_filament()
|
||||
%code%{ RETVAL = THIS->print_statistics().total_used_filament; %};
|
||||
double total_extruded_volume()
|
||||
%code%{ RETVAL = THIS->print_statistics().total_extruded_volume; %};
|
||||
double total_weight()
|
||||
%code%{ RETVAL = THIS->print_statistics().total_weight; %};
|
||||
double total_cost()
|
||||
%code%{ RETVAL = THIS->print_statistics().total_cost; %};
|
||||
double total_wipe_tower_cost()
|
||||
%code%{ RETVAL = THIS->print_statistics().total_wipe_tower_cost; %};
|
||||
double total_wipe_tower_filament()
|
||||
%code%{ RETVAL = THIS->print_statistics().total_wipe_tower_filament; %};
|
||||
int wipe_tower_number_of_toolchanges()
|
||||
%code%{ RETVAL = THIS->wipe_tower_data().number_of_toolchanges; %};
|
||||
PrintObjectPtrs* objects()
|
||||
%code%{ RETVAL = const_cast<PrintObjectPtrs*>(&THIS->objects_mutable()); %};
|
||||
Ref<PrintObject> get_object(int idx)
|
||||
%code%{ RETVAL = THIS->objects_mutable()[idx]; %};
|
||||
size_t object_count()
|
||||
%code%{ RETVAL = THIS->objects().size(); %};
|
||||
|
||||
PrintRegionPtrs* regions()
|
||||
%code%{ RETVAL = const_cast<PrintRegionPtrs*>(&THIS->print_regions_mutable()); %};
|
||||
|
||||
bool step_done(PrintStep step)
|
||||
%code%{ RETVAL = THIS->is_step_done(step); %};
|
||||
bool object_step_done(PrintObjectStep step)
|
||||
%code%{ RETVAL = THIS->is_step_done(step); %};
|
||||
|
||||
SV* filament_stats()
|
||||
%code%{
|
||||
HV* hv = newHV();
|
||||
for (std::map<size_t,double>::const_iterator it = THIS->print_statistics().filament_stats.begin(); it != THIS->print_statistics().filament_stats.end(); ++it) {
|
||||
// stringify extruder_id
|
||||
std::ostringstream ss;
|
||||
ss << it->first;
|
||||
std::string str = ss.str();
|
||||
|
||||
(void)hv_store( hv, str.c_str(), str.length(), newSViv(it->second), 0 );
|
||||
RETVAL = newRV_noinc((SV*)hv);
|
||||
}
|
||||
%};
|
||||
bool has_support_material() const;
|
||||
void auto_assign_extruders(ModelObject* model_object);
|
||||
std::string output_filepath(std::string path = "")
|
||||
%code%{
|
||||
try {
|
||||
RETVAL = THIS->output_filepath(path);
|
||||
} catch (std::exception& e) {
|
||||
croak("%s\n", e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
bool apply(Model *model, DynamicPrintConfig* config)
|
||||
%code%{
|
||||
// Touching every config as the Perl bindings does not correctly export ModelConfig,
|
||||
// therefore the configs have often invalid timestamps.
|
||||
for (auto obj : model->objects) {
|
||||
obj->config.touch();
|
||||
for (auto vol : obj->volumes)
|
||||
vol->config.touch();
|
||||
}
|
||||
for (auto mat : model->materials)
|
||||
mat.second->config.touch();
|
||||
RETVAL = THIS->apply(*model, *config);
|
||||
%};
|
||||
bool has_infinite_skirt();
|
||||
std::vector<unsigned int> extruders() const;
|
||||
int validate() %code%{
|
||||
std::string err = THIS->validate();
|
||||
if (! err.empty())
|
||||
croak("Configuration is not valid: %s\n", err.c_str());
|
||||
RETVAL = 1;
|
||||
%};
|
||||
|
||||
void set_callback_event(int evt) %code%{
|
||||
%};
|
||||
void set_status_silent();
|
||||
void set_status(int percent, const char *message);
|
||||
|
||||
void process() %code%{
|
||||
try {
|
||||
THIS->process();
|
||||
} catch (std::exception& e) {
|
||||
croak("%s\n", e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
void export_gcode(char *path_template) %code%{
|
||||
try {
|
||||
THIS->export_gcode(path_template, nullptr);
|
||||
} catch (std::exception& e) {
|
||||
croak("%s\n", e.what());
|
||||
}
|
||||
%};
|
||||
|
||||
};
|
118
xs/xsp/Surface.xsp
Normal file
118
xs/xsp/Surface.xsp
Normal file
|
@ -0,0 +1,118 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Surface.hpp"
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Surface} class Surface {
|
||||
~Surface();
|
||||
Ref<ExPolygon> expolygon()
|
||||
%code{% RETVAL = &(THIS->expolygon); %};
|
||||
double thickness()
|
||||
%code{% RETVAL = THIS->thickness; %};
|
||||
unsigned short thickness_layers()
|
||||
%code{% RETVAL = THIS->thickness_layers; %};
|
||||
double area();
|
||||
bool is_solid() const;
|
||||
bool is_external() const;
|
||||
bool is_internal() const;
|
||||
bool is_bottom() const;
|
||||
bool is_bridge() const;
|
||||
%{
|
||||
|
||||
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:
|
||||
RETVAL = new Surface (surface_type, *expolygon);
|
||||
RETVAL->thickness = thickness;
|
||||
RETVAL->thickness_layers = thickness_layers;
|
||||
RETVAL->bridge_angle = bridge_angle;
|
||||
RETVAL->extra_perimeters = extra_perimeters;
|
||||
// we don't delete expolygon here because it's referenced by a Perl SV
|
||||
// whose DESTROY will take care of destruction
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
Surfaces
|
||||
Surface::offset(delta, joinType = ClipperLib::jtMiter, miterLimit = 3)
|
||||
const float delta
|
||||
Slic3r::ClipperLib::JoinType joinType
|
||||
double miterLimit
|
||||
CODE:
|
||||
surfaces_append(RETVAL, offset_ex(THIS->expolygon, delta, joinType, miterLimit), *THIS);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
%package{Slic3r::Surface};
|
||||
%{
|
||||
|
||||
IV
|
||||
_constant()
|
||||
ALIAS:
|
||||
S_TYPE_TOP = stTop
|
||||
S_TYPE_BOTTOM = stBottom
|
||||
S_TYPE_BOTTOMBRIDGE = stBottomBridge
|
||||
S_TYPE_INTERNAL = stInternal
|
||||
S_TYPE_INTERNALSOLID = stInternalSolid
|
||||
S_TYPE_INTERNALBRIDGE = stInternalBridge
|
||||
S_TYPE_INTERNALVOID = stInternalVoid
|
||||
S_TYPW_PERIMETER = stPerimeter
|
||||
PROTOTYPE:
|
||||
CODE:
|
||||
RETVAL = ix;
|
||||
OUTPUT: RETVAL
|
||||
|
||||
%}
|
||||
|
84
xs/xsp/SurfaceCollection.xsp
Normal file
84
xs/xsp/SurfaceCollection.xsp
Normal file
|
@ -0,0 +1,84 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/SurfaceCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Surface::Collection} class SurfaceCollection {
|
||||
%name{_new} SurfaceCollection();
|
||||
~SurfaceCollection();
|
||||
void clear()
|
||||
%code{% THIS->surfaces.clear(); %};
|
||||
void append(Surface* surface)
|
||||
%code{% THIS->surfaces.push_back(*surface); %};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->surfaces.size(); %};
|
||||
void simplify(double tolerance);
|
||||
%{
|
||||
|
||||
SV*
|
||||
SurfaceCollection::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->surfaces.size()-1);
|
||||
int i = 0;
|
||||
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
SurfaceCollection::filter_by_type(surface_type)
|
||||
SurfaceType surface_type;
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
if ((*it).surface_type == surface_type) av_push(av, perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
SurfaceCollection::replace(index, surface)
|
||||
int index
|
||||
Surface* surface
|
||||
CODE:
|
||||
THIS->surfaces[index] = *surface;
|
||||
|
||||
void
|
||||
SurfaceCollection::set_surface_type(index, surface_type)
|
||||
int index
|
||||
SurfaceType surface_type;
|
||||
CODE:
|
||||
THIS->surfaces[index].surface_type = surface_type;
|
||||
|
||||
SV*
|
||||
SurfaceCollection::group()
|
||||
CODE:
|
||||
// perform grouping
|
||||
std::vector<SurfacesPtr> groups;
|
||||
THIS->group(&groups);
|
||||
|
||||
// build return arrayref
|
||||
AV* av = newAV();
|
||||
av_fill(av, groups.size()-1);
|
||||
size_t i = 0;
|
||||
for (std::vector<SurfacesPtr>::iterator it = groups.begin(); it != groups.end(); ++it) {
|
||||
AV* innerav = newAV();
|
||||
av_fill(innerav, it->size()-1);
|
||||
size_t j = 0;
|
||||
for (SurfacesPtr::iterator it_s = it->begin(); it_s != it->end(); ++it_s) {
|
||||
av_store(innerav, j++, perl_to_SV_clone_ref(**it_s));
|
||||
}
|
||||
av_store(av, i++, newRV_noinc((SV*)innerav));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
205
xs/xsp/TriangleMesh.xsp
Normal file
205
xs/xsp/TriangleMesh.xsp
Normal file
|
@ -0,0 +1,205 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/TriangleMesh.hpp"
|
||||
#include "libslic3r/TriangleMeshSlicer.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::TriangleMesh} class TriangleMesh {
|
||||
TriangleMesh();
|
||||
~TriangleMesh();
|
||||
Clone<TriangleMesh> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void write_ascii(char* output_file);
|
||||
void write_binary(char* output_file);
|
||||
void scale(float factor);
|
||||
void scale_xyz(Vec3d* versor)
|
||||
%code{% THIS->scale(versor->cast<float>()); %};
|
||||
void translate(float x, float y, float z);
|
||||
void rotate_x(float angle);
|
||||
void rotate_y(float angle);
|
||||
void rotate_z(float angle);
|
||||
void mirror_x();
|
||||
void mirror_y();
|
||||
void mirror_z();
|
||||
void align_to_origin();
|
||||
void rotate(double angle, Point* center);
|
||||
void merge(TriangleMesh* mesh)
|
||||
%code{% THIS->merge(*mesh); %};
|
||||
Clone<Polygon> convex_hull();
|
||||
Clone<BoundingBoxf3> bounding_box();
|
||||
Clone<Vec3d> center()
|
||||
%code{% RETVAL = THIS->bounding_box().center(); %};
|
||||
int facets_count();
|
||||
|
||||
%{
|
||||
|
||||
void
|
||||
TriangleMesh::ReadFromPerl(vertices, facets)
|
||||
SV* vertices
|
||||
SV* facets
|
||||
CODE:
|
||||
std::vector<Slic3r::Vec3f> out_vertices;
|
||||
{
|
||||
AV* vertices_av = (AV*)SvRV(vertices);
|
||||
int number_of_vertices = av_len(vertices_av) + 1;
|
||||
out_vertices.reserve(number_of_vertices);
|
||||
for (int i = 0; i < number_of_vertices; ++ i) {
|
||||
AV* vertex_av = (AV*)SvRV(*av_fetch(vertices_av, i, 0));
|
||||
out_vertices.push_back(Slic3r::Vec3f(SvNV(*av_fetch(vertex_av, 0, 0)), SvNV(*av_fetch(vertex_av, 1, 0)), SvNV(*av_fetch(vertex_av, 2, 0))));
|
||||
}
|
||||
}
|
||||
std::vector<Slic3r::Vec3i> out_indices;
|
||||
{
|
||||
AV* facets_av = (AV*)SvRV(facets);
|
||||
int number_of_facets = av_len(facets_av) + 1;
|
||||
out_indices.reserve(number_of_facets);
|
||||
for (int i = 0; i < number_of_facets; ++ i) {
|
||||
AV* facet_av = (AV*)SvRV(*av_fetch(facets_av, i, 0));
|
||||
out_indices.push_back(Slic3r::Vec3i(SvIV(*av_fetch(facet_av, 0, 0)), SvIV(*av_fetch(facet_av, 1, 0)), SvIV(*av_fetch(facet_av, 2, 0))));
|
||||
}
|
||||
}
|
||||
*THIS = TriangleMesh(std::move(out_vertices), std::move(out_indices));
|
||||
|
||||
SV*
|
||||
TriangleMesh::stats()
|
||||
CODE:
|
||||
HV* hv = newHV();
|
||||
(void)hv_stores( hv, "number_of_facets", newSViv(THIS->facets_count()) );
|
||||
(void)hv_stores( hv, "number_of_parts", newSViv(THIS->stats().number_of_parts) );
|
||||
(void)hv_stores( hv, "volume", newSVnv(THIS->stats().volume) );
|
||||
(void)hv_stores( hv, "degenerate_facets", newSViv(THIS->stats().repaired_errors.degenerate_facets) );
|
||||
(void)hv_stores( hv, "edges_fixed", newSViv(THIS->stats().repaired_errors.edges_fixed) );
|
||||
(void)hv_stores( hv, "facets_removed", newSViv(THIS->stats().repaired_errors.facets_removed) );
|
||||
(void)hv_stores( hv, "facets_reversed", newSViv(THIS->stats().repaired_errors.facets_reversed) );
|
||||
(void)hv_stores( hv, "backwards_edges", newSViv(THIS->stats().repaired_errors.backwards_edges) );
|
||||
RETVAL = (SV*)newRV_noinc((SV*)hv);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
TriangleMesh::vertices()
|
||||
CODE:
|
||||
// vertices
|
||||
AV* vertices = newAV();
|
||||
av_extend(vertices, THIS->its.vertices.size());
|
||||
for (size_t i = 0; i < THIS->its.vertices.size(); i++) {
|
||||
AV* vertex = newAV();
|
||||
av_store(vertices, i, newRV_noinc((SV*)vertex));
|
||||
av_extend(vertex, 2);
|
||||
av_store(vertex, 0, newSVnv(THIS->its.vertices[i](0)));
|
||||
av_store(vertex, 1, newSVnv(THIS->its.vertices[i](1)));
|
||||
av_store(vertex, 2, newSVnv(THIS->its.vertices[i](2)));
|
||||
}
|
||||
|
||||
RETVAL = newRV_noinc((SV*)vertices);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
TriangleMesh::facets()
|
||||
CODE:
|
||||
// facets
|
||||
AV* facets = newAV();
|
||||
av_extend(facets, THIS->facets_count());
|
||||
for (int i = 0; i < THIS->facets_count(); i++) {
|
||||
AV* facet = newAV();
|
||||
av_store(facets, i, newRV_noinc((SV*)facet));
|
||||
av_extend(facet, 2);
|
||||
av_store(facet, 0, newSVnv(THIS->its.indices[i][0]));
|
||||
av_store(facet, 1, newSVnv(THIS->its.indices[i][1]));
|
||||
av_store(facet, 2, newSVnv(THIS->its.indices[i][2]));
|
||||
}
|
||||
|
||||
RETVAL = newRV_noinc((SV*)facets);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
TriangleMesh::size()
|
||||
CODE:
|
||||
AV* size = newAV();
|
||||
av_extend(size, 2);
|
||||
av_store(size, 0, newSVnv(THIS->stats().size(0)));
|
||||
av_store(size, 1, newSVnv(THIS->stats().size(1)));
|
||||
av_store(size, 2, newSVnv(THIS->stats().size(2)));
|
||||
RETVAL = newRV_noinc((SV*)size);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
TriangleMesh::slice(z)
|
||||
std::vector<double> z
|
||||
CODE:
|
||||
// convert doubles to floats
|
||||
std::vector<float> z_f = cast<float>(z);
|
||||
|
||||
std::vector<ExPolygons> layers = slice_mesh_ex(THIS->its, z_f, 0.049f);
|
||||
|
||||
AV* layers_av = newAV();
|
||||
size_t len = layers.size();
|
||||
if (len > 0) av_extend(layers_av, len-1);
|
||||
for (unsigned int i = 0; i < layers.size(); i++) {
|
||||
AV* expolygons_av = newAV();
|
||||
len = layers[i].size();
|
||||
if (len > 0) av_extend(expolygons_av, len-1);
|
||||
unsigned int j = 0;
|
||||
for (ExPolygons::iterator it = layers[i].begin(); it != layers[i].end(); ++it) {
|
||||
av_store(expolygons_av, j++, perl_to_SV_clone_ref(*it));
|
||||
}
|
||||
av_store(layers_av, i, newRV_noinc((SV*)expolygons_av));
|
||||
}
|
||||
RETVAL = (SV*)newRV_noinc((SV*)layers_av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
TriangleMesh::cut(z, upper_mesh, lower_mesh)
|
||||
float z;
|
||||
TriangleMesh* upper_mesh;
|
||||
TriangleMesh* lower_mesh;
|
||||
CODE:
|
||||
indexed_triangle_set upper, lower;
|
||||
cut_mesh(THIS->its, z, upper_mesh ? &upper : nullptr, lower_mesh ? &lower : nullptr);
|
||||
if (upper_mesh)
|
||||
*upper_mesh = TriangleMesh(upper);
|
||||
if (lower_mesh)
|
||||
*lower_mesh = TriangleMesh(lower);
|
||||
|
||||
std::vector<double>
|
||||
TriangleMesh::bb3()
|
||||
CODE:
|
||||
RETVAL.push_back(THIS->stats().min(0));
|
||||
RETVAL.push_back(THIS->stats().min(1));
|
||||
RETVAL.push_back(THIS->stats().max(0));
|
||||
RETVAL.push_back(THIS->stats().max(1));
|
||||
RETVAL.push_back(THIS->stats().min(2));
|
||||
RETVAL.push_back(THIS->stats().max(2));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
|
||||
Clone<TriangleMesh>
|
||||
cube(double x, double y, double z)
|
||||
CODE:
|
||||
RETVAL = make_cube(x,y,z);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Clone<TriangleMesh>
|
||||
cylinder(double r, double h)
|
||||
CODE:
|
||||
RETVAL = make_cylinder(r, h);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Clone<TriangleMesh>
|
||||
sphere(double rho)
|
||||
CODE:
|
||||
RETVAL = make_sphere(rho);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
163
xs/xsp/XS.xsp
Normal file
163
xs/xsp/XS.xsp
Normal file
|
@ -0,0 +1,163 @@
|
|||
%module{Slic3r::XS};
|
||||
%package{Slic3r::XS};
|
||||
|
||||
#include <xsinit.h>
|
||||
#include "Utils.hpp"
|
||||
|
||||
%{
|
||||
|
||||
%}
|
||||
|
||||
%package{Slic3r};
|
||||
%{
|
||||
|
||||
SV*
|
||||
VERSION()
|
||||
CODE:
|
||||
RETVAL = newSVpv(SLIC3R_VERSION, 0);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
SV*
|
||||
BUILD()
|
||||
CODE:
|
||||
RETVAL = newSVpv(SLIC3R_BUILD_ID, 0);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
SV*
|
||||
FORK_NAME()
|
||||
CODE:
|
||||
RETVAL = newSVpv(SLIC3R_APP_NAME, 0);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
void
|
||||
set_logging_level(level)
|
||||
unsigned int level;
|
||||
CODE:
|
||||
Slic3r::set_logging_level(level);
|
||||
|
||||
void
|
||||
trace(level, message)
|
||||
unsigned int level;
|
||||
char *message;
|
||||
CODE:
|
||||
Slic3r::trace(level, message);
|
||||
|
||||
void
|
||||
disable_multi_threading()
|
||||
CODE:
|
||||
Slic3r::disable_multi_threading();
|
||||
|
||||
void
|
||||
set_var_dir(dir)
|
||||
char *dir;
|
||||
CODE:
|
||||
Slic3r::set_var_dir(dir);
|
||||
|
||||
void
|
||||
set_local_dir(dir)
|
||||
char *dir;
|
||||
CODE:
|
||||
Slic3r::set_local_dir(dir);
|
||||
|
||||
char*
|
||||
var_dir()
|
||||
CODE:
|
||||
RETVAL = const_cast<char*>(Slic3r::var_dir().c_str());
|
||||
OUTPUT: RETVAL
|
||||
|
||||
void
|
||||
set_resources_dir(dir)
|
||||
char *dir;
|
||||
CODE:
|
||||
Slic3r::set_resources_dir(dir);
|
||||
|
||||
char*
|
||||
resources_dir()
|
||||
CODE:
|
||||
RETVAL = const_cast<char*>(Slic3r::resources_dir().c_str());
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
var(file_name)
|
||||
const char *file_name;
|
||||
CODE:
|
||||
RETVAL = Slic3r::var(file_name);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
void
|
||||
set_data_dir(dir)
|
||||
char *dir;
|
||||
CODE:
|
||||
Slic3r::set_data_dir(dir);
|
||||
|
||||
char*
|
||||
data_dir()
|
||||
CODE:
|
||||
RETVAL = const_cast<char*>(Slic3r::data_dir().c_str());
|
||||
OUTPUT: RETVAL
|
||||
|
||||
local_encoded_string
|
||||
encode_path(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::encode_path(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
decode_path(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::decode_path(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
normalize_utf8_nfc(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::normalize_utf8_nfc(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
path_to_filename(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::PerlUtils::path_to_filename(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
local_encoded_string
|
||||
path_to_filename_raw(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::PerlUtils::path_to_filename(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
path_to_stem(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::PerlUtils::path_to_stem(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
path_to_extension(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::PerlUtils::path_to_extension(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
std::string
|
||||
path_to_parent_path(src)
|
||||
const char *src;
|
||||
CODE:
|
||||
RETVAL = Slic3r::PerlUtils::path_to_parent_path(src);
|
||||
OUTPUT: RETVAL
|
||||
|
||||
void
|
||||
xspp_test_croak_hangs_on_strawberry()
|
||||
CODE:
|
||||
try {
|
||||
throw 1;
|
||||
} catch (...) {
|
||||
croak("xspp_test_croak_hangs_on_strawberry: exception catched\n");
|
||||
}
|
||||
%}
|
550
xs/xsp/my.map
Normal file
550
xs/xsp/my.map
Normal file
|
@ -0,0 +1,550 @@
|
|||
coordf_t T_NV
|
||||
|
||||
std::string T_STD_STRING
|
||||
local_encoded_string T_STD_STRING_LOCAL_ENCODING
|
||||
t_config_option_key T_STD_STRING
|
||||
t_model_material_id T_STD_STRING
|
||||
|
||||
std::vector<std::string> T_STD_VECTOR_STD_STRING
|
||||
|
||||
std::vector<int> T_STD_VECTOR_INT
|
||||
std::vector<Points::size_type> T_STD_VECTOR_INT
|
||||
std::vector<size_t> T_STD_VECTOR_INT
|
||||
|
||||
std::vector<unsigned int> T_STD_VECTOR_UINT
|
||||
|
||||
std::vector<double> T_STD_VECTOR_DOUBLE
|
||||
|
||||
t_layer_height_ranges T_LAYER_HEIGHT_RANGES
|
||||
|
||||
|
||||
BoundingBox* O_OBJECT_SLIC3R
|
||||
Ref<BoundingBox> O_OBJECT_SLIC3R_T
|
||||
Clone<BoundingBox> O_OBJECT_SLIC3R_T
|
||||
|
||||
BoundingBoxf* O_OBJECT_SLIC3R
|
||||
Ref<BoundingBoxf> O_OBJECT_SLIC3R_T
|
||||
Clone<BoundingBoxf> O_OBJECT_SLIC3R_T
|
||||
|
||||
BoundingBoxf3* O_OBJECT_SLIC3R
|
||||
Ref<BoundingBoxf3> O_OBJECT_SLIC3R_T
|
||||
Clone<BoundingBoxf3> O_OBJECT_SLIC3R_T
|
||||
|
||||
DynamicPrintConfig* O_OBJECT_SLIC3R
|
||||
Ref<DynamicPrintConfig> O_OBJECT_SLIC3R_T
|
||||
Clone<DynamicPrintConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
StaticPrintConfig* O_OBJECT_SLIC3R
|
||||
Ref<StaticPrintConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintObjectConfig* O_OBJECT_SLIC3R
|
||||
Ref<PrintObjectConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintRegionConfig* O_OBJECT_SLIC3R
|
||||
Ref<PrintRegionConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
GCodeConfig* O_OBJECT_SLIC3R
|
||||
Ref<GCodeConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintConfig* O_OBJECT_SLIC3R
|
||||
Ref<PrintConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
FullPrintConfig* O_OBJECT_SLIC3R
|
||||
Ref<FullPrintConfig> O_OBJECT_SLIC3R_T
|
||||
|
||||
ZTable* O_OBJECT
|
||||
|
||||
TriangleMesh* O_OBJECT_SLIC3R
|
||||
Ref<TriangleMesh> O_OBJECT_SLIC3R_T
|
||||
Clone<TriangleMesh> O_OBJECT_SLIC3R_T
|
||||
|
||||
Point* O_OBJECT_SLIC3R
|
||||
Ref<Point> O_OBJECT_SLIC3R_T
|
||||
Clone<Point> O_OBJECT_SLIC3R_T
|
||||
|
||||
Point3* O_OBJECT_SLIC3R
|
||||
Ref<Point3> O_OBJECT_SLIC3R_T
|
||||
Clone<Point3> O_OBJECT_SLIC3R_T
|
||||
|
||||
Vec2d* O_OBJECT_SLIC3R
|
||||
Ref<Vec2d> O_OBJECT_SLIC3R_T
|
||||
Clone<Vec2d> O_OBJECT_SLIC3R_T
|
||||
|
||||
Vec3d* O_OBJECT_SLIC3R
|
||||
Ref<Vec3d> O_OBJECT_SLIC3R_T
|
||||
Clone<Vec3d> O_OBJECT_SLIC3R_T
|
||||
|
||||
Line* O_OBJECT_SLIC3R
|
||||
Ref<Line> O_OBJECT_SLIC3R_T
|
||||
Clone<Line> O_OBJECT_SLIC3R_T
|
||||
|
||||
Linef3* O_OBJECT_SLIC3R
|
||||
Ref<Linef3> O_OBJECT_SLIC3R_T
|
||||
Clone<Linef3> O_OBJECT_SLIC3R_T
|
||||
|
||||
Polyline* O_OBJECT_SLIC3R
|
||||
Ref<Polyline> O_OBJECT_SLIC3R_T
|
||||
Clone<Polyline> O_OBJECT_SLIC3R_T
|
||||
|
||||
PolylineCollection* O_OBJECT_SLIC3R
|
||||
Ref<PolylineCollection> O_OBJECT_SLIC3R_T
|
||||
Clone<PolylineCollection> O_OBJECT_SLIC3R_T
|
||||
|
||||
Polygon* O_OBJECT_SLIC3R
|
||||
Ref<Polygon> O_OBJECT_SLIC3R_T
|
||||
Clone<Polygon> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExPolygon* O_OBJECT_SLIC3R
|
||||
Ref<ExPolygon> O_OBJECT_SLIC3R_T
|
||||
Clone<ExPolygon> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExPolygonCollection* O_OBJECT_SLIC3R
|
||||
Ref<ExPolygonCollection> O_OBJECT_SLIC3R_T
|
||||
Clone<ExPolygonCollection> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExtrusionEntityCollection* O_OBJECT_SLIC3R
|
||||
Ref<ExtrusionEntityCollection> O_OBJECT_SLIC3R_T
|
||||
Clone<ExtrusionEntityCollection> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExtrusionMultiPath* O_OBJECT_SLIC3R
|
||||
Ref<ExtrusionMultiPath> O_OBJECT_SLIC3R_T
|
||||
Clone<ExtrusionMultiPath> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExtrusionPath* O_OBJECT_SLIC3R
|
||||
Ref<ExtrusionPath> O_OBJECT_SLIC3R_T
|
||||
Clone<ExtrusionPath> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExtrusionLoop* O_OBJECT_SLIC3R
|
||||
Ref<ExtrusionLoop> O_OBJECT_SLIC3R_T
|
||||
Clone<ExtrusionLoop> O_OBJECT_SLIC3R_T
|
||||
|
||||
ExtrusionSimulator* O_OBJECT_SLIC3R
|
||||
Ref<ExtrusionSimulator> O_OBJECT_SLIC3R_T
|
||||
Clone<ExtrusionSimulator> O_OBJECT_SLIC3R_T
|
||||
|
||||
Filler* O_OBJECT_SLIC3R
|
||||
Ref<Filler> O_OBJECT_SLIC3R_T
|
||||
Clone<Filler> O_OBJECT_SLIC3R_T
|
||||
|
||||
Flow* O_OBJECT_SLIC3R
|
||||
Ref<Flow> O_OBJECT_SLIC3R_T
|
||||
Clone<Flow> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintState* O_OBJECT_SLIC3R
|
||||
Ref<PrintState> O_OBJECT_SLIC3R_T
|
||||
|
||||
Surface* O_OBJECT_SLIC3R
|
||||
Ref<Surface> O_OBJECT_SLIC3R_T
|
||||
Clone<Surface> O_OBJECT_SLIC3R_T
|
||||
|
||||
SurfaceCollection* O_OBJECT_SLIC3R
|
||||
Ref<SurfaceCollection> O_OBJECT_SLIC3R_T
|
||||
|
||||
Model* O_OBJECT_SLIC3R
|
||||
Ref<Model> O_OBJECT_SLIC3R_T
|
||||
Clone<Model> O_OBJECT_SLIC3R_T
|
||||
|
||||
ModelMaterial* O_OBJECT_SLIC3R
|
||||
Ref<ModelMaterial> O_OBJECT_SLIC3R_T
|
||||
Clone<ModelMaterial> O_OBJECT_SLIC3R_T
|
||||
|
||||
ModelObject* O_OBJECT_SLIC3R
|
||||
Ref<ModelObject> O_OBJECT_SLIC3R_T
|
||||
Clone<ModelObject> O_OBJECT_SLIC3R_T
|
||||
|
||||
ModelVolume* O_OBJECT_SLIC3R
|
||||
Ref<ModelVolume> O_OBJECT_SLIC3R_T
|
||||
Clone<ModelVolume> O_OBJECT_SLIC3R_T
|
||||
|
||||
ModelInstance* O_OBJECT_SLIC3R
|
||||
Ref<ModelInstance> O_OBJECT_SLIC3R_T
|
||||
Clone<ModelInstance> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintRegion* O_OBJECT_SLIC3R
|
||||
Ref<PrintRegion> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintObject* O_OBJECT_SLIC3R
|
||||
Ref<PrintObject> O_OBJECT_SLIC3R_T
|
||||
|
||||
Print* O_OBJECT_SLIC3R
|
||||
Ref<Print> O_OBJECT_SLIC3R_T
|
||||
Clone<Print> O_OBJECT_SLIC3R_T
|
||||
|
||||
LayerRegion* O_OBJECT_SLIC3R
|
||||
Ref<LayerRegion> O_OBJECT_SLIC3R_T
|
||||
|
||||
Layer* O_OBJECT_SLIC3R
|
||||
Ref<Layer> O_OBJECT_SLIC3R_T
|
||||
|
||||
SupportLayer* O_OBJECT_SLIC3R
|
||||
Ref<SupportLayer> O_OBJECT_SLIC3R_T
|
||||
|
||||
PlaceholderParser* O_OBJECT_SLIC3R
|
||||
Ref<PlaceholderParser> O_OBJECT_SLIC3R_T
|
||||
Clone<PlaceholderParser> O_OBJECT_SLIC3R_T
|
||||
|
||||
CoolingBuffer* O_OBJECT_SLIC3R
|
||||
Ref<CoolingBuffer> O_OBJECT_SLIC3R_T
|
||||
Clone<CoolingBuffer> O_OBJECT_SLIC3R_T
|
||||
|
||||
GCode* O_OBJECT_SLIC3R
|
||||
Ref<GCode> O_OBJECT_SLIC3R_T
|
||||
Clone<GCode> O_OBJECT_SLIC3R_T
|
||||
|
||||
BridgeDetector* O_OBJECT_SLIC3R
|
||||
Ref<BridgeDetector> O_OBJECT_SLIC3R_T
|
||||
Clone<BridgeDetector> O_OBJECT_SLIC3R_T
|
||||
|
||||
PerimeterGenerator* O_OBJECT_SLIC3R
|
||||
Ref<PerimeterGenerator> O_OBJECT_SLIC3R_T
|
||||
Clone<PerimeterGenerator> O_OBJECT_SLIC3R_T
|
||||
|
||||
PrintObjectSupportMaterial* O_OBJECT_SLIC3R
|
||||
Ref<PrintObjectSupportMaterial> O_OBJECT_SLIC3R_T
|
||||
Clone<PrintObjectSupportMaterial> O_OBJECT_SLIC3R_T
|
||||
|
||||
Axis T_UV
|
||||
ExtrusionLoopRole T_UV
|
||||
ExtrusionRole T_UV
|
||||
ExtrusionSimulationType T_UV
|
||||
FlowRole T_UV
|
||||
PrintStep T_UV
|
||||
PrintObjectStep T_UV
|
||||
SurfaceType T_UV
|
||||
Slic3r::ClipperLib::JoinType T_UV
|
||||
Slic3r::ClipperLib::PolyFillType T_UV
|
||||
|
||||
# we return these types whenever we want the items to be cloned
|
||||
Points T_ARRAYREF
|
||||
Pointfs T_ARRAYREF
|
||||
Lines T_ARRAYREF
|
||||
Polygons T_ARRAYREF
|
||||
Polylines T_ARRAYREF
|
||||
ExPolygons T_ARRAYREF
|
||||
ExtrusionPaths T_ARRAYREF
|
||||
Surfaces T_ARRAYREF
|
||||
|
||||
# we return these types whenever we want the items to be returned
|
||||
# by reference and marked ::Ref because they're contained in another
|
||||
# Perl object
|
||||
Polygons* T_ARRAYREF_PTR
|
||||
ModelObjectPtrs* T_PTR_ARRAYREF_PTR
|
||||
ModelVolumePtrs* T_PTR_ARRAYREF_PTR
|
||||
ModelInstancePtrs* T_PTR_ARRAYREF_PTR
|
||||
PrintRegionPtrs* T_PTR_ARRAYREF_PTR
|
||||
PrintObjectPtrs* T_PTR_ARRAYREF_PTR
|
||||
LayerPtrs* T_PTR_ARRAYREF_PTR
|
||||
SupportLayerPtrs* T_PTR_ARRAYREF_PTR
|
||||
|
||||
# we return these types whenever we want the items to be returned
|
||||
# by reference and not marked ::Ref because they're newly allocated
|
||||
# and not referenced by any Perl object
|
||||
|
||||
|
||||
INPUT
|
||||
|
||||
T_STD_STRING
|
||||
{
|
||||
size_t len;
|
||||
// const char * c = SvPV($arg, len);
|
||||
// Always convert strings to UTF-8 before passing them to XS
|
||||
const char * c = SvPVutf8($arg, len);
|
||||
$var = std::string(c, len);
|
||||
}
|
||||
|
||||
INPUT
|
||||
T_STD_STRING_LOCAL_ENCODING
|
||||
{
|
||||
size_t len;
|
||||
const char * c = SvPV($arg, len);
|
||||
$var = std::string(c, len);
|
||||
}
|
||||
|
||||
T_STD_VECTOR_STD_STRING
|
||||
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
||||
AV* av = (AV*)SvRV($arg);
|
||||
const unsigned int alen = av_len(av)+1;
|
||||
$var = std::vector<std::string>(alen);
|
||||
STRLEN len;
|
||||
char* tmp;
|
||||
SV** elem;
|
||||
for (unsigned int i = 0; i < alen; i++) {
|
||||
elem = av_fetch(av, i, 0);
|
||||
if (elem != NULL) {
|
||||
tmp = SvPV(*elem, len);
|
||||
${var}[i] = std::string(tmp, len);
|
||||
}
|
||||
else
|
||||
${var}[i] = std::string(\"\");
|
||||
}
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
|
||||
T_STD_VECTOR_INT
|
||||
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
||||
AV* av = (AV*)SvRV($arg);
|
||||
const unsigned int len = av_len(av)+1;
|
||||
$var = std::vector<int>(len);
|
||||
SV** elem;
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
elem = av_fetch(av, i, 0);
|
||||
if (elem != NULL)
|
||||
${var}[i] = SvIV(*elem);
|
||||
else
|
||||
${var}[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
|
||||
T_STD_VECTOR_UINT
|
||||
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
||||
AV* av = (AV*)SvRV($arg);
|
||||
const unsigned int len = av_len(av)+1;
|
||||
$var = std::vector<unsigned int>(len);
|
||||
SV** elem;
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
elem = av_fetch(av, i, 0);
|
||||
if (elem != NULL)
|
||||
${var}[i] = SvUV(*elem);
|
||||
else
|
||||
${var}[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
|
||||
T_STD_VECTOR_DOUBLE
|
||||
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
||||
AV* av = (AV*)SvRV($arg);
|
||||
const unsigned int len = av_len(av)+1;
|
||||
$var = std::vector<double>(len);
|
||||
SV** elem;
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
elem = av_fetch(av, i, 0);
|
||||
if (elem != NULL)
|
||||
${var}[i] = SvNV(*elem);
|
||||
else
|
||||
${var}[i] = 0.;
|
||||
}
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
|
||||
O_OBJECT_SLIC3R
|
||||
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
|
||||
if ( sv_isa($arg, Slic3r::perl_class_name($var) ) || sv_isa($arg, Slic3r::perl_class_name_ref($var) )) {
|
||||
$var = ($type)SvIV((SV*)SvRV( $arg ));
|
||||
} else {
|
||||
croak(\"$var is not of type %s (got %s)\", Slic3r::perl_class_name($var), HvNAME(SvSTASH(SvRV($arg))));
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
} else {
|
||||
warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
T_ARRAYREF
|
||||
if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
|
||||
AV* av = (AV*)SvRV($arg);
|
||||
const unsigned int len = av_len(av)+1;
|
||||
$var.resize(len);
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
SV** elem = av_fetch(av, i, 0);
|
||||
from_SV_check(*elem, &$var\[i]);
|
||||
}
|
||||
} else
|
||||
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
|
||||
T_LAYER_HEIGHT_RANGES
|
||||
{
|
||||
if (!SvROK($arg) || SvTYPE(SvRV($arg)) != SVt_PVAV) {
|
||||
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
}
|
||||
|
||||
AV* av = (AV*)SvRV($arg);
|
||||
const unsigned int len = av_len(av)+1;
|
||||
t_layer_height_ranges tmp_ranges;
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
SV* elem = *av_fetch(av, i, 0);
|
||||
if (!SvROK(elem) || SvTYPE(SvRV(elem)) != SVt_PVAV) {
|
||||
Perl_croak(
|
||||
aTHX_ \"%s: %s contains something that is not an array reference\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
}
|
||||
|
||||
AV* elemAV = (AV*)SvRV(elem);
|
||||
if (av_len(elemAV) + 1 != 3) {
|
||||
Perl_croak(
|
||||
aTHX_ \"%s: %s contains an array that isn't 3 elements long\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
}
|
||||
|
||||
coordf_t vals[3];
|
||||
for (unsigned int j = 0; j < 3; ++j) {
|
||||
SV *elem_elem = *av_fetch(elemAV, j, 0);
|
||||
if (!looks_like_number(elem_elem)) {
|
||||
Perl_croak(
|
||||
aTHX_ \"%s: layer ranges and heights must be numbers\",
|
||||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]});
|
||||
}
|
||||
|
||||
vals[j] = SvNV(elem_elem);
|
||||
}
|
||||
|
||||
tmp_ranges[t_layer_height_range(vals[0], vals[1])] = vals[2];
|
||||
}
|
||||
|
||||
$var = tmp_ranges;
|
||||
}
|
||||
|
||||
|
||||
OUTPUT
|
||||
|
||||
T_STD_STRING
|
||||
$arg = newSVpvn_utf8( $var.c_str(), $var.length(), true );
|
||||
|
||||
T_STD_STRING_LOCAL_ENCODING
|
||||
$arg = newSVpvn( $var.c_str(), $var.length() );
|
||||
|
||||
T_STD_VECTOR_STD_STRING
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len)
|
||||
av_extend(av, len-1);
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
const std::string& str = ${var}[i];
|
||||
STRLEN len = str.length();
|
||||
av_store(av, i, newSVpvn_utf8(str.c_str(), len, true));
|
||||
}
|
||||
|
||||
T_STD_VECTOR_INT
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len)
|
||||
av_extend(av, len-1);
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
av_store(av, i, newSViv(${var}[i]));
|
||||
}
|
||||
|
||||
T_STD_VECTOR_UINT
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len)
|
||||
av_extend(av, len-1);
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
av_store(av, i, newSVuv(${var}[i]));
|
||||
}
|
||||
|
||||
T_STD_VECTOR_DOUBLE
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len)
|
||||
av_extend(av, len-1);
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
av_store(av, i, newSVnv(${var}[i]));
|
||||
}
|
||||
|
||||
# return object from pointer
|
||||
O_OBJECT_SLIC3R
|
||||
if ($var == NULL)
|
||||
XSRETURN_UNDEF;
|
||||
sv_setref_pv( $arg, Slic3r::perl_class_name($var), (void*)$var );
|
||||
|
||||
# return value handled by template class
|
||||
O_OBJECT_SLIC3R_T
|
||||
if ($var == NULL)
|
||||
XSRETURN_UNDEF;
|
||||
sv_setref_pv( $arg, $type\::CLASS(), (void*)$var );
|
||||
|
||||
|
||||
T_ARRAYREF
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len > 0) av_extend(av, len-1);
|
||||
int i = 0;
|
||||
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_clone_ref(*it));
|
||||
}
|
||||
|
||||
T_ARRAYREF_PTR
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var->size();
|
||||
if (len > 0) av_extend(av, len-1);
|
||||
int i = 0;
|
||||
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_ref(*it));
|
||||
}
|
||||
|
||||
T_PTR_ARRAYREF_PTR
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var->size();
|
||||
if (len > 0) av_extend(av, len-1);
|
||||
int i = 0;
|
||||
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_ref(**it));
|
||||
}
|
||||
|
||||
T_PTR_ARRAYREF
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len > 0) av_extend(av, len-1);
|
||||
int i = 0;
|
||||
for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
|
||||
av_store(av, i++, to_SV(*it));
|
||||
}
|
||||
|
||||
T_LAYER_HEIGHT_RANGES
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
sv_2mortal($arg);
|
||||
const unsigned int len = $var.size();
|
||||
if (len > 0) av_extend(av, len-1);
|
||||
// map is sorted, so we can just copy it in order
|
||||
int i = 0;
|
||||
for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
|
||||
const coordf_t range_values[] = {
|
||||
it->first.first, // key's first = minz
|
||||
it->first.second, // key's second = maxz
|
||||
it->second, // value = height
|
||||
};
|
||||
|
||||
AV *rangeAV = newAV();
|
||||
av_extend(rangeAV, 2);
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
av_store(rangeAV, j, newSVnv(range_values[j]));
|
||||
}
|
||||
|
||||
av_store(av, i++, (SV*)newRV_noinc((SV*)rangeAV));
|
||||
}
|
0
xs/xsp/mytype.map
Normal file
0
xs/xsp/mytype.map
Normal file
245
xs/xsp/typemap.xspt
Normal file
245
xs/xsp/typemap.xspt
Normal file
|
@ -0,0 +1,245 @@
|
|||
%typemap{bool}{simple};
|
||||
%typemap{size_t}{simple};
|
||||
%typemap{coordf_t}{simple};
|
||||
%typemap{std::string};
|
||||
%typemap{t_config_option_key};
|
||||
%typemap{t_model_material_id};
|
||||
%typemap{std::vector<int>};
|
||||
%typemap{std::vector<size_t>};
|
||||
%typemap{std::vector<unsigned int>*};
|
||||
%typemap{std::vector<double>};
|
||||
%typemap{std::vector<double>*};
|
||||
%typemap{std::vector<unsigned int>};
|
||||
%typemap{std::vector<unsigned int>*};
|
||||
%typemap{std::vector<std::string>};
|
||||
%typemap{t_layer_height_ranges};
|
||||
%typemap{void*};
|
||||
%typemap{SV*};
|
||||
%typemap{AV*};
|
||||
%typemap{Point*};
|
||||
%typemap{Ref<Point>}{simple};
|
||||
%typemap{Clone<Point>}{simple};
|
||||
%typemap{Point3*};
|
||||
%typemap{Ref<Point3>}{simple};
|
||||
%typemap{Clone<Point3>}{simple};
|
||||
%typemap{Vec2d*};
|
||||
%typemap{Ref<Vec2d>}{simple};
|
||||
%typemap{Clone<Vec2d>}{simple};
|
||||
%typemap{Vec3d*};
|
||||
%typemap{Ref<Vec3d>}{simple};
|
||||
%typemap{Clone<Vec3d>}{simple};
|
||||
%typemap{BoundingBox*};
|
||||
%typemap{Ref<BoundingBox>}{simple};
|
||||
%typemap{Clone<BoundingBox>}{simple};
|
||||
%typemap{BoundingBoxf*};
|
||||
%typemap{Ref<BoundingBoxf>}{simple};
|
||||
%typemap{Clone<BoundingBoxf>}{simple};
|
||||
%typemap{BoundingBoxf3*};
|
||||
%typemap{Ref<BoundingBoxf3>}{simple};
|
||||
%typemap{Clone<BoundingBoxf3>}{simple};
|
||||
%typemap{DynamicPrintConfig*};
|
||||
%typemap{Ref<DynamicPrintConfig>}{simple};
|
||||
%typemap{Clone<DynamicPrintConfig>}{simple};
|
||||
%typemap{StaticPrintConfig*};
|
||||
%typemap{Ref<StaticPrintConfig>}{simple};
|
||||
%typemap{PrintObjectConfig*};
|
||||
%typemap{Ref<PrintObjectConfig>}{simple};
|
||||
%typemap{PrintRegionConfig*};
|
||||
%typemap{Ref<PrintRegionConfig>}{simple};
|
||||
%typemap{GCodeConfig*};
|
||||
%typemap{Ref<GCodeConfig>}{simple};
|
||||
%typemap{PrintConfig*};
|
||||
%typemap{Ref<PrintConfig>}{simple};
|
||||
%typemap{FullPrintConfig*};
|
||||
%typemap{Ref<FullPrintConfig>}{simple};
|
||||
%typemap{ExPolygon*};
|
||||
%typemap{Ref<ExPolygon>}{simple};
|
||||
%typemap{Clone<ExPolygon>}{simple};
|
||||
%typemap{ExPolygonCollection*};
|
||||
%typemap{Ref<ExPolygonCollection>}{simple};
|
||||
%typemap{Clone<ExPolygonCollection>}{simple};
|
||||
%typemap{Filler*};
|
||||
%typemap{Ref<Filler>}{simple};
|
||||
%typemap{Clone<Filler>}{simple};
|
||||
%typemap{Flow*};
|
||||
%typemap{Ref<Flow>}{simple};
|
||||
%typemap{Clone<Flow>}{simple};
|
||||
%typemap{Line*};
|
||||
%typemap{Ref<Line>}{simple};
|
||||
%typemap{Clone<Line>}{simple};
|
||||
%typemap{Linef3*};
|
||||
%typemap{Ref<Linef3>}{simple};
|
||||
%typemap{Clone<Linef3>}{simple};
|
||||
%typemap{Polyline*};
|
||||
%typemap{Ref<Polyline>}{simple};
|
||||
%typemap{Clone<Polyline>}{simple};
|
||||
%typemap{Polygon*};
|
||||
%typemap{Ref<Polygon>}{simple};
|
||||
%typemap{Clone<Polygon>}{simple};
|
||||
%typemap{ExtrusionEntityCollection*};
|
||||
%typemap{Ref<ExtrusionEntityCollection>}{simple};
|
||||
%typemap{Clone<ExtrusionEntityCollection>}{simple};
|
||||
%typemap{ExtrusionMultiPath*};
|
||||
%typemap{Ref<ExtrusionMultiPath>}{simple};
|
||||
%typemap{Clone<ExtrusionMultiPath>}{simple};
|
||||
%typemap{ExtrusionPath*};
|
||||
%typemap{Ref<ExtrusionPath>}{simple};
|
||||
%typemap{Clone<ExtrusionPath>}{simple};
|
||||
%typemap{ExtrusionLoop*};
|
||||
%typemap{Ref<ExtrusionLoop>}{simple};
|
||||
%typemap{Clone<ExtrusionLoop>}{simple};
|
||||
%typemap{ExtrusionSimulator*};
|
||||
%typemap{Ref<ExtrusionSimulator>}{simple};
|
||||
%typemap{Clone<ExtrusionSimulator>}{simple};
|
||||
%typemap{TriangleMesh*};
|
||||
%typemap{Ref<TriangleMesh>}{simple};
|
||||
%typemap{Clone<TriangleMesh>}{simple};
|
||||
%typemap{PolylineCollection*};
|
||||
%typemap{Ref<PolylineCollection>}{simple};
|
||||
%typemap{Clone<PolylineCollection>}{simple};
|
||||
%typemap{BridgeDetector*};
|
||||
%typemap{Ref<BridgeDetector>}{simple};
|
||||
%typemap{Clone<BridgeDetector>}{simple};
|
||||
%typemap{SurfaceCollection*};
|
||||
%typemap{Ref<SurfaceCollection>}{simple};
|
||||
%typemap{Clone<SurfaceCollection>}{simple};
|
||||
%typemap{PerimeterGenerator*};
|
||||
%typemap{Ref<PerimeterGenerator>}{simple};
|
||||
%typemap{Clone<PerimeterGenerator>}{simple};
|
||||
|
||||
%typemap{Surface*};
|
||||
%typemap{Ref<Surface>}{simple};
|
||||
%typemap{Clone<Surface>}{simple};
|
||||
|
||||
%typemap{PrintState*};
|
||||
%typemap{Ref<PrintState>}{simple};
|
||||
|
||||
%typemap{PrintRegion*};
|
||||
%typemap{Ref<PrintRegion>}{simple};
|
||||
|
||||
%typemap{PrintObject*};
|
||||
%typemap{Ref<PrintObject>}{simple};
|
||||
|
||||
%typemap{Print*};
|
||||
%typemap{Ref<Print>}{simple};
|
||||
%typemap{Clone<Print>}{simple};
|
||||
|
||||
%typemap{LayerRegion*};
|
||||
%typemap{Ref<LayerRegion>}{simple};
|
||||
|
||||
%typemap{Layer*};
|
||||
%typemap{Ref<Layer>}{simple};
|
||||
|
||||
%typemap{SupportLayer*};
|
||||
%typemap{Ref<SupportLayer>}{simple};
|
||||
|
||||
%typemap{PrintObjectSupportMaterial*};
|
||||
%typemap{Ref<PrintObjectSupportMaterial>}{simple};
|
||||
%typemap{Clone<PrintObjectSupportMaterial>}{simple};
|
||||
|
||||
%typemap{PlaceholderParser*};
|
||||
%typemap{Ref<PlaceholderParser>}{simple};
|
||||
%typemap{Clone<PlaceholderParser>}{simple};
|
||||
|
||||
%typemap{CoolingBuffer*};
|
||||
%typemap{Ref<CoolingBuffer>}{simple};
|
||||
%typemap{Clone<CoolingBuffer>}{simple};
|
||||
|
||||
%typemap{GCode*};
|
||||
%typemap{Ref<GCode>}{simple};
|
||||
%typemap{Clone<GCode>}{simple};
|
||||
|
||||
//%typemap{GCodePreviewData*};
|
||||
//%typemap{Ref<GCodePreviewData>}{simple};
|
||||
//%typemap{Clone<GCodePreviewData>}{simple};
|
||||
|
||||
%typemap{Points};
|
||||
%typemap{Pointfs};
|
||||
%typemap{Lines};
|
||||
%typemap{Polygons};
|
||||
%typemap{Polylines};
|
||||
%typemap{ExPolygons};
|
||||
%typemap{ExtrusionPaths};
|
||||
%typemap{Surfaces};
|
||||
%typemap{Polygons*};
|
||||
%typemap{TriangleMesh*};
|
||||
%typemap{Model*};
|
||||
%typemap{Ref<Model>}{simple};
|
||||
%typemap{Clone<Model>}{simple};
|
||||
%typemap{ModelMaterial*};
|
||||
%typemap{Ref<ModelMaterial>}{simple};
|
||||
%typemap{Clone<ModelMaterial>}{simple};
|
||||
%typemap{ModelObject*};
|
||||
%typemap{Ref<ModelObject>}{simple};
|
||||
%typemap{Clone<ModelObject>}{simple};
|
||||
%typemap{ModelObjectPtrs*};
|
||||
%typemap{Ref<ModelObjectPtrs>}{simple};
|
||||
%typemap{Clone<ModelObjectPtrs>}{simple};
|
||||
%typemap{ModelVolume*};
|
||||
%typemap{Ref<ModelVolume>}{simple};
|
||||
%typemap{Clone<ModelVolume>}{simple};
|
||||
%typemap{ModelVolumePtrs*};
|
||||
%typemap{Ref<ModelVolumePtrs>}{simple};
|
||||
%typemap{Clone<ModelVolumePtrs>}{simple};
|
||||
%typemap{ModelInstance*};
|
||||
%typemap{Ref<ModelInstance>}{simple};
|
||||
%typemap{Clone<ModelInstance>}{simple};
|
||||
%typemap{ModelInstancePtrs*};
|
||||
%typemap{Ref<ModelInstancePtrs>}{simple};
|
||||
%typemap{Clone<ModelInstancePtrs>}{simple};
|
||||
%typemap{PresetHints*};
|
||||
%typemap{Ref<PresetHints>}{simple};
|
||||
|
||||
%typemap{PrintRegionPtrs*};
|
||||
%typemap{PrintObjectPtrs*};
|
||||
%typemap{LayerPtrs*};
|
||||
%typemap{SupportLayerPtrs*};
|
||||
|
||||
%typemap{Axis}{parsed}{
|
||||
%cpp_type{Axis};
|
||||
%precall_code{%
|
||||
$CVar = (Axis)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{SurfaceType}{parsed}{
|
||||
%cpp_type{SurfaceType};
|
||||
%precall_code{%
|
||||
$CVar = (SurfaceType)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{ExtrusionLoopRole}{parsed}{
|
||||
%cpp_type{ExtrusionLoopRole};
|
||||
%precall_code{%
|
||||
$CVar = (ExtrusionLoopRole)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{ExtrusionRole}{parsed}{
|
||||
%cpp_type{ExtrusionRole};
|
||||
%precall_code{%
|
||||
$CVar = (ExtrusionRole)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{ExtrusionSimulationType}{parsed}{
|
||||
%cpp_type{ExtrusionSimulationType};
|
||||
%precall_code{%
|
||||
$CVar = (ExtrusionSimulationType)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{FlowRole}{parsed}{
|
||||
%cpp_type{FlowRole};
|
||||
%precall_code{%
|
||||
$CVar = (FlowRole)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{PrintStep}{parsed}{
|
||||
%cpp_type{PrintStep};
|
||||
%precall_code{%
|
||||
$CVar = (PrintStep)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
||||
%typemap{PrintObjectStep}{parsed}{
|
||||
%cpp_type{PrintObjectStep};
|
||||
%precall_code{%
|
||||
$CVar = (PrintObjectStep)SvUV($PerlVar);
|
||||
%};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue