Merge branch 'master' into wipe_tower_improvements

This commit is contained in:
Lukas Matena 2017-12-21 13:47:33 +01:00
commit 4583d62edd
126 changed files with 5240 additions and 607 deletions

View file

@ -17,7 +17,14 @@
%name{Slic3r::GCode} class GCode {
GCode();
~GCode();
std::string do_export(Print *print, const char *path);
void do_export(Print *print, const char *path)
%code%{
try {
THIS->do_export(print, path);
} catch (std::exception& e) {
croak(e.what());
}
%};
Ref<Pointf> origin()
%code{% RETVAL = &(THIS->origin()); %};

View file

@ -22,3 +22,18 @@ bool debugged()
void break_to_debugger()
%code{% Slic3r::GUI::break_to_debugger(); %};
void set_wxapp(SV *ui)
%code%{ Slic3r::GUI::set_wxapp((wxApp*)wxPli_sv_2_object(aTHX_ ui, "Wx::App")); %};
void set_main_frame(SV *ui)
%code%{ Slic3r::GUI::set_main_frame((wxFrame*)wxPli_sv_2_object(aTHX_ ui, "Wx::Frame")); %};
void set_tab_panel(SV *ui)
%code%{ Slic3r::GUI::set_tab_panel((wxNotebook*)wxPli_sv_2_object(aTHX_ ui, "Wx::Notebook")); %};
void add_debug_menu(SV *ui)
%code%{ Slic3r::GUI::add_debug_menu((wxMenuBar*)wxPli_sv_2_object(aTHX_ ui, "Wx::MenuBar")); %};
void create_preset_tab(const char *name)
%code%{ Slic3r::GUI::create_preset_tab(name); %};

View file

@ -14,7 +14,9 @@
bool external() %code%{ RETVAL = THIS->is_external; %};
bool visible() %code%{ RETVAL = THIS->is_visible; %};
bool dirty() %code%{ RETVAL = THIS->is_dirty; %};
bool is_compatible_with_printer(char *active_printer) const;
bool compatible() %code%{ RETVAL = THIS->is_compatible; %};
bool is_compatible_with_printer(Preset *active_printer)
%code%{ RETVAL = THIS->is_compatible_with_printer(*active_printer); %};
const char* name() %code%{ RETVAL = THIS->name.c_str(); %};
const char* file() %code%{ RETVAL = THIS->file.c_str(); %};
@ -98,6 +100,8 @@ PresetCollection::arrayref()
PresetBundle();
~PresetBundle();
void reset(bool delete_files);
void setup_directories()
%code%{
try {
@ -106,12 +110,21 @@ PresetCollection::arrayref()
croak("Cannot create configuration directories:\n%s\n", e.what());
}
%};
void load_presets(const char *dir_path)
void load_presets()
%code%{
try {
THIS->load_presets(dir_path);
THIS->load_presets();
} catch (std::exception& e) {
croak("Loading of Slic3r presets from %s failed.\n\n%s\n", dir_path, e.what());
croak("Loading of Slic3r presets from %s failed.\n\n%s\n",
Slic3r::data_dir().c_str(), e.what());
}
%};
void load_config(const char *name, DynamicPrintConfig *config)
%code%{
try {
THIS->load_config(name, *config);
} catch (std::exception& e) {
croak("Loading a configuration %s failed:\n%s\n", name, e.what());
}
%};
void load_config_file(const char *path)
@ -125,7 +138,7 @@ PresetCollection::arrayref()
size_t load_configbundle(const char *path)
%code%{
try {
RETVAL = THIS->load_configbundle(path);
RETVAL = THIS->load_configbundle(path, PresetBundle::LOAD_CFGBNDLE_SAVE);
} catch (std::exception& e) {
croak("Loading of a config bundle %s failed:\n%s\n", path, e.what());
}

View file

@ -50,10 +50,6 @@
int id();
void set_id(int id);
Ref<PrintObject> object();
Ref<Layer> upper_layer()
%code%{ RETVAL = THIS->upper_layer; %};
Ref<Layer> lower_layer()
%code%{ RETVAL = THIS->lower_layer; %};
bool slicing_errors()
%code%{ RETVAL = THIS->slicing_errors; %};
coordf_t slice_z()
@ -63,15 +59,6 @@
coordf_t height()
%code%{ RETVAL = THIS->height; %};
void set_upper_layer(Layer *layer)
%code%{ THIS->upper_layer = layer; %};
void set_lower_layer(Layer *layer)
%code%{ THIS->lower_layer = layer; %};
bool has_upper_layer()
%code%{ RETVAL = (THIS->upper_layer != NULL); %};
bool has_lower_layer()
%code%{ RETVAL = (THIS->lower_layer != NULL); %};
size_t region_count();
Ref<LayerRegion> get_region(int idx);
Ref<LayerRegion> add_region(PrintRegion* print_region);
@ -112,10 +99,6 @@
int id();
void set_id(int id);
Ref<PrintObject> object();
Ref<SupportLayer> upper_layer()
%code%{ RETVAL = (SupportLayer*)THIS->upper_layer; %};
Ref<SupportLayer> lower_layer()
%code%{ RETVAL = (SupportLayer*)THIS->lower_layer; %};
bool slicing_errors()
%code%{ RETVAL = THIS->slicing_errors; %};
coordf_t slice_z()
@ -125,15 +108,6 @@
coordf_t height()
%code%{ RETVAL = THIS->height; %};
void set_upper_layer(SupportLayer *layer)
%code%{ THIS->upper_layer = layer; %};
void set_lower_layer(SupportLayer *layer)
%code%{ THIS->lower_layer = layer; %};
bool has_upper_layer()
%code%{ RETVAL = (THIS->upper_layer != NULL); %};
bool has_lower_layer()
%code%{ RETVAL = (THIS->lower_layer != NULL); %};
size_t region_count();
Ref<LayerRegion> get_region(int idx);
Ref<LayerRegion> add_region(PrintRegion* print_region);

View file

@ -14,5 +14,20 @@
%code%{ THIS->apply_config(*config); %};
void set(std::string key, int value);
std::string process(std::string str) const
%code%{ RETVAL = THIS->process(str, 0); %};
%code%{
try {
RETVAL = THIS->process(str, 0);
} catch (std::exception& e) {
croak(e.what());
}
%};
bool evaluate_boolean_expression(const char *str) const
%code%{
try {
RETVAL = THIS->evaluate_boolean_expression(str, THIS->config());
} catch (std::exception& e) {
croak(e.what());
}
%};
};

View file

@ -91,7 +91,6 @@ _constant()
size_t support_layer_count();
void clear_support_layers();
Ref<SupportLayer> get_support_layer(int idx);
Ref<SupportLayer> add_support_layer(int id, coordf_t height, coordf_t print_z);
bool step_done(PrintObjectStep step)
%code%{ RETVAL = THIS->state.is_done(step); %};
@ -206,8 +205,14 @@ _constant()
double max_allowed_layer_height() const;
bool has_support_material() const;
void auto_assign_extruders(ModelObject* model_object);
std::string output_filename();
std::string output_filepath(std::string path = "");
std::string output_filepath(std::string path = "")
%code%{
try {
RETVAL = THIS->output_filepath(path);
} catch (std::exception& e) {
croak(e.what());
}
%};
void add_model_object(ModelObject* model_object, int idx = -1);
bool apply_config(DynamicPrintConfig* config)
@ -215,10 +220,11 @@ _constant()
bool has_infinite_skirt();
bool has_skirt();
std::vector<unsigned int> extruders() const;
void validate() %code%{
int validate() %code%{
std::string err = THIS->validate();
if (! err.empty())
throw std::invalid_argument(err.c_str());
if (! err.empty())
croak("Configuration is not valid: %s\n", err.c_str());
RETVAL = 1;
%};
Clone<BoundingBox> bounding_box();
Clone<BoundingBox> total_bounding_box();

View file

@ -60,6 +60,18 @@ var_dir()
RETVAL = const_cast<char*>(Slic3r::var_dir().c_str());
OUTPUT: RETVAL
void
set_resources_dir(dir)
char *dir;
CODE:
Slic3r::set_resources_dir(dir);
char*
resources_dir()
CODE:
RETVAL = const_cast<char*>(Slic3r::resources_dir().c_str());
OUTPUT: RETVAL
std::string
var(file_name)
const char *file_name;
@ -79,14 +91,6 @@ data_dir()
RETVAL = const_cast<char*>(Slic3r::data_dir().c_str());
OUTPUT: RETVAL
std::string
config_path(section, name)
const char *section;
const char *name;
CODE:
RETVAL = Slic3r::config_path(section, name);
OUTPUT: RETVAL
std::string
encode_path(src)
const char *src;