Ported some ModelObject methods from Perl to C++.

Added some utility functions to TriangleMesh, thanks to @alexrj
Some porting to C++ based on work by @alexrj.
This commit is contained in:
bubnikv 2017-08-02 16:05:18 +02:00
parent 777023c7a8
commit 31085fb1d7
7 changed files with 191 additions and 81 deletions

View file

@ -15,6 +15,15 @@
Model();
~Model();
%name{read_from_file} Model(std::string input_file, bool add_default_instances = true)
%code%{
try {
RETVAL = new Model(Model::read_from_file(input_file, 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; %};
@ -73,6 +82,11 @@
void duplicate_objects(unsigned int copies_num, double dist, BoundingBoxf* bb = NULL);
void duplicate_objects_grid(unsigned int x, unsigned int y, double dist);
bool looks_like_multipart_object() const;
void convert_multipart_object();
void print_info() const;
bool store_stl(char *path, bool binary)
%code%{ TriangleMesh mesh = THIS->mesh(); RETVAL = Slic3r::store_stl(path, &mesh, binary); %};
bool store_amf(char *path)
@ -272,6 +286,8 @@ ModelMaterial::attributes()
RETVAL = new ModelObjectPtrs(); // leak?
THIS->split(RETVAL);
%};
void print_info() const;
};