3mf import/export of config data

This commit is contained in:
Enrico Turri 2018-02-13 15:19:55 +01:00
parent 33553e1c50
commit 8885f5e344
12 changed files with 231 additions and 76 deletions

View file

@ -3,6 +3,7 @@
%{
#include <xsinit.h>
#include "libslic3r/Model.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Slicing.hpp"
#include "libslic3r/Format/AMF.hpp"
@ -10,6 +11,7 @@
#include "libslic3r/Format/OBJ.hpp"
#include "libslic3r/Format/PRUS.hpp"
#include "libslic3r/Format/STL.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
%}
%name{Slic3r::Model} class Model {
@ -25,6 +27,15 @@
}
%};
%name{read_from_archive} Model(std::string input_file, PresetBundle* bundle, bool add_default_instances = true)
%code%{
try {
RETVAL = new Model(Model::read_from_archive(input_file, bundle, add_default_instances));
} catch (std::exception& e) {
croak("Error while opening %s: %s\n", input_file.c_str(), e.what());
}
%};
Clone<Model> clone()
%code%{ RETVAL = THIS; %};
@ -92,8 +103,8 @@
%code%{ TriangleMesh mesh = THIS->mesh(); RETVAL = Slic3r::store_stl(path, &mesh, binary); %};
bool store_amf(char *path)
%code%{ RETVAL = Slic3r::store_amf(path, THIS); %};
bool store_3mf(char *path)
%code%{ RETVAL = Slic3r::store_3mf(path, THIS); %};
bool store_3mf(char *path, Print* print)
%code%{ RETVAL = Slic3r::store_3mf(path, THIS, print); %};
%{
@ -139,12 +150,13 @@ load_amf(CLASS, path)
RETVAL
Model*
load_3mf(CLASS, path)
load_3mf(CLASS, bundle, path)
char* CLASS;
PresetBundle* bundle;
char* path;
CODE:
RETVAL = new Model();
if (! load_3mf(path, RETVAL)) {
if (! load_3mf(path, bundle, RETVAL)) {
delete RETVAL;
RETVAL = NULL;
}