2014-04-29 23:04:49 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/Model.hpp"
|
|
|
|
#include "libslic3r/PrintConfig.hpp"
|
2014-04-29 23:04:49 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::Model} class Model {
|
|
|
|
Model();
|
|
|
|
~Model();
|
|
|
|
|
|
|
|
Clone<Model> clone()
|
|
|
|
%code%{ RETVAL = THIS; %};
|
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
%name{_add_object} Ref<ModelObject> add_object();
|
|
|
|
Ref<ModelObject> _add_object_clone(ModelObject* other)
|
|
|
|
%code%{ RETVAL = THIS->add_object(*other); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
void delete_object(size_t idx);
|
2014-05-06 22:58:29 +00:00
|
|
|
void clear_objects();
|
2014-07-13 10:10:34 +00:00
|
|
|
size_t objects_count()
|
|
|
|
%code%{ RETVAL = THIS->objects.size(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
Ref<ModelMaterial> get_material(t_model_material_id material_id)
|
|
|
|
%code%{
|
2014-05-09 12:24:35 +00:00
|
|
|
RETVAL = THIS->get_material(material_id);
|
|
|
|
if (RETVAL == NULL) {
|
2014-04-29 23:04:49 +00:00
|
|
|
XSRETURN_UNDEF;
|
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
%name{add_material} Ref<ModelMaterial> add_material(t_model_material_id material_id);
|
|
|
|
Ref<ModelMaterial> add_material_clone(t_model_material_id material_id, ModelMaterial* other)
|
|
|
|
%code%{ RETVAL = THIS->add_material(material_id, *other); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
bool has_material(t_model_material_id material_id) const
|
|
|
|
%code%{
|
2014-05-09 12:24:35 +00:00
|
|
|
RETVAL = (THIS->get_material(material_id) != NULL);
|
2014-04-29 23:04:49 +00:00
|
|
|
%};
|
2014-05-09 12:24:35 +00:00
|
|
|
void delete_material(t_model_material_id material_id);
|
|
|
|
void clear_materials();
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
std::vector<std::string> material_names() const
|
|
|
|
%code%{
|
|
|
|
for (ModelMaterialMap::iterator i = THIS->materials.begin();
|
|
|
|
i != THIS->materials.end(); ++i)
|
|
|
|
{
|
|
|
|
RETVAL.push_back(i->first);
|
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
|
|
|
size_t material_count() const
|
|
|
|
%code%{ RETVAL = THIS->materials.size(); %};
|
|
|
|
|
|
|
|
// void duplicate_objects_grid(coordf_t x, coordf_t y, coordf_t distance);
|
|
|
|
// void duplicate_objects(size_t copies_num, coordf_t distance, const BoundingBox &bb);
|
|
|
|
// void arrange_objects(coordf_t distance, const BoundingBox &bb);
|
|
|
|
// void duplicate(size_t copies_num, coordf_t distance, const BoundingBox &bb);
|
2014-09-21 08:51:36 +00:00
|
|
|
bool has_objects_with_no_instances();
|
2014-08-08 19:48:59 +00:00
|
|
|
bool add_default_instances();
|
2014-09-21 08:51:36 +00:00
|
|
|
BoundingBoxf3* bounding_box()
|
|
|
|
%code%{
|
|
|
|
RETVAL = new BoundingBoxf3();
|
|
|
|
THIS->bounding_box(RETVAL);
|
|
|
|
%};
|
|
|
|
void center_instances_around_point(Pointf* point)
|
|
|
|
%code%{ THIS->center_instances_around_point(*point); %};
|
|
|
|
void align_instances_to_origin();
|
|
|
|
void translate(double x, double y, double z);
|
|
|
|
TriangleMesh* mesh()
|
|
|
|
%code%{ RETVAL = new TriangleMesh(); THIS->mesh(RETVAL); %};
|
|
|
|
TriangleMesh* raw_mesh()
|
|
|
|
%code%{ RETVAL = new TriangleMesh(); THIS->raw_mesh(RETVAL); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
// void split_meshes();
|
|
|
|
// std::string get_material_name(t_model_material_id material_id);
|
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
ModelObjectPtrs* objects()
|
|
|
|
%code%{ RETVAL = &THIS->objects; %};
|
2014-04-29 23:04:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Model::Material} class ModelMaterial {
|
|
|
|
Ref<Model> model()
|
2014-05-09 12:24:35 +00:00
|
|
|
%code%{ RETVAL = THIS->get_model(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
Ref<DynamicPrintConfig> config()
|
|
|
|
%code%{ RETVAL = &THIS->config; %};
|
2014-05-06 22:22:56 +00:00
|
|
|
|
|
|
|
std::string get_attribute(std::string name)
|
|
|
|
%code%{ if (THIS->attributes.find(name) != THIS->attributes.end()) RETVAL = THIS->attributes[name]; %};
|
|
|
|
|
|
|
|
void set_attribute(std::string name, std::string value)
|
|
|
|
%code%{ THIS->attributes[name] = value; %};
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
|
|
|
SV*
|
|
|
|
ModelMaterial::attributes()
|
|
|
|
CODE:
|
|
|
|
HV* hv = newHV();
|
|
|
|
for (t_model_material_attributes::const_iterator attr = THIS->attributes.begin(); attr != THIS->attributes.end(); ++attr) {
|
|
|
|
(void)hv_store( hv, attr->first.c_str(), attr->first.length(), newSVpv(attr->second.c_str(), attr->second.length()), 0 );
|
|
|
|
}
|
|
|
|
RETVAL = (SV*)newRV_noinc((SV*)hv);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
%}
|
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Model::Object} class ModelObject {
|
2014-05-09 12:24:35 +00:00
|
|
|
ModelVolumePtrs* volumes()
|
|
|
|
%code%{ RETVAL = &THIS->volumes; %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
ModelInstancePtrs* instances()
|
|
|
|
%code%{ RETVAL = &THIS->instances; %};
|
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
void invalidate_bounding_box();
|
2014-09-21 08:51:36 +00:00
|
|
|
void update_bounding_box();
|
|
|
|
TriangleMesh* mesh()
|
|
|
|
%code%{ RETVAL = new TriangleMesh(); THIS->mesh(RETVAL); %};
|
2014-08-03 18:33:16 +00:00
|
|
|
TriangleMesh* raw_mesh()
|
|
|
|
%code%{ RETVAL = new TriangleMesh(); THIS->raw_mesh(RETVAL); %};
|
2014-09-21 08:51:36 +00:00
|
|
|
BoundingBoxf3* raw_bounding_box()
|
|
|
|
%code%{
|
|
|
|
RETVAL = new BoundingBoxf3();
|
|
|
|
THIS->raw_bounding_box(RETVAL);
|
|
|
|
%};
|
|
|
|
BoundingBoxf3* instance_bounding_box(int idx)
|
|
|
|
%code%{
|
|
|
|
RETVAL = new BoundingBoxf3();
|
|
|
|
THIS->instance_bounding_box(idx, RETVAL);
|
|
|
|
%};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
Ref<BoundingBoxf3> _bounding_box(BoundingBoxf3* new_bbox = NULL)
|
2014-04-29 23:04:49 +00:00
|
|
|
%code{%
|
|
|
|
if (NULL != new_bbox) {
|
|
|
|
THIS->_bounding_box = *new_bbox;
|
|
|
|
THIS->_bounding_box_valid = true;
|
|
|
|
}
|
2014-05-09 12:24:35 +00:00
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
if (!THIS->_bounding_box_valid) {
|
|
|
|
XSRETURN_UNDEF;
|
|
|
|
}
|
|
|
|
|
|
|
|
RETVAL = &THIS->_bounding_box;
|
|
|
|
%};
|
2014-09-21 08:51:36 +00:00
|
|
|
BoundingBoxf3* bounding_box()
|
|
|
|
%code%{
|
|
|
|
RETVAL = new BoundingBoxf3();
|
|
|
|
THIS->bounding_box(RETVAL);
|
|
|
|
%};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
%name{_add_volume} Ref<ModelVolume> add_volume(TriangleMesh* mesh)
|
|
|
|
%code%{ RETVAL = THIS->add_volume(*mesh); %};
|
|
|
|
Ref<ModelVolume> _add_volume_clone(ModelVolume* other)
|
|
|
|
%code%{ RETVAL = THIS->add_volume(*other); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
void delete_volume(size_t idx);
|
|
|
|
void clear_volumes();
|
2014-09-21 08:51:36 +00:00
|
|
|
int volumes_count()
|
|
|
|
%code%{ RETVAL = THIS->volumes.size(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-05-09 12:24:35 +00:00
|
|
|
%name{_add_instance} Ref<ModelInstance> add_instance();
|
|
|
|
Ref<ModelInstance> _add_instance_clone(ModelInstance* other)
|
|
|
|
%code%{ RETVAL = THIS->add_instance(*other); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
void delete_last_instance();
|
|
|
|
void clear_instances();
|
2014-05-09 12:24:35 +00:00
|
|
|
int instances_count()
|
|
|
|
%code%{ RETVAL = THIS->instances.size(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-07-12 09:20:57 +00:00
|
|
|
std::string name()
|
|
|
|
%code%{ RETVAL = THIS->name; %};
|
|
|
|
void set_name(std::string value)
|
|
|
|
%code%{ THIS->name = value; %};
|
2014-04-29 23:04:49 +00:00
|
|
|
std::string input_file()
|
|
|
|
%code%{ RETVAL = THIS->input_file; %};
|
|
|
|
void set_input_file(std::string value)
|
|
|
|
%code%{ THIS->input_file = value; %};
|
|
|
|
Ref<DynamicPrintConfig> config()
|
|
|
|
%code%{ RETVAL = &THIS->config; %};
|
|
|
|
|
|
|
|
Ref<Model> model()
|
2014-05-09 12:24:35 +00:00
|
|
|
%code%{ RETVAL = THIS->get_model(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
t_layer_height_ranges layer_height_ranges()
|
|
|
|
%code%{ RETVAL = THIS->layer_height_ranges; %};
|
2014-05-09 12:24:35 +00:00
|
|
|
void set_layer_height_ranges(t_layer_height_ranges ranges)
|
|
|
|
%code%{ THIS->layer_height_ranges = ranges; %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-05-15 14:37:18 +00:00
|
|
|
Ref<Pointf> origin_translation()
|
|
|
|
%code%{ RETVAL = &THIS->origin_translation; %};
|
2014-05-09 12:24:35 +00:00
|
|
|
void set_origin_translation(Pointf* point)
|
|
|
|
%code%{ THIS->origin_translation = *point; %};
|
2014-08-08 19:48:59 +00:00
|
|
|
|
|
|
|
bool needed_repair() const;
|
2014-09-21 08:51:36 +00:00
|
|
|
int materials_count() const;
|
2014-08-08 19:48:59 +00:00
|
|
|
int facets_count();
|
2014-09-21 08:51:36 +00:00
|
|
|
void center_around_origin();
|
|
|
|
void translate(double x, double y, double z);
|
|
|
|
void scale_xyz(Pointf3* versor)
|
|
|
|
%code{% THIS->scale(*versor); %};
|
|
|
|
|
|
|
|
Model* cut(double z)
|
|
|
|
%code%{
|
|
|
|
RETVAL = new Model();
|
|
|
|
THIS->cut(z, RETVAL);
|
|
|
|
%};
|
2014-04-29 23:04:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Model::Volume} class ModelVolume {
|
|
|
|
Ref<ModelObject> object()
|
2014-05-09 12:24:35 +00:00
|
|
|
%code%{ RETVAL = THIS->get_object(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-07-12 09:20:57 +00:00
|
|
|
std::string name()
|
|
|
|
%code%{ RETVAL = THIS->name; %};
|
|
|
|
void set_name(std::string value)
|
|
|
|
%code%{ THIS->name = value; %};
|
2014-05-10 14:59:17 +00:00
|
|
|
t_model_material_id material_id();
|
2014-05-09 12:24:35 +00:00
|
|
|
void set_material_id(t_model_material_id material_id)
|
2014-05-10 14:59:17 +00:00
|
|
|
%code%{ THIS->material_id(material_id); %};
|
|
|
|
Ref<ModelMaterial> material();
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-07-11 18:09:01 +00:00
|
|
|
Ref<DynamicPrintConfig> config()
|
|
|
|
%code%{ RETVAL = &THIS->config; %};
|
2014-04-29 23:04:49 +00:00
|
|
|
Ref<TriangleMesh> mesh()
|
|
|
|
%code%{ RETVAL = &THIS->mesh; %};
|
|
|
|
|
|
|
|
bool modifier()
|
|
|
|
%code%{ RETVAL = THIS->modifier; %};
|
2014-05-09 12:24:35 +00:00
|
|
|
void set_modifier(bool modifier)
|
|
|
|
%code%{ THIS->modifier = modifier; %};
|
2014-08-03 18:33:16 +00:00
|
|
|
|
|
|
|
ModelMaterial* assign_unique_material();
|
2014-04-29 23:04:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Model::Instance} class ModelInstance {
|
|
|
|
Ref<ModelObject> object()
|
2014-05-09 12:24:35 +00:00
|
|
|
%code%{ RETVAL = THIS->get_object(); %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
double rotation()
|
|
|
|
%code%{ RETVAL = THIS->rotation; %};
|
|
|
|
double scaling_factor()
|
|
|
|
%code%{ RETVAL = THIS->scaling_factor; %};
|
2014-05-15 14:37:18 +00:00
|
|
|
Ref<Pointf> offset()
|
|
|
|
%code%{ RETVAL = &THIS->offset; %};
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
void set_rotation(double val)
|
|
|
|
%code%{ THIS->rotation = val; %};
|
|
|
|
void set_scaling_factor(double val)
|
|
|
|
%code%{ THIS->scaling_factor = val; %};
|
|
|
|
void set_offset(Pointf *offset)
|
|
|
|
%code%{ THIS->offset = *offset; %};
|
2014-08-03 18:33:16 +00:00
|
|
|
|
|
|
|
void transform_mesh(TriangleMesh* mesh, bool dont_translate = false) const;
|
|
|
|
void transform_polygon(Polygon* polygon) const;
|
2014-04-29 23:04:49 +00:00
|
|
|
};
|