PrusaSlicer-NonPlainar/xs/xsp/Print.xsp

207 lines
7.0 KiB
Plaintext
Raw Normal View History

2013-12-20 00:36:42 +00:00
%module{Slic3r::XS};
%{
#include <xsinit.h>
#include "libslic3r/Print.hpp"
#include "libslic3r/PlaceholderParser.hpp"
2013-12-20 00:36:42 +00:00
%}
%package{Slic3r::Print::State};
%{
IV
_constant()
ALIAS:
STEP_SLICE = posSlice
STEP_PERIMETERS = posPerimeters
STEP_PREPARE_INFILL = posPrepareInfill
STEP_INFILL = posInfill
STEP_SUPPORTMATERIAL = posSupportMaterial
2013-12-20 00:36:42 +00:00
STEP_SKIRT = psSkirt
STEP_BRIM = psBrim
STEP_WIPE_TOWER = psWipeTower
2013-12-20 00:36:42 +00:00
PROTOTYPE:
CODE:
RETVAL = ix;
OUTPUT: RETVAL
%}
%name{Slic3r::Print::Region} class PrintRegion {
// owned by Print, no constructor/destructor
2015-12-16 11:33:19 +00:00
Ref<StaticPrintConfig> config()
%code%{ RETVAL = &THIS->config(); %};
Ref<Print> print();
Clone<Flow> flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
%code%{ RETVAL = THIS->flow(role, layer_height, bridge, first_layer, width, *object); %};
};
%name{Slic3r::Print::Object} class PrintObject {
// owned by Print, no constructor/destructor
int region_count()
%code%{ RETVAL = THIS->print()->regions().size(); %};
Ref<Print> print();
Ref<ModelObject> model_object();
2015-12-16 11:33:19 +00:00
Ref<StaticPrintConfig> config()
%code%{ RETVAL = &THIS->config(); %};
Points copies();
t_layer_height_ranges layer_height_ranges()
%code%{ RETVAL = THIS->layer_height_ranges; %};
std::vector<double> layer_height_profile()
%code%{ RETVAL = THIS->layer_height_profile; %};
Ref<Point3> size()
%code%{ RETVAL = &THIS->size; %};
Clone<BoundingBox> bounding_box();
Points _shifted_copies()
%code%{ RETVAL = THIS->_shifted_copies; %};
2014-11-12 23:34:56 +00:00
bool add_copy(Pointf* point)
%code%{ RETVAL = THIS->add_copy(*point); %};
bool delete_last_copy();
bool reload_model_instances();
void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges)
%code%{ THIS->layer_height_ranges = layer_height_ranges; %};
size_t layer_count();
Ref<Layer> get_layer(int idx);
size_t support_layer_count();
Ref<SupportLayer> get_support_layer(int idx);
bool step_done(PrintObjectStep step)
2018-03-28 15:05:31 +00:00
%code%{ RETVAL = THIS->is_step_done(step); %};
void adjust_layer_height_profile(coordf_t z, coordf_t layer_thickness_delta, coordf_t band_width, int action)
%code%{
THIS->update_layer_height_profile(THIS->model_object()->layer_height_profile);
adjust_layer_height_profile(
THIS->slicing_parameters(), THIS->model_object()->layer_height_profile, z, layer_thickness_delta, band_width, LayerHeightEditActionType(action));
THIS->model_object()->layer_height_profile_valid = true;
THIS->layer_height_profile_valid = false;
%};
void reset_layer_height_profile();
2018-03-23 15:00:00 +00:00
void slice();
};
%name{Slic3r::Print} class Print {
Print();
~Print();
2015-12-16 11:33:19 +00:00
Ref<StaticPrintConfig> config()
%code%{ RETVAL = &THIS->config(); %};
Ref<PlaceholderParser> placeholder_parser()
%code%{ RETVAL = &THIS->placeholder_parser(); %};
Ref<ExtrusionEntityCollection> skirt()
%code%{ RETVAL = const_cast<ExtrusionEntityCollection*>(&THIS->skirt()); %};
Ref<ExtrusionEntityCollection> brim()
%code%{ RETVAL = const_cast<ExtrusionEntityCollection*>(&THIS->brim()); %};
std::string estimated_print_time()
%code%{ RETVAL = THIS->print_statistics().estimated_print_time; %};
double total_used_filament()
%code%{ RETVAL = THIS->print_statistics().total_used_filament; %};
double total_extruded_volume()
%code%{ RETVAL = THIS->print_statistics().total_extruded_volume; %};
double total_weight()
%code%{ RETVAL = THIS->print_statistics().total_weight; %};
double total_cost()
%code%{ RETVAL = THIS->print_statistics().total_cost; %};
PrintObjectPtrs* objects()
%code%{ RETVAL = const_cast<PrintObjectPtrs*>(&THIS->objects()); %};
void clear_objects();
Ref<PrintObject> get_object(int idx)
%code%{ RETVAL = THIS->objects()[idx]; %};
void delete_object(int idx);
2014-11-07 19:25:05 +00:00
void reload_object(int idx);
bool reload_model_instances();
size_t object_count()
%code%{ RETVAL = THIS->objects().size(); %};
PrintRegionPtrs* regions()
%code%{ RETVAL = const_cast<PrintRegionPtrs*>(&THIS->regions()); %};
Ref<PrintRegion> get_region(int idx)
%code%{ RETVAL = THIS->regions()[idx]; %};
size_t region_count()
%code%{ RETVAL = THIS->regions().size(); %};
bool step_done(PrintStep step)
2018-03-28 15:05:31 +00:00
%code%{ RETVAL = THIS->is_step_done(step); %};
bool object_step_done(PrintObjectStep step)
2018-03-28 15:05:31 +00:00
%code%{ RETVAL = THIS->is_step_done(step); %};
2014-08-03 16:41:09 +00:00
2015-01-03 22:25:55 +00:00
SV* filament_stats()
%code%{
HV* hv = newHV();
for (std::map<size_t,float>::const_iterator it = THIS->print_statistics().filament_stats.begin(); it != THIS->print_statistics().filament_stats.end(); ++it) {
2015-01-03 22:25:55 +00:00
// stringify extruder_id
std::ostringstream ss;
ss << it->first;
std::string str = ss.str();
(void)hv_store( hv, str.c_str(), str.length(), newSViv(it->second), 0 );
RETVAL = newRV_noinc((SV*)hv);
}
%};
2014-08-03 16:41:09 +00:00
double max_allowed_layer_height() const;
bool has_support_material() const;
2015-12-02 17:29:33 +00:00
void auto_assign_extruders(ModelObject* model_object);
std::string output_filepath(std::string path = "")
%code%{
try {
RETVAL = THIS->output_filepath(path);
} catch (std::exception& e) {
croak(e.what());
}
%};
2014-08-03 16:41:09 +00:00
void add_model_object(ModelObject* model_object, int idx = -1);
bool apply_config(DynamicPrintConfig* config)
%code%{ RETVAL = THIS->apply_config(*config); %};
bool has_infinite_skirt();
std::vector<unsigned int> extruders() const;
int validate() %code%{
std::string err = THIS->validate();
if (! err.empty())
croak("Configuration is not valid: %s\n", err.c_str());
RETVAL = 1;
%};
Clone<BoundingBox> bounding_box();
Clone<BoundingBox> total_bounding_box();
2017-02-15 10:05:52 +00:00
void set_callback_event(int evt) %code%{
%};
2018-03-23 15:00:00 +00:00
void set_status_silent();
void process() %code%{
try {
THIS->process();
} catch (std::exception& e) {
croak(e.what());
}
%};
void export_gcode_with_preview_data(char *path_template, GCodePreviewData *preview_data) %code%{
try {
THIS->export_gcode(path_template, preview_data);
} catch (std::exception& e) {
croak(e.what());
}
%};
void export_gcode(char *path_template) %code%{
try {
THIS->export_gcode(path_template, nullptr);
} catch (std::exception& e) {
croak(e.what());
}
%};
};