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()
2018-09-11 12:04:47 +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
int region_count()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = THIS->print()->regions().size(); %};
2014-05-06 08:07:18 +00:00
2018-05-28 11:43:29 +00:00
int region_volumes_count()
%code%{ RETVAL = THIS->region_volumes.size(); %};
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()
2018-09-11 12:04:47 +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; %};
2015-01-19 17:53:04 +00:00
Clone<BoundingBox> bounding_box();
2014-07-15 17:07:38 +00:00
2014-05-06 08:07:18 +00:00
Points _shifted_copies()
2018-09-12 09:59:02 +00:00
%code%{ RETVAL = THIS->copies(); %};
2014-05-06 08:07:18 +00:00
2018-08-21 19:05:24 +00:00
bool add_copy(Vec2d* point)
2014-11-12 23:34:56 +00:00
%code%{ RETVAL = THIS->add_copy(*point); %};
bool delete_last_copy();
2014-11-12 22:28:42 +00:00
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; %};
size_t layer_count();
Ref<Layer> get_layer(int idx);
size_t support_layer_count();
Ref<SupportLayer> get_support_layer(int idx);
2017-05-30 16:33:17 +00:00
2014-06-10 22:15:02 +00:00
bool step_done(PrintObjectStep step)
2018-03-28 15:05:31 +00:00
%code%{ RETVAL = THIS->is_step_done(step); %};
2017-02-07 17:17:12 +00:00
2018-03-23 15:00:00 +00:00
void slice();
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()
2018-09-12 09:59:02 +00:00
%code%{ RETVAL = const_cast<GCodeConfig*>(static_cast<const GCodeConfig*>(&THIS->config())); %};
2014-05-06 08:07:18 +00:00
Ref<PlaceholderParser> placeholder_parser()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = &THIS->placeholder_parser(); %};
2014-05-06 08:07:18 +00:00
Ref<ExtrusionEntityCollection> skirt()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = const_cast<ExtrusionEntityCollection*>(&THIS->skirt()); %};
2014-05-06 08:07:18 +00:00
Ref<ExtrusionEntityCollection> brim()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = const_cast<ExtrusionEntityCollection*>(&THIS->brim()); %};
2018-06-27 13:35:47 +00:00
std::string estimated_normal_print_time()
2018-09-12 09:59:02 +00:00
%code%{ RETVAL = THIS->print_statistics().estimated_normal_print_time; %};
2018-05-30 10:08:03 +00:00
std::string estimated_silent_print_time()
2018-09-12 09:59:02 +00:00
%code%{ RETVAL = THIS->print_statistics().estimated_silent_print_time; %};
2018-09-11 12:04:47 +00:00
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; %};
2018-09-17 13:12:13 +00:00
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; %};
2014-05-06 08:07:18 +00:00
PrintObjectPtrs* objects()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = const_cast<PrintObjectPtrs*>(&THIS->objects()); %};
2014-05-06 08:07:18 +00:00
void clear_objects();
2018-09-11 12:04:47 +00:00
Ref<PrintObject> get_object(int idx)
%code%{ RETVAL = THIS->objects()[idx]; %};
2014-05-06 08:07:18 +00:00
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()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = THIS->objects().size(); %};
2014-05-06 08:07:18 +00:00
PrintRegionPtrs* regions()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = const_cast<PrintRegionPtrs*>(&THIS->regions()); %};
Ref<PrintRegion> get_region(int idx)
%code%{ RETVAL = THIS->regions()[idx]; %};
2014-05-06 08:07:18 +00:00
size_t region_count()
2018-09-11 12:04:47 +00:00
%code%{ RETVAL = THIS->regions().size(); %};
2014-06-10 22:15:02 +00:00
bool step_done(PrintStep step)
2018-03-28 15:05:31 +00:00
%code%{ RETVAL = THIS->is_step_done(step); %};
2014-11-30 19:18:09 +00:00
bool object_step_done(PrintObjectStep step)
2018-03-28 15:05:31 +00:00
%code%{ RETVAL = THIS->is_step_done(step); %};
2014-08-03 16:41:09 +00:00
2015-01-03 22:25:55 +00:00
SV* filament_stats()
%code%{
HV* hv = newHV();
2018-09-11 12:04:47 +00:00
for (std::map<size_t,float>::const_iterator it = THIS->print_statistics().filament_stats.begin(); it != THIS->print_statistics().filament_stats.end(); ++it) {
2015-01-03 22:25:55 +00:00
// 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
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);
2017-12-05 14:54:24 +00:00
std::string output_filepath(std::string path = "")
%code%{
try {
RETVAL = THIS->output_filepath(path);
} catch (std::exception& e) {
2018-03-21 07:38:33 +00:00
croak("%s\n", e.what());
2017-12-05 14:54:24 +00:00
}
%};
2018-05-15 16:01:47 +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();
2017-05-30 15:24:50 +00:00
std::vector<unsigned int> extruders() const;
2017-12-01 17:55:57 +00:00
int validate() %code%{
2017-10-27 19:28:39 +00:00
std::string err = THIS->validate();
2017-12-01 17:55:57 +00:00
if (! err.empty())
croak("Configuration is not valid: %s\n", err.c_str());
RETVAL = 1;
2017-10-27 19:28:39 +00:00
%};
2014-12-12 18:14:52 +00:00
Clone<BoundingBox> bounding_box();
Clone<BoundingBox> total_bounding_box();
2018-09-17 10:01:02 +00:00
Clone<Point> size() %code%{ RETVAL = THIS->bounding_box().size(); %};
2017-02-15 10:05:52 +00:00
2018-03-23 10:41:20 +00:00
void set_callback_event(int evt) %code%{
%};
2018-03-23 15:00:00 +00:00
void set_status_silent();
2018-09-14 08:25:20 +00:00
void set_status(int percent, const char *message);
2017-05-25 20:27:53 +00:00
2018-03-23 10:41:20 +00:00
void process() %code%{
try {
THIS->process();
} catch (std::exception& e) {
croak(e.what());
}
%};
2018-10-24 11:59:24 +00:00
void export_gcode(char *path_template) %code%{
try {
THIS->export_gcode(path_template, nullptr);
} catch (std::exception& e) {
croak(e.what());
}
%};
2018-09-17 10:01:02 +00:00
void export_png(char *path) %code%{
try {
THIS->export_png(path);
} catch (std::exception& e) {
croak(e.what());
}
%};
2014-05-06 08:07:18 +00:00
};