2013-12-20 00:36:42 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-07 23:39:54 +00:00
|
|
|
#include <xsinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/Print.hpp"
|
|
|
|
#include "libslic3r/PlaceholderParser.hpp"
|
2013-12-20 00:36:42 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%package{Slic3r::Print::State};
|
|
|
|
%{
|
|
|
|
|
|
|
|
IV
|
|
|
|
_constant()
|
|
|
|
ALIAS:
|
2014-06-10 22:15:02 +00:00
|
|
|
STEP_SLICE = posSlice
|
|
|
|
STEP_PERIMETERS = posPerimeters
|
|
|
|
STEP_PREPARE_INFILL = posPrepareInfill
|
|
|
|
STEP_INFILL = posInfill
|
|
|
|
STEP_SUPPORTMATERIAL = posSupportMaterial
|
2013-12-20 00:36:42 +00:00
|
|
|
STEP_SKIRT = psSkirt
|
|
|
|
STEP_BRIM = psBrim
|
2017-05-25 20:27:53 +00:00
|
|
|
STEP_WIPE_TOWER = psWipeTower
|
2013-12-20 00:36:42 +00:00
|
|
|
PROTOTYPE:
|
|
|
|
CODE:
|
|
|
|
RETVAL = ix;
|
|
|
|
OUTPUT: RETVAL
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
|
|
|
|
%name{Slic3r::Print::Region} class PrintRegion {
|
|
|
|
// owned by Print, no constructor/destructor
|
|
|
|
|
2015-12-16 11:33:19 +00:00
|
|
|
Ref<StaticPrintConfig> config()
|
2014-05-06 08:07:18 +00:00
|
|
|
%code%{ RETVAL = &THIS->config; %};
|
2014-05-19 20:38:10 +00:00
|
|
|
Ref<Print> print();
|
2014-08-03 17:17:23 +00:00
|
|
|
|
2015-01-19 17:53:04 +00:00
|
|
|
Clone<Flow> flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
|
|
|
|
%code%{ RETVAL = THIS->flow(role, layer_height, bridge, first_layer, width, *object); %};
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Print::Object} class PrintObject {
|
|
|
|
// owned by Print, no constructor/destructor
|
|
|
|
|
|
|
|
void add_region_volume(int region_id, int volume_id);
|
|
|
|
std::vector<int> get_region_volumes(int region_id)
|
|
|
|
%code%{
|
|
|
|
if (0 <= region_id && region_id < THIS->region_volumes.size())
|
|
|
|
RETVAL = THIS->region_volumes[region_id];
|
|
|
|
%};
|
|
|
|
int region_count()
|
2014-05-19 20:38:10 +00:00
|
|
|
%code%{ RETVAL = THIS->print()->regions.size(); %};
|
2014-05-06 08:07:18 +00:00
|
|
|
|
2014-05-19 20:38:10 +00:00
|
|
|
Ref<Print> print();
|
|
|
|
Ref<ModelObject> model_object();
|
2015-12-16 11:33:19 +00:00
|
|
|
Ref<StaticPrintConfig> config()
|
2014-05-06 08:07:18 +00:00
|
|
|
%code%{ RETVAL = &THIS->config; %};
|
2014-11-09 11:25:59 +00:00
|
|
|
Points copies();
|
2014-05-06 08:07:18 +00:00
|
|
|
t_layer_height_ranges layer_height_ranges()
|
|
|
|
%code%{ RETVAL = THIS->layer_height_ranges; %};
|
2016-12-12 16:53:38 +00:00
|
|
|
std::vector<double> layer_height_profile()
|
|
|
|
%code%{ RETVAL = THIS->layer_height_profile; %};
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<Point3> size()
|
|
|
|
%code%{ RETVAL = &THIS->size; %};
|
2015-01-19 17:53:04 +00:00
|
|
|
Clone<BoundingBox> bounding_box();
|
2014-07-15 17:07:38 +00:00
|
|
|
|
|
|
|
bool typed_slices()
|
|
|
|
%code%{ RETVAL = THIS->typed_slices; %};
|
|
|
|
void set_typed_slices(bool value)
|
|
|
|
%code%{ THIS->typed_slices = value; %};
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
Points _shifted_copies()
|
|
|
|
%code%{ RETVAL = THIS->_shifted_copies; %};
|
|
|
|
void set_shifted_copies(Points value)
|
|
|
|
%code%{ THIS->_shifted_copies = value; %};
|
|
|
|
|
2014-11-12 23:34:56 +00:00
|
|
|
bool add_copy(Pointf* point)
|
|
|
|
%code%{ RETVAL = THIS->add_copy(*point); %};
|
|
|
|
bool delete_last_copy();
|
|
|
|
bool delete_all_copies();
|
2014-11-12 22:28:42 +00:00
|
|
|
bool set_copies(Points copies);
|
|
|
|
bool reload_model_instances();
|
2014-05-06 08:07:18 +00:00
|
|
|
void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges)
|
|
|
|
%code%{ THIS->layer_height_ranges = layer_height_ranges; %};
|
2016-12-12 16:53:38 +00:00
|
|
|
void set_layer_height_profile(std::vector<double> profile)
|
|
|
|
%code%{ THIS->layer_height_profile = profile; %};
|
2014-05-06 08:07:18 +00:00
|
|
|
|
2014-11-30 21:01:46 +00:00
|
|
|
size_t total_layer_count();
|
2014-05-06 08:07:18 +00:00
|
|
|
size_t layer_count();
|
|
|
|
void clear_layers();
|
|
|
|
Ref<Layer> get_layer(int idx);
|
|
|
|
Ref<Layer> add_layer(int id, coordf_t height, coordf_t print_z,
|
|
|
|
coordf_t slice_z);
|
|
|
|
|
|
|
|
size_t support_layer_count();
|
|
|
|
void clear_support_layers();
|
|
|
|
Ref<SupportLayer> get_support_layer(int idx);
|
2015-01-30 17:45:30 +00:00
|
|
|
Ref<SupportLayer> add_support_layer(int id, coordf_t height, coordf_t print_z);
|
2017-05-30 16:33:17 +00:00
|
|
|
|
2014-06-10 22:15:02 +00:00
|
|
|
bool step_done(PrintObjectStep step)
|
2014-06-13 09:19:53 +00:00
|
|
|
%code%{ RETVAL = THIS->state.is_done(step); %};
|
2014-06-10 22:15:02 +00:00
|
|
|
void set_step_done(PrintObjectStep step)
|
|
|
|
%code%{ THIS->state.set_done(step); %};
|
|
|
|
void set_step_started(PrintObjectStep step)
|
|
|
|
%code%{ THIS->state.set_started(step); %};
|
2016-12-12 16:53:38 +00:00
|
|
|
|
|
|
|
void _slice();
|
2017-03-08 10:56:42 +00:00
|
|
|
std::string _fix_slicing_errors();
|
2017-03-08 12:43:49 +00:00
|
|
|
void _simplify_slices(double distance);
|
2016-11-10 18:23:01 +00:00
|
|
|
void detect_surfaces_type();
|
2015-10-26 22:23:03 +00:00
|
|
|
void process_external_surfaces();
|
2016-09-26 11:56:24 +00:00
|
|
|
void discover_vertical_shells();
|
2014-12-24 09:20:55 +00:00
|
|
|
void bridge_over_infill();
|
2016-11-26 11:28:39 +00:00
|
|
|
void _make_perimeters();
|
|
|
|
void _infill();
|
2016-12-20 11:19:13 +00:00
|
|
|
void _generate_support_material();
|
2016-12-12 16:53:38 +00:00
|
|
|
|
2017-02-09 13:56:13 +00:00
|
|
|
std::vector<double> get_layer_height_min_max()
|
|
|
|
%code%{
|
|
|
|
SlicingParameters slicing_params = THIS->slicing_parameters();
|
|
|
|
RETVAL.push_back(slicing_params.min_layer_height);
|
|
|
|
RETVAL.push_back(slicing_params.max_layer_height);
|
|
|
|
RETVAL.push_back(slicing_params.first_print_layer_height);
|
|
|
|
RETVAL.push_back(slicing_params.first_object_layer_height);
|
|
|
|
RETVAL.push_back(slicing_params.layer_height);
|
|
|
|
%};
|
2017-02-07 17:17:12 +00:00
|
|
|
|
2016-12-12 16:53:38 +00:00
|
|
|
void adjust_layer_height_profile(coordf_t z, coordf_t layer_thickness_delta, coordf_t band_width, int action)
|
2017-02-09 13:56:13 +00:00
|
|
|
%code%{
|
|
|
|
THIS->update_layer_height_profile(THIS->model_object()->layer_height_profile);
|
2016-12-12 16:53:38 +00:00
|
|
|
adjust_layer_height_profile(
|
2017-02-09 13:56:13 +00:00
|
|
|
THIS->slicing_parameters(), THIS->model_object()->layer_height_profile, z, layer_thickness_delta, band_width, LayerHeightEditActionType(action));
|
|
|
|
THIS->model_object()->layer_height_profile_valid = true;
|
|
|
|
THIS->layer_height_profile_valid = false;
|
2016-12-12 16:53:38 +00:00
|
|
|
%};
|
2017-02-09 13:56:13 +00:00
|
|
|
|
|
|
|
void reset_layer_height_profile();
|
2016-12-12 16:53:38 +00:00
|
|
|
|
2014-06-10 14:01:57 +00:00
|
|
|
int ptr()
|
|
|
|
%code%{ RETVAL = (int)(intptr_t)THIS; %};
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Print} class Print {
|
2015-07-01 17:35:22 +00:00
|
|
|
Print();
|
2014-05-06 08:07:18 +00:00
|
|
|
~Print();
|
|
|
|
|
2015-12-16 11:33:19 +00:00
|
|
|
Ref<StaticPrintConfig> config()
|
2014-05-06 08:07:18 +00:00
|
|
|
%code%{ RETVAL = &THIS->config; %};
|
2015-12-16 11:33:19 +00:00
|
|
|
Ref<StaticPrintConfig> default_object_config()
|
2014-05-06 08:07:18 +00:00
|
|
|
%code%{ RETVAL = &THIS->default_object_config; %};
|
2015-12-16 11:33:19 +00:00
|
|
|
Ref<StaticPrintConfig> default_region_config()
|
2014-05-06 08:07:18 +00:00
|
|
|
%code%{ RETVAL = &THIS->default_region_config; %};
|
|
|
|
Ref<PlaceholderParser> placeholder_parser()
|
|
|
|
%code%{ RETVAL = &THIS->placeholder_parser; %};
|
|
|
|
// TODO: status_cb
|
|
|
|
Ref<ExtrusionEntityCollection> skirt()
|
|
|
|
%code%{ RETVAL = &THIS->skirt; %};
|
|
|
|
Ref<ExtrusionEntityCollection> brim()
|
|
|
|
%code%{ RETVAL = &THIS->brim; %};
|
|
|
|
|
|
|
|
PrintObjectPtrs* objects()
|
|
|
|
%code%{ RETVAL = &THIS->objects; %};
|
|
|
|
void clear_objects();
|
|
|
|
Ref<PrintObject> get_object(int idx);
|
|
|
|
void delete_object(int idx);
|
2014-11-07 19:25:05 +00:00
|
|
|
void reload_object(int idx);
|
2014-12-29 21:29:24 +00:00
|
|
|
bool reload_model_instances();
|
2014-05-06 08:07:18 +00:00
|
|
|
size_t object_count()
|
|
|
|
%code%{ RETVAL = THIS->objects.size(); %};
|
|
|
|
|
|
|
|
PrintRegionPtrs* regions()
|
|
|
|
%code%{ RETVAL = &THIS->regions; %};
|
|
|
|
Ref<PrintRegion> get_region(int idx);
|
|
|
|
Ref<PrintRegion> add_region();
|
|
|
|
size_t region_count()
|
|
|
|
%code%{ RETVAL = THIS->regions.size(); %};
|
2014-06-10 22:15:02 +00:00
|
|
|
|
|
|
|
bool step_done(PrintStep step)
|
2014-06-13 09:19:53 +00:00
|
|
|
%code%{ RETVAL = THIS->state.is_done(step); %};
|
2014-11-30 19:18:09 +00:00
|
|
|
bool object_step_done(PrintObjectStep step)
|
|
|
|
%code%{ RETVAL = THIS->step_done(step); %};
|
2014-06-10 22:15:02 +00:00
|
|
|
void set_step_done(PrintStep step)
|
|
|
|
%code%{ THIS->state.set_done(step); %};
|
|
|
|
void set_step_started(PrintStep step)
|
|
|
|
%code%{ THIS->state.set_started(step); %};
|
2014-08-03 16:41:09 +00:00
|
|
|
|
2015-01-03 22:25:55 +00:00
|
|
|
void clear_filament_stats()
|
|
|
|
%code%{
|
|
|
|
THIS->filament_stats.clear();
|
|
|
|
%};
|
|
|
|
void set_filament_stats(int extruder_id, float length)
|
|
|
|
%code%{
|
|
|
|
THIS->filament_stats.insert(std::pair<size_t,float>(extruder_id, 0));
|
|
|
|
THIS->filament_stats[extruder_id] += length;
|
|
|
|
%};
|
|
|
|
SV* filament_stats()
|
|
|
|
%code%{
|
|
|
|
HV* hv = newHV();
|
|
|
|
for (std::map<size_t,float>::const_iterator it = THIS->filament_stats.begin(); it != THIS->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);
|
|
|
|
}
|
|
|
|
%};
|
2014-08-03 16:41:09 +00:00
|
|
|
void _simplify_slices(double distance);
|
|
|
|
double max_allowed_layer_height() const;
|
|
|
|
bool has_support_material() const;
|
2015-12-02 17:29:33 +00:00
|
|
|
void auto_assign_extruders(ModelObject* model_object);
|
2016-12-20 18:01:51 +00:00
|
|
|
std::string output_filename();
|
|
|
|
std::string output_filepath(std::string path = "");
|
2014-08-03 16:41:09 +00:00
|
|
|
|
2014-11-09 11:25:59 +00:00
|
|
|
void add_model_object(ModelObject* model_object, int idx = -1);
|
|
|
|
bool apply_config(DynamicPrintConfig* config)
|
|
|
|
%code%{ RETVAL = THIS->apply_config(*config); %};
|
2015-03-06 08:56:58 +00:00
|
|
|
bool has_infinite_skirt();
|
|
|
|
bool has_skirt();
|
2017-05-30 15:24:50 +00:00
|
|
|
std::vector<unsigned int> extruders() const;
|
2016-11-05 01:23:46 +00:00
|
|
|
std::string _validate()
|
|
|
|
%code%{ RETVAL = THIS->validate(); %};
|
2014-12-12 18:14:52 +00:00
|
|
|
Clone<BoundingBox> bounding_box();
|
|
|
|
Clone<BoundingBox> total_bounding_box();
|
|
|
|
double skirt_first_layer_height();
|
2014-12-16 23:45:05 +00:00
|
|
|
Clone<Flow> brim_flow();
|
2014-12-12 18:14:52 +00:00
|
|
|
Clone<Flow> skirt_flow();
|
2017-02-15 10:05:52 +00:00
|
|
|
|
|
|
|
void _make_skirt();
|
2017-05-25 20:27:53 +00:00
|
|
|
|
|
|
|
bool has_wipe_tower();
|
|
|
|
void _clear_wipe_tower();
|
|
|
|
void _make_wipe_tower();
|
|
|
|
|
2014-05-24 21:53:00 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
double
|
|
|
|
Print::total_used_filament(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->total_used_filament = (double)SvNV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->total_used_filament;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
double
|
|
|
|
Print::total_extruded_volume(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->total_extruded_volume = (double)SvNV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->total_extruded_volume;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2017-01-16 07:00:05 +00:00
|
|
|
|
|
|
|
double
|
|
|
|
Print::total_weight(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->total_weight = (double)SvNV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->total_weight;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
double
|
|
|
|
Print::total_cost(...)
|
|
|
|
CODE:
|
|
|
|
if (items > 1) {
|
|
|
|
THIS->total_cost = (double)SvNV(ST(1));
|
|
|
|
}
|
|
|
|
RETVAL = THIS->total_cost;
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2014-05-24 21:53:00 +00:00
|
|
|
%}
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|