Merge branch 'master' into sender

Conflicts:
	Build.PL
	lib/Slic3r.pm
	xs/MANIFEST
	xs/src/libslic3r/PrintConfig.hpp
This commit is contained in:
Alessandro Ranellucci 2015-11-01 19:12:13 +01:00
commit 9b21ac877a
93 changed files with 3339 additions and 2050 deletions

View file

@ -9,14 +9,10 @@
~BridgeDetector();
bool detect_angle();
Polygons coverage()
%code{% THIS->coverage(&RETVAL); %};
Polygons coverage_by_angle(double angle)
%code{% THIS->coverage(angle, &RETVAL); %};
Polylines unsupported_edges()
%code{% THIS->unsupported_edges(&RETVAL); %};
Polylines unsupported_edges_by_angle(double angle)
%code{% THIS->unsupported_edges(angle, &RETVAL); %};
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()

View file

@ -27,10 +27,10 @@
%code{% RETVAL = THIS->equals(*other); %};
void apply_static(FullPrintConfig* other)
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
%name{get_keys} std::vector<std::string> keys();
void erase(t_config_option_key opt_key);
void normalize();
%name{setenv} void setenv_();
};
%name{Slic3r::Config::GCode} class GCodeConfig {
@ -51,9 +51,9 @@
%code{% THIS->apply(*other, true); %};
void apply_dynamic(DynamicPrintConfig* other)
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
%name{get_keys} std::vector<std::string> keys();
std::string get_extrusion_axis();
%name{setenv} void setenv_();
};
%name{Slic3r::Config::Print} class PrintConfig {
@ -72,9 +72,9 @@
double get_abs_value(t_config_option_key opt_key, double ratio_over);
void apply_dynamic(DynamicPrintConfig* other)
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
%name{get_keys} std::vector<std::string> keys();
std::string get_extrusion_axis();
%name{setenv} void setenv_();
};
%name{Slic3r::Config::PrintRegion} class PrintRegionConfig {
@ -95,8 +95,8 @@
%code{% THIS->apply(*other, true); %};
void apply_dynamic(DynamicPrintConfig* other)
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
%name{get_keys} std::vector<std::string> keys();
%name{setenv} void setenv_();
};
%name{Slic3r::Config::PrintObject} class PrintObjectConfig {
@ -117,8 +117,8 @@
%code{% THIS->apply(*other, true); %};
void apply_dynamic(DynamicPrintConfig* other)
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
%name{get_keys} std::vector<std::string> keys();
%name{setenv} void setenv_();
};
%name{Slic3r::Config::Full} class FullPrintConfig {
@ -143,9 +143,9 @@
%code{% THIS->apply(*other, true); %};
void apply_dynamic(DynamicPrintConfig* other)
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
%name{get_keys} std::vector<std::string> keys();
std::string get_extrusion_axis();
%name{setenv} void setenv_();
};
%package{Slic3r::Config};

View file

@ -7,6 +7,7 @@
%name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection {
%name{_new} ExtrusionEntityCollection();
~ExtrusionEntityCollection();
Clone<ExtrusionEntityCollection> clone()
%code{% RETVAL = THIS->clone(); %};
void reverse();
@ -28,6 +29,12 @@
%code{% RETVAL = THIS->entities.size(); %};
int items_count()
%code{% RETVAL = THIS->items_count(); %};
ExtrusionEntityCollection* flatten()
%code{%
RETVAL = new ExtrusionEntityCollection();
THIS->flatten(RETVAL);
%};
double min_mm3_per_mm();
bool empty()
%code{% RETVAL = THIS->entities.empty(); %};
std::vector<size_t> orig_indices()
@ -35,14 +42,6 @@
Polygons grow();
%{
void
ExtrusionEntityCollection::DESTROY()
CODE:
for (ExtrusionEntitiesPtr::iterator it = THIS->entities.begin(); it != THIS->entities.end(); ++it) {
delete *it;
}
delete THIS;
SV*
ExtrusionEntityCollection::arrayref()
CODE:

View file

@ -38,9 +38,8 @@ ExtrusionLoop::arrayref()
CODE:
AV* av = newAV();
av_fill(av, THIS->paths.size()-1);
int i = 0;
for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) {
av_store(av, i++, perl_to_SV_ref(*it));
av_store(av, it - THIS->paths.begin(), perl_to_SV_ref(*it));
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:

View file

@ -26,9 +26,6 @@
bool is_infill();
bool is_solid_infill();
bool is_bridge();
std::string gcode(Extruder* extruder, double e, double F,
double xofs, double yofs, std::string extrusion_axis,
std::string gcode_line_suffix);
Polygons grow();
%{
@ -133,6 +130,7 @@ ExtrusionPath::subtract_expolygons(ExPolygonCollection* collection)
IV
_constant()
ALIAS:
EXTR_ROLE_NONE = erNone
EXTR_ROLE_PERIMETER = erPerimeter
EXTR_ROLE_EXTERNAL_PERIMETER = erExternalPerimeter
EXTR_ROLE_OVERHANG_PERIMETER = erOverhangPerimeter

183
xs/xsp/GCode.xsp Normal file
View file

@ -0,0 +1,183 @@
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "libslic3r/GCode.hpp"
%}
%name{Slic3r::GCode::AvoidCrossingPerimeters} class AvoidCrossingPerimeters {
AvoidCrossingPerimeters();
~AvoidCrossingPerimeters();
void init_external_mp(ExPolygons islands);
void init_layer_mp(ExPolygons islands);
Clone<Polyline> travel_to(GCode* gcode, Point* point)
%code{% RETVAL = THIS->travel_to(*gcode, *point); %};
bool use_external_mp()
%code{% RETVAL = THIS->use_external_mp; %};
void set_use_external_mp(bool value)
%code{% THIS->use_external_mp = value; %};
bool use_external_mp_once()
%code{% RETVAL = THIS->use_external_mp_once; %};
void set_use_external_mp_once(bool value)
%code{% THIS->use_external_mp_once = value; %};
bool disable_once()
%code{% RETVAL = THIS->disable_once; %};
void set_disable_once(bool value)
%code{% THIS->disable_once = value; %};
};
%name{Slic3r::GCode::OozePrevention} class OozePrevention {
OozePrevention();
~OozePrevention();
bool enable()
%code{% RETVAL = THIS->enable; %};
void set_enable(bool value)
%code{% THIS->enable = value; %};
Points standby_points()
%code{% RETVAL = THIS->standby_points; %};
void set_standby_points(Points points)
%code{% THIS->standby_points = points; %};
std::string pre_toolchange(GCode* gcodegen)
%code{% RETVAL = THIS->pre_toolchange(*gcodegen); %};
std::string post_toolchange(GCode* gcodegen)
%code{% RETVAL = THIS->post_toolchange(*gcodegen); %};
};
%name{Slic3r::GCode::Wipe} class Wipe {
Wipe();
~Wipe();
bool has_path();
void reset_path();
std::string wipe(GCode* gcodegen, bool toolchange = false)
%code{% RETVAL = THIS->wipe(*gcodegen, toolchange); %};
bool enable()
%code{% RETVAL = THIS->enable; %};
void set_enable(bool value)
%code{% THIS->enable = value; %};
Ref<Polyline> path()
%code{% RETVAL = &(THIS->path); %};
void set_path(Polyline* value)
%code{% THIS->path = *value; %};
};
%name{Slic3r::GCode} class GCode {
GCode();
~GCode();
Ref<Pointf> origin()
%code{% RETVAL = &(THIS->origin); %};
Ref<FullPrintConfig> config()
%code{% RETVAL = &(THIS->config); %};
Ref<GCodeWriter> writer()
%code{% RETVAL = &(THIS->writer); %};
Ref<PlaceholderParser> placeholder_parser()
%code{% RETVAL = THIS->placeholder_parser; %};
void set_placeholder_parser(PlaceholderParser* ptr)
%code{% THIS->placeholder_parser = ptr; %};
Ref<OozePrevention> ooze_prevention()
%code{% RETVAL = &(THIS->ooze_prevention); %};
Ref<Wipe> wipe()
%code{% RETVAL = &(THIS->wipe); %};
Ref<AvoidCrossingPerimeters> avoid_crossing_perimeters()
%code{% RETVAL = &(THIS->avoid_crossing_perimeters); %};
bool enable_loop_clipping()
%code{% RETVAL = THIS->enable_loop_clipping; %};
void set_enable_loop_clipping(bool value)
%code{% THIS->enable_loop_clipping = value; %};
bool enable_cooling_markers()
%code{% RETVAL = THIS->enable_cooling_markers; %};
void set_enable_cooling_markers(bool value)
%code{% THIS->enable_cooling_markers = value; %};
int layer_count()
%code{% RETVAL = THIS->layer_count; %};
void set_layer_count(int value)
%code{% THIS->layer_count = value; %};
int layer_index()
%code{% RETVAL = THIS->layer_index; %};
void set_layer_index(int value)
%code{% THIS->layer_index = value; %};
bool has_layer()
%code{% RETVAL = THIS->layer != NULL; %};
Ref<Layer> layer()
%code{% RETVAL = THIS->layer; %};
void set_layer(Layer* ptr)
%code{% THIS->layer = ptr; %};
bool first_layer()
%code{% RETVAL = THIS->first_layer; %};
void set_first_layer(bool value)
%code{% THIS->first_layer = value; %};
unsigned int elapsed_time()
%code{% RETVAL = THIS->elapsed_time; %};
void set_elapsed_time(unsigned int value)
%code{% THIS->elapsed_time = value; %};
bool last_pos_defined();
Ref<Point> last_pos()
%code{% RETVAL = &(THIS->last_pos()); %};
void set_last_pos(Point* pos)
%code{% THIS->set_last_pos(*pos); %};
double volumetric_speed()
%code{% RETVAL = THIS->volumetric_speed; %};
void set_volumetric_speed(double value)
%code{% THIS->volumetric_speed = value; %};
void apply_print_config(PrintConfig* print_config)
%code{% THIS->apply_print_config(*print_config); %};
void set_extruders(std::vector<unsigned int> extruder_ids);
void set_origin(Pointf* pointf)
%code{% THIS->set_origin(*pointf); %};
std::string preamble();
std::string change_layer(Layer* layer)
%code{% RETVAL = THIS->change_layer(*layer); %};
%name{extrude_loop} std::string extrude(ExtrusionLoop* loop, std::string description = "", double speed = -1)
%code{% RETVAL = THIS->extrude(*loop, description, speed); %};
%name{extrude_path} std::string extrude(ExtrusionPath* path, std::string description = "", double speed = -1)
%code{% RETVAL = THIS->extrude(*path, description, speed); %};
std::string travel_to(Point* point, ExtrusionRole role, std::string comment)
%code{% RETVAL = THIS->travel_to(*point, role, comment); %};
bool needs_retraction(Polyline* travel, ExtrusionRole role = erNone)
%code{% RETVAL = THIS->needs_retraction(*travel, role); %};
std::string retract(bool toolchange = false);
std::string unretract();
std::string set_extruder(unsigned int extruder_id);
Clone<Pointf> point_to_gcode(Point* point)
%code{% RETVAL = THIS->point_to_gcode(*point); %};
%{
std::string
GCode::extrude(entity, description, speed)
SV* entity
std::string description;
double speed;
CODE:
ExtrusionEntity* e = (ExtrusionEntity *)SvIV((SV*)SvRV( entity ));
RETVAL = THIS->extrude(*e, description, speed);
OUTPUT:
RETVAL
%}
};

View file

@ -17,8 +17,8 @@
%code%{ RETVAL = &THIS->thin_fills; %};
Ref<SurfaceCollection> fill_surfaces()
%code%{ RETVAL = &THIS->fill_surfaces; %};
Ref<ExPolygonCollection> bridged()
%code%{ RETVAL = &THIS->bridged; %};
Polygons bridged()
%code%{ RETVAL = THIS->bridged; %};
Ref<PolylineCollection> unsupported_bridge_edges()
%code%{ RETVAL = &THIS->unsupported_bridge_edges; %};
Ref<ExtrusionEntityCollection> perimeters()
@ -30,10 +30,16 @@
%code%{ RETVAL = THIS->flow(role, bridge, width); %};
void merge_slices();
void prepare_fill_surfaces();
void make_perimeters(SurfaceCollection* slices, SurfaceCollection* fill_surfaces)
%code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
double infill_area_threshold();
};
%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);
@ -70,6 +76,9 @@
int ptr()
%code%{ RETVAL = (int)(intptr_t)THIS; %};
Ref<SupportLayer> as_support_layer()
%code%{ RETVAL = dynamic_cast<SupportLayer*>(THIS); %};
void make_slices();
void merge_slices();
bool any_internal_region_slice_contains_polyline(Polyline* polyline)
@ -80,7 +89,10 @@
%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()

View file

@ -0,0 +1,34 @@
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "libslic3r/PerimeterGenerator.hpp"
%}
%name{Slic3r::Layer::PerimeterGenerator} class PerimeterGenerator {
PerimeterGenerator(SurfaceCollection* slices, double layer_height, Flow* flow,
PrintRegionConfig* config, PrintObjectConfig* object_config,
PrintConfig* print_config, ExtrusionEntityCollection* loops,
ExtrusionEntityCollection* gap_fill, SurfaceCollection* fill_surfaces)
%code{% RETVAL = new PerimeterGenerator(slices, layer_height, *flow,
config, object_config, print_config, loops, gap_fill, fill_surfaces); %};
~PerimeterGenerator();
void set_lower_slices(ExPolygonCollection* lower_slices)
%code{% THIS->lower_slices = lower_slices; %};
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<PrintRegionConfig> config()
%code{% RETVAL = THIS->config; %};
void process();
};

View file

@ -7,39 +7,16 @@
%}
%name{Slic3r::GCode::PlaceholderParser} class PlaceholderParser {
%name{_new} PlaceholderParser();
PlaceholderParser();
~PlaceholderParser();
Clone<PlaceholderParser> clone()
%code{% RETVAL = THIS; %};
void update_timestamp();
void apply_env_variables();
void apply_config(DynamicPrintConfig *config)
%code%{ THIS->apply_config(*config); %};
void set(std::string key, std::string value);
void set_multiple(std::string key, std::vector<std::string> values)
%code%{ THIS->set(key, values); %};
void _single_set(std::string k, std::string v)
%code%{ THIS->_single[k] = v; %};
std::string _single_get(std::string k)
%code%{ RETVAL = THIS->_single[k]; %};
std::string _multiple_get(std::string k)
%code%{ RETVAL = THIS->_multiple[k]; %};
std::vector<std::string> _single_keys()
%code{%
for (std::map<std::string, std::string>::iterator i = THIS->_single.begin();
i != THIS->_single.end(); ++i)
{
RETVAL.push_back(i->first);
}
%};
std::vector<std::string> _multiple_keys()
%code{%
for (std::map<std::string, std::string>::iterator i = THIS->_multiple.begin();
i != THIS->_multiple.end(); ++i)
{
RETVAL.push_back(i->first);
}
%};
%name{set_multiple} void set(std::string key, std::vector<std::string> values);
std::string process(std::string str) const;
};

View file

@ -107,6 +107,7 @@ _constant()
void set_step_started(PrintObjectStep step)
%code%{ THIS->state.set_started(step); %};
void process_external_surfaces();
void bridge_over_infill();
int ptr()
@ -115,7 +116,7 @@ _constant()
%name{Slic3r::Print} class Print {
%name{_new} Print();
Print();
~Print();
Ref<PrintConfig> config()

View file

@ -170,6 +170,22 @@ PlaceholderParser* O_OBJECT_SLIC3R
Ref<PlaceholderParser> O_OBJECT_SLIC3R_T
Clone<PlaceholderParser> O_OBJECT_SLIC3R_T
AvoidCrossingPerimeters* O_OBJECT_SLIC3R
Ref<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
Clone<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
Wipe* O_OBJECT_SLIC3R
Ref<Wipe> O_OBJECT_SLIC3R_T
Clone<Wipe> O_OBJECT_SLIC3R_T
OozePrevention* O_OBJECT_SLIC3R
Ref<OozePrevention> O_OBJECT_SLIC3R_T
Clone<OozePrevention> O_OBJECT_SLIC3R_T
GCode* O_OBJECT_SLIC3R
Ref<GCode> O_OBJECT_SLIC3R_T
Clone<GCode> O_OBJECT_SLIC3R_T
MotionPlanner* O_OBJECT_SLIC3R
Ref<MotionPlanner> O_OBJECT_SLIC3R_T
Clone<MotionPlanner> O_OBJECT_SLIC3R_T
@ -186,6 +202,10 @@ 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
GLVertexArray* O_OBJECT_SLIC3R
Axis T_UV

View file

@ -97,6 +97,12 @@
%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};
@ -128,6 +134,22 @@
%typemap{Ref<PlaceholderParser>}{simple};
%typemap{Clone<PlaceholderParser>}{simple};
%typemap{AvoidCrossingPerimeters*};
%typemap{Ref<AvoidCrossingPerimeters>}{simple};
%typemap{Clone<AvoidCrossingPerimeters>}{simple};
%typemap{Wipe*};
%typemap{Ref<Wipe>}{simple};
%typemap{Clone<Wipe>}{simple};
%typemap{OozePrevention*};
%typemap{Ref<OozePrevention>}{simple};
%typemap{Clone<OozePrevention>}{simple};
%typemap{GCode*};
%typemap{Ref<GCode>}{simple};
%typemap{Clone<GCode>}{simple};
%typemap{Points};
%typemap{Pointfs};
@ -140,7 +162,6 @@
%typemap{Polygons*};
%typemap{TriangleMesh*};
%typemap{TriangleMeshPtrs};
%typemap{Ref<SurfaceCollection>}{simple};
%typemap{Extruder*};
%typemap{Ref<Extruder>}{simple};
%typemap{Clone<Extruder>}{simple};