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"
|
2013-12-20 00:36:42 +00:00
|
|
|
%}
|
|
|
|
|
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();
|
|
|
|
|
2019-06-20 18:23:05 +00:00
|
|
|
Ref<Model> model()
|
|
|
|
%code%{ RETVAL = const_cast<Model*>(&THIS->model()); %};
|
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())); %};
|
2018-09-11 12:04:47 +00:00
|
|
|
double total_used_filament()
|
|
|
|
%code%{ RETVAL = THIS->print_statistics().total_used_filament; %};
|
2014-06-10 22:15:02 +00:00
|
|
|
|
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
|
|
|
|
2019-06-20 18:23:05 +00:00
|
|
|
bool apply(Model *model, DynamicPrintConfig* config)
|
2020-09-24 14:41:47 +00: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 12:52:05 +00:00
|
|
|
mat.second->config.touch();
|
2020-09-24 14:41:47 +00:00
|
|
|
RETVAL = THIS->apply(*model, *config);
|
|
|
|
%};
|
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
|
|
|
%};
|
2017-02-15 10:05:52 +00:00
|
|
|
|
2018-03-23 15:00:00 +00:00
|
|
|
void set_status_silent();
|
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) {
|
2019-05-20 16:00:38 +00:00
|
|
|
croak("%s\n", e.what());
|
2018-03-23 10:41:20 +00:00
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
2018-10-24 11:59:24 +00:00
|
|
|
void export_gcode(char *path_template) %code%{
|
|
|
|
try {
|
2020-05-07 09:24:36 +00:00
|
|
|
THIS->export_gcode(path_template, nullptr);
|
2018-10-24 11:59:24 +00:00
|
|
|
} catch (std::exception& e) {
|
2019-05-20 16:00:38 +00:00
|
|
|
croak("%s\n", e.what());
|
2018-10-24 11:59:24 +00:00
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|