2013-12-20 01:36:42 +01:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-08 00:39:54 +01:00
|
|
|
#include <xsinit.h>
|
2014-08-03 19:42:29 +02:00
|
|
|
#include "libslic3r/Print.hpp"
|
2013-12-20 01:36:42 +01:00
|
|
|
%}
|
|
|
|
|
2014-05-06 11:07:18 +03:00
|
|
|
%name{Slic3r::Print} class Print {
|
2015-07-01 19:35:22 +02:00
|
|
|
Print();
|
2014-05-06 11:07:18 +03:00
|
|
|
~Print();
|
|
|
|
|
2019-06-20 20:23:05 +02:00
|
|
|
Ref<Model> model()
|
|
|
|
%code%{ RETVAL = const_cast<Model*>(&THIS->model()); %};
|
2015-12-16 12:33:19 +01:00
|
|
|
Ref<StaticPrintConfig> config()
|
2018-09-12 11:59:02 +02:00
|
|
|
%code%{ RETVAL = const_cast<GCodeConfig*>(static_cast<const GCodeConfig*>(&THIS->config())); %};
|
2018-09-11 14:04:47 +02:00
|
|
|
double total_used_filament()
|
|
|
|
%code%{ RETVAL = THIS->print_statistics().total_used_filament; %};
|
2014-06-11 00:15:02 +02:00
|
|
|
|
2015-12-02 18:29:33 +01:00
|
|
|
void auto_assign_extruders(ModelObject* model_object);
|
2017-12-05 15:54:24 +01:00
|
|
|
std::string output_filepath(std::string path = "")
|
|
|
|
%code%{
|
|
|
|
try {
|
|
|
|
RETVAL = THIS->output_filepath(path);
|
|
|
|
} catch (std::exception& e) {
|
2018-03-21 15:38:33 +08:00
|
|
|
croak("%s\n", e.what());
|
2017-12-05 15:54:24 +01:00
|
|
|
}
|
|
|
|
%};
|
2018-05-15 18:01:47 +02:00
|
|
|
|
2019-06-20 20:23:05 +02:00
|
|
|
bool apply(Model *model, DynamicPrintConfig* config)
|
2020-09-24 16:41:47 +02:00
|
|
|
%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)
|
2020-09-24 14:52:05 +02:00
|
|
|
mat.second->config.touch();
|
2020-09-24 16:41:47 +02:00
|
|
|
RETVAL = THIS->apply(*model, *config);
|
|
|
|
%};
|
2017-05-30 17:24:50 +02:00
|
|
|
std::vector<unsigned int> extruders() const;
|
2017-12-01 18:55:57 +01:00
|
|
|
int validate() %code%{
|
2017-10-27 21:28:39 +02:00
|
|
|
std::string err = THIS->validate();
|
2017-12-01 18:55:57 +01:00
|
|
|
if (! err.empty())
|
|
|
|
croak("Configuration is not valid: %s\n", err.c_str());
|
|
|
|
RETVAL = 1;
|
2017-10-27 21:28:39 +02:00
|
|
|
%};
|
2017-02-15 11:05:52 +01:00
|
|
|
|
2018-03-23 16:00:00 +01:00
|
|
|
void set_status_silent();
|
2017-05-25 22:27:53 +02:00
|
|
|
|
2018-03-23 11:41:20 +01:00
|
|
|
void process() %code%{
|
|
|
|
try {
|
|
|
|
THIS->process();
|
|
|
|
} catch (std::exception& e) {
|
2019-05-20 11:00:38 -05:00
|
|
|
croak("%s\n", e.what());
|
2018-03-23 11:41:20 +01:00
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
2018-10-24 13:59:24 +02:00
|
|
|
void export_gcode(char *path_template) %code%{
|
|
|
|
try {
|
2020-05-07 11:24:36 +02:00
|
|
|
THIS->export_gcode(path_template, nullptr);
|
2018-10-24 13:59:24 +02:00
|
|
|
} catch (std::exception& e) {
|
2019-05-20 11:00:38 -05:00
|
|
|
croak("%s\n", e.what());
|
2018-10-24 13:59:24 +02:00
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
2014-05-06 11:07:18 +03:00
|
|
|
};
|