Removed Print.pm,

ported execution of post processing scripts into C++ (WIP, waits for
update of boost::system module on our build server)
Removed other mention of the "Controller".
This commit is contained in:
bubnikv 2018-09-17 12:01:02 +02:00
parent bb7f504296
commit d934b63424
19 changed files with 124 additions and 126 deletions

View File

@ -49,7 +49,6 @@ use Slic3r::Model;
use Slic3r::Point; use Slic3r::Point;
use Slic3r::Polygon; use Slic3r::Polygon;
use Slic3r::Polyline; use Slic3r::Polyline;
use Slic3r::Print;
use Slic3r::Print::Object; use Slic3r::Print::Object;
use Slic3r::Print::Simple; use Slic3r::Print::Simple;
use Slic3r::Surface; use Slic3r::Surface;

View File

@ -33,7 +33,6 @@ use constant MODEL_WILDCARD => join '|', @{&FILE_WILDCARDS}{qw(known stl obj amf
# Datadir provided on the command line. # Datadir provided on the command line.
our $datadir; our $datadir;
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
our $no_plater; our $no_plater;
our @cb; our @cb;
@ -103,8 +102,6 @@ sub OnInit {
print STDERR "Creating main frame...\n"; print STDERR "Creating main frame...\n";
Wx::Image::FindHandlerType(wxBITMAP_TYPE_PNG) || Wx::Image::AddHandler(Wx::PNGHandler->new); Wx::Image::FindHandlerType(wxBITMAP_TYPE_PNG) || Wx::Image::AddHandler(Wx::PNGHandler->new);
$self->{mainframe} = my $frame = Slic3r::GUI::MainFrame->new( $self->{mainframe} = my $frame = Slic3r::GUI::MainFrame->new(
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
no_controller => $self->{app_config}->get('no_controller'),
no_plater => $no_plater, no_plater => $no_plater,
lang_ch_event => $LANGUAGE_CHANGE_EVENT, lang_ch_event => $LANGUAGE_CHANGE_EVENT,
preferences_event => $PREFERENCES_EVENT, preferences_event => $PREFERENCES_EVENT,
@ -170,8 +167,6 @@ sub recreate_GUI{
my ($self) = @_; my ($self) = @_;
my $topwindow = $self->GetTopWindow(); my $topwindow = $self->GetTopWindow();
$self->{mainframe} = my $frame = Slic3r::GUI::MainFrame->new( $self->{mainframe} = my $frame = Slic3r::GUI::MainFrame->new(
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
no_controller => $self->{app_config}->get('no_controller'),
no_plater => $no_plater, no_plater => $no_plater,
lang_ch_event => $LANGUAGE_CHANGE_EVENT, lang_ch_event => $LANGUAGE_CHANGE_EVENT,
preferences_event => $PREFERENCES_EVENT, preferences_event => $PREFERENCES_EVENT,

View File

@ -57,8 +57,6 @@ sub new {
} }
# store input params # store input params
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
$self->{no_controller} = $params{no_controller};
$self->{no_plater} = $params{no_plater}; $self->{no_plater} = $params{no_plater};
$self->{loaded} = 0; $self->{loaded} = 0;
$self->{lang_ch_event} = $params{lang_ch_event}; $self->{lang_ch_event} = $params{lang_ch_event};
@ -199,8 +197,6 @@ sub _init_tabpanel {
? 'load_current_preset' : 'update_tab_ui'; ? 'load_current_preset' : 'update_tab_ui';
$self->{options_tabs}{$tab_name_other}->$update_action; $self->{options_tabs}{$tab_name_other}->$update_action;
} }
# Update the controller printers.
$self->{controller}->update_presets($presets) if $self->{controller};
} }
$self->{plater}->on_config_change($tab->get_config); $self->{plater}->on_config_change($tab->get_config);
} }
@ -239,8 +235,7 @@ sub _init_tabpanel {
$self->{plater}->update(); $self->{plater}->update();
}); });
Slic3r::GUI::create_preset_tabs($VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT);
Slic3r::GUI::create_preset_tabs($self->{no_controller}, $VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT);
$self->{options_tabs} = {}; $self->{options_tabs} = {};
for my $tab_name (qw(print filament sla_material printer)) { for my $tab_name (qw(print filament sla_material printer)) {
$self->{options_tabs}{$tab_name} = Slic3r::GUI::get_preset_tab("$tab_name"); $self->{options_tabs}{$tab_name} = Slic3r::GUI::get_preset_tab("$tab_name");

View File

@ -1,69 +0,0 @@
# The slicing work horse.
# Extends C++ class Slic3r::Print
package Slic3r::Print;
use strict;
use warnings;
use File::Basename qw(basename fileparse);
use File::Spec;
use List::Util qw(min max first sum);
use Slic3r::ExtrusionLoop ':roles';
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Flow ':roles';
use Slic3r::Geometry qw(X Y unscale);
use Slic3r::Geometry::Clipper qw(diff_ex union_ex intersection_ex intersection offset
union JT_ROUND JT_SQUARE);
use Slic3r::Print::State ':steps';
sub size {
my $self = shift;
return $self->bounding_box->size;
}
sub run_post_process_scripts {
my ($self, $output_file) = @_;
# run post-processing scripts
if (@{$self->config->post_process}) {
# $self->set_status(95, "Running post-processing scripts");
$self->config->setenv;
for my $script (@{$self->config->post_process}) {
# Ignore empty post processing script lines.
next if $script =~ /^\s*$/;
Slic3r::debugf " '%s' '%s'\n", $script, $output_file;
# -x doesn't return true on Windows except for .exe files
if (($^O eq 'MSWin32') ? !(-e $script) : !(-x $script)) {
die "The configured post-processing script is not executable: check permissions. ($script)\n";
}
if ($^O eq 'MSWin32' && $script =~ /\.[pP][lL]/) {
# The current process (^X) may be slic3r.exe or slic3r-console.exe.
# Replace it with the current perl interpreter.
my($filename, $directories, $suffix) = fileparse($^X);
$filename =~ s/^slic3r.*$/perl5\.24\.0\.exe/;
my $interpreter = $directories . $filename;
system($interpreter, $script, $output_file);
} else {
system($script, $output_file);
}
}
}
}
sub export_png {
my $self = shift;
my %params = @_;
my @sobjects = @{$self->objects};
my $objnum = scalar @sobjects;
for(my $oi = 0; $oi < $objnum; $oi++)
{
$sobjects[$oi]->slice;
$self->set_status(($oi + 1)*100/$objnum - 1, "Slicing...");
}
my $fh = $params{output_file};
$self->set_status(90, "Exporting zipped archive...");
$self->print_to_png($fh);
$self->set_status(100, "Done.");
}
1;

View File

@ -38,7 +38,6 @@ my %cli_options = ();
'load=s@' => \$opt{load}, 'load=s@' => \$opt{load},
'autosave=s' => \$opt{autosave}, 'autosave=s' => \$opt{autosave},
'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config}, 'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config},
'no-controller' => \$opt{no_controller},
'no-plater' => \$opt{no_plater}, 'no-plater' => \$opt{no_plater},
'gui-mode=s' => \$opt{obsolete_ignore_this_option_gui_mode}, 'gui-mode=s' => \$opt{obsolete_ignore_this_option_gui_mode},
'datadir=s' => \$opt{datadir}, 'datadir=s' => \$opt{datadir},
@ -107,7 +106,6 @@ if ((!@ARGV || $opt{gui}) && !$opt{no_gui} && !$opt{save} && eval "require Slic3
{ {
no warnings 'once'; no warnings 'once';
$Slic3r::GUI::datadir = Slic3r::decode_path($opt{datadir} // ''); $Slic3r::GUI::datadir = Slic3r::decode_path($opt{datadir} // '');
$Slic3r::GUI::no_controller = $opt{no_controller};
$Slic3r::GUI::no_plater = $opt{no_plater}; $Slic3r::GUI::no_plater = $opt{no_plater};
$Slic3r::GUI::autosave = $opt{autosave}; $Slic3r::GUI::autosave = $opt{autosave};
} }

View File

@ -105,6 +105,8 @@ add_library(libslic3r STATIC
${LIBDIR}/libslic3r/GCode/Analyzer.hpp ${LIBDIR}/libslic3r/GCode/Analyzer.hpp
${LIBDIR}/libslic3r/GCode/CoolingBuffer.cpp ${LIBDIR}/libslic3r/GCode/CoolingBuffer.cpp
${LIBDIR}/libslic3r/GCode/CoolingBuffer.hpp ${LIBDIR}/libslic3r/GCode/CoolingBuffer.hpp
${LIBDIR}/libslic3r/GCode/PostProcessor.cpp
${LIBDIR}/libslic3r/GCode/PostProcessor.hpp
${LIBDIR}/libslic3r/GCode/PressureEqualizer.cpp ${LIBDIR}/libslic3r/GCode/PressureEqualizer.cpp
${LIBDIR}/libslic3r/GCode/PressureEqualizer.hpp ${LIBDIR}/libslic3r/GCode/PressureEqualizer.hpp
${LIBDIR}/libslic3r/GCode/PreviewData.cpp ${LIBDIR}/libslic3r/GCode/PreviewData.cpp

View File

@ -13,6 +13,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/find.hpp> #include <boost/algorithm/string/find.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <boost/nowide/iostream.hpp> #include <boost/nowide/iostream.hpp>
@ -418,14 +419,9 @@ void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_
{ {
PROFILE_CLEAR(); PROFILE_CLEAR();
if (print->is_step_done(psGCodeExport)) { // Does the file exist? If so, we hope that it is still valid.
// Does the file exist? If so, we hope that it is still valid. if (print->is_step_done(psGCodeExport) && boost::filesystem::exists(boost::filesystem::path(path)))
FILE *f = boost::nowide::fopen(path, "r"); return;
if (f != nullptr) {
::fclose(f);
return;
}
}
print->set_started(psGCodeExport); print->set_started(psGCodeExport);

View File

@ -0,0 +1,55 @@
#include "PostProcessor.hpp"
namespace Slic3r {
#ifdef WIN32
//FIXME Ignore until we include boost::process
void run_post_process_scripts(const std::string &path, const PrintConfig &config)
{
}
#else
#include <boost/process/system.hpp>
void run_post_process_scripts(const std::string &path, const PrintConfig &config)
{
if (config.post_process.values.empty())
return;
config.setenv_();
for (std::string script: config.post_process.values) {
// Ignore empty post processing script lines.
boost::trim(script);
if (script.empty())
continue;
BOOST_LOG_TRIVIAL(info) << "Executing script " << script << " on file " << path;
if (! boost::filesystem::exists(boost::filesystem::path(path)))
throw std::runtime_exception(std::string("The configured post-processing script does not exist: ") + path);
#ifndef WIN32
file_status fs = boost::filesystem::status(path);
//FIXME test if executible by the effective UID / GID.
// throw std::runtime_exception(std::string("The configured post-processing script is not executable: check permissions. ") + path));
#endif
int result = 0;
#ifdef WIN32
if (boost::iends_with(file, ".gcode")) {
// The current process may be slic3r.exe or slic3r-console.exe.
// Find the path of the process:
wchar_t wpath_exe[_MAX_PATH + 1];
::GetModuleFileNameW(nullptr, wpath_exe, _MAX_PATH);
boost::filesystem::path path_exe(wpath_exe);
// Replace it with the current perl interpreter.
result = boost::process::system((path_exe.parent_path() / "perl5.24.0.exe").string(), script, output_file);
} else
#else
result = boost::process::system(script, output_file);
#endif
if (result < 0)
BOOST_LOG_TRIVIAL(error) << "Script " << script << " on file " << path << " failed. Negative error code returned.";
}
}
#endif
} // namespace Slic3r

View File

@ -0,0 +1,15 @@
#ifndef slic3r_GCode_PostProcessor_hpp_
#define slic3r_GCode_PostProcessor_hpp_
#include <string>
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
namespace Slic3r {
extern void run_post_process_scripts(const std::string &path, const PrintConfig &config);
} // namespace Slic3r
#endif /* slic3r_GCode_PostProcessor_hpp_ */

View File

@ -1331,8 +1331,15 @@ std::string Print::output_filepath(const std::string &path) const
return path; return path;
} }
void Print::print_to_png(const std::string &dirpath) void Print::export_png(const std::string &dirpath)
{ {
size_t idx = 0;
for (PrintObject *obj : m_objects) {
obj->slice();
this->set_status(int(floor(idx * 100. / m_objects.size() + 0.5)), "Slicing...");
++ idx;
}
this->set_status(90, "Exporting zipped archive...");
print_to<FilePrinterFormat::PNG>(*this, print_to<FilePrinterFormat::PNG>(*this,
dirpath, dirpath,
float(m_config.bed_size_x.value), float(m_config.bed_size_x.value),
@ -1341,6 +1348,7 @@ void Print::print_to_png(const std::string &dirpath)
int(m_config.pixel_height.value), int(m_config.pixel_height.value),
float(m_config.exp_time.value), float(m_config.exp_time.value),
float(m_config.exp_time_first.value)); float(m_config.exp_time_first.value));
this->set_status(100, "Done.");
} }
// Returns extruder this eec should be printed with, according to PrintRegion config // Returns extruder this eec should be printed with, according to PrintRegion config

View File

@ -368,7 +368,7 @@ public:
void process(); void process();
void export_gcode(const std::string &path_template, GCodePreviewData *preview_data); void export_gcode(const std::string &path_template, GCodePreviewData *preview_data);
// SLA export, temporary. // SLA export, temporary.
void print_to_png(const std::string &dirpath); void export_png(const std::string &dirpath);
// methods for handling state // methods for handling state
bool is_step_done(PrintStep step) const { return m_state.is_done(step); } bool is_step_done(PrintStep step) const { return m_state.is_done(step); }

View File

@ -7,6 +7,7 @@
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx. // Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
#include "../../libslic3r/Print.hpp" #include "../../libslic3r/Print.hpp"
#include "../../libslic3r/GCode/PostProcessor.hpp"
//#undef NDEBUG //#undef NDEBUG
#include <cassert> #include <cassert>
@ -59,9 +60,12 @@ void BackgroundSlicingProcess::thread_proc()
if (! m_print->canceled()) { if (! m_print->canceled()) {
wxQueueEvent(GUI::g_wxPlater, new wxCommandEvent(m_event_sliced_id)); wxQueueEvent(GUI::g_wxPlater, new wxCommandEvent(m_event_sliced_id));
m_print->export_gcode(m_temp_output_path, m_gcode_preview_data); m_print->export_gcode(m_temp_output_path, m_gcode_preview_data);
if (! m_print->canceled() && ! m_output_path.empty() && if (! m_print->canceled() && ! m_output_path.empty()) {
copy_file(m_temp_output_path, m_output_path) != 0) if (copy_file(m_temp_output_path, m_output_path) != 0)
throw std::runtime_error("Copying of the temporary G-code to the output G-code failed"); throw std::runtime_error("Copying of the temporary G-code to the output G-code failed");
m_print->set_status(95, "Running post-processing scripts");
run_post_process_scripts(m_output_path, m_print->config());
}
} }
} catch (CanceledException &ex) { } catch (CanceledException &ex) {
// Canceled, this is all right. // Canceled, this is all right.

View File

@ -611,13 +611,13 @@ void open_preferences_dialog(int event_preferences)
dlg->ShowModal(); dlg->ShowModal();
} }
void create_preset_tabs(bool no_controller, int event_value_change, int event_presets_changed) void create_preset_tabs(int event_value_change, int event_presets_changed)
{ {
update_label_colours_from_appconfig(); update_label_colours_from_appconfig();
add_created_tab(new TabPrint (g_wxTabPanel, no_controller), event_value_change, event_presets_changed); add_created_tab(new TabPrint (g_wxTabPanel), event_value_change, event_presets_changed);
add_created_tab(new TabFilament (g_wxTabPanel, no_controller), event_value_change, event_presets_changed); add_created_tab(new TabFilament (g_wxTabPanel), event_value_change, event_presets_changed);
add_created_tab(new TabSLAMaterial (g_wxTabPanel, no_controller), event_value_change, event_presets_changed); add_created_tab(new TabSLAMaterial (g_wxTabPanel), event_value_change, event_presets_changed);
add_created_tab(new TabPrinter (g_wxTabPanel, no_controller), event_value_change, event_presets_changed); add_created_tab(new TabPrinter (g_wxTabPanel), event_value_change, event_presets_changed);
} }
std::vector<PresetTab> preset_tabs = { std::vector<PresetTab> preset_tabs = {

View File

@ -165,7 +165,7 @@ extern void config_wizard(int run_reason);
extern void open_preferences_dialog(int event_preferences); extern void open_preferences_dialog(int event_preferences);
// Create a new preset tab (print, filament and printer), // Create a new preset tab (print, filament and printer),
void create_preset_tabs(bool no_controller, int event_value_change, int event_presets_changed); void create_preset_tabs(int event_value_change, int event_presets_changed);
TabIface* get_preset_tab_iface(char *name); TabIface* get_preset_tab_iface(char *name);
// add it at the end of the tab panel. // add it at the end of the tab panel.

View File

@ -71,14 +71,6 @@ void PreferencesDialog::build()
option = Option (def, "preset_update"); option = Option (def, "preset_update");
m_optgroup->append_single_option_line(option); m_optgroup->append_single_option_line(option);
def.label = L("Disable USB/serial connection");
def.type = coBool;
def.tooltip = L("Disable communication with the printer over a serial / USB cable. "
"This simplifies the user interface in case the printer is never attached to the computer.");
def.default_value = new ConfigOptionBool{ app_config->get("no_controller")[0] == '1' }; // 1;
option = Option (def,"no_controller");
m_optgroup->append_single_option_line(option);
def.label = L("Suppress \" - default - \" presets"); def.label = L("Suppress \" - default - \" presets");
def.type = coBool; def.type = coBool;
def.tooltip = L("Suppress \" - default - \" presets in the Print / Filament / Printer " def.tooltip = L("Suppress \" - default - \" presets in the Print / Filament / Printer "
@ -118,8 +110,7 @@ void PreferencesDialog::build()
void PreferencesDialog::accept() void PreferencesDialog::accept()
{ {
if (m_values.find("no_controller") != m_values.end()|| if (m_values.find("no_defaults") != m_values.end()||
m_values.find("no_defaults") != m_values.end()||
m_values.find("use_legacy_opengl")!= m_values.end()) { m_values.find("use_legacy_opengl")!= m_values.end()) {
warning_catcher(this, _(L("You need to restart Slic3r to make the changes effective."))); warning_catcher(this, _(L("You need to restart Slic3r to make the changes effective.")));
} }

View File

@ -1528,6 +1528,7 @@ void TabPrinter::build_fff()
}; };
#if 0
if (!m_no_controller) if (!m_no_controller)
{ {
optgroup = page->new_optgroup(_(L("USB/Serial connection"))); optgroup = page->new_optgroup(_(L("USB/Serial connection")));
@ -1572,6 +1573,7 @@ void TabPrinter::build_fff()
line.append_widget(serial_test); line.append_widget(serial_test);
optgroup->append_line(line); optgroup->append_line(line);
} }
#endif
optgroup = page->new_optgroup(_(L("Printer Host upload"))); optgroup = page->new_optgroup(_(L("Printer Host upload")));
@ -1745,8 +1747,10 @@ void TabPrinter::build_fff()
build_extruder_pages(); build_extruder_pages();
#if 0
if (!m_no_controller) if (!m_no_controller)
update_serial_ports(); update_serial_ports();
#endif
} }
void TabPrinter::build_sla() void TabPrinter::build_sla()

View File

@ -170,7 +170,6 @@ protected:
std::vector<PageShp> m_pages; std::vector<PageShp> m_pages;
bool m_disable_tree_sel_changed_event; bool m_disable_tree_sel_changed_event;
bool m_show_incompatible_presets; bool m_show_incompatible_presets;
bool m_no_controller;
std::vector<std::string> m_reload_dependent_tabs = {}; std::vector<std::string> m_reload_dependent_tabs = {};
enum OptStatus { osSystemValue = 1, osInitValue = 2 }; enum OptStatus { osSystemValue = 1, osInitValue = 2 };
@ -199,8 +198,8 @@ public:
public: public:
Tab() {} Tab() {}
Tab(wxNotebook* parent, const wxString& title, const char* name, bool no_controller) : Tab(wxNotebook* parent, const wxString& title, const char* name) :
m_parent(parent), m_title(title), m_name(name), m_no_controller(no_controller) { m_parent(parent), m_title(title), m_name(name) {
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL, name); Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL, name);
get_tabs_list().push_back(this); get_tabs_list().push_back(this);
} }
@ -282,8 +281,8 @@ class TabPrint : public Tab
{ {
public: public:
TabPrint() {} TabPrint() {}
TabPrint(wxNotebook* parent, bool no_controller) : TabPrint(wxNotebook* parent) :
Tab(parent, _(L("Print Settings")), "print", no_controller) {} Tab(parent, _(L("Print Settings")), "print") {}
~TabPrint(){} ~TabPrint(){}
ogStaticText* m_recommended_thin_wall_thickness_description_line; ogStaticText* m_recommended_thin_wall_thickness_description_line;
@ -302,8 +301,8 @@ class TabFilament : public Tab
ogStaticText* m_cooling_description_line; ogStaticText* m_cooling_description_line;
public: public:
TabFilament() {} TabFilament() {}
TabFilament(wxNotebook* parent, bool no_controller) : TabFilament(wxNotebook* parent) :
Tab(parent, _(L("Filament Settings")), "filament", no_controller) {} Tab(parent, _(L("Filament Settings")), "filament") {}
~TabFilament(){} ~TabFilament(){}
void build() override; void build() override;
@ -335,7 +334,7 @@ public:
PrinterTechnology m_printer_technology = ptFFF; PrinterTechnology m_printer_technology = ptFFF;
TabPrinter() {} TabPrinter() {}
TabPrinter(wxNotebook* parent, bool no_controller) : Tab(parent, _(L("Printer Settings")), "printer", no_controller) {} TabPrinter(wxNotebook* parent) : Tab(parent, _(L("Printer Settings")), "printer") {}
~TabPrinter(){} ~TabPrinter(){}
void build() override; void build() override;
@ -357,8 +356,8 @@ class TabSLAMaterial : public Tab
{ {
public: public:
TabSLAMaterial() {} TabSLAMaterial() {}
TabSLAMaterial(wxNotebook* parent, bool no_controller) : TabSLAMaterial(wxNotebook* parent) :
Tab(parent, _(L("SLA Material Settings")), "sla_material", no_controller) {} Tab(parent, _(L("SLA Material Settings")), "sla_material") {}
~TabSLAMaterial(){} ~TabSLAMaterial(){}
void build() override; void build() override;

View File

@ -50,8 +50,8 @@ void set_plater(SV *ui)
void add_menus(SV *ui, int event_preferences_changed, int event_language_change) void add_menus(SV *ui, int event_preferences_changed, int event_language_change)
%code%{ Slic3r::GUI::add_menus((wxMenuBar*)wxPli_sv_2_object(aTHX_ ui, "Wx::MenuBar"), event_preferences_changed, event_language_change); %}; %code%{ Slic3r::GUI::add_menus((wxMenuBar*)wxPli_sv_2_object(aTHX_ ui, "Wx::MenuBar"), event_preferences_changed, event_language_change); %};
void create_preset_tabs(bool no_controller, int event_value_change, int event_presets_changed) void create_preset_tabs(int event_value_change, int event_presets_changed)
%code%{ Slic3r::GUI::create_preset_tabs(no_controller, event_value_change, event_presets_changed); %}; %code%{ Slic3r::GUI::create_preset_tabs(event_value_change, event_presets_changed); %};
void show_error_id(int id, std::string msg) void show_error_id(int id, std::string msg)
%code%{ Slic3r::GUI::show_error_id(id, msg); %}; %code%{ Slic3r::GUI::show_error_id(id, msg); %};

View File

@ -151,8 +151,6 @@ _constant()
} }
%}; %};
void print_to_png(std::string dirpath);
void add_model_object(ModelObject* model_object, int idx = -1); void add_model_object(ModelObject* model_object, int idx = -1);
bool apply_config(DynamicPrintConfig* config) bool apply_config(DynamicPrintConfig* config)
%code%{ RETVAL = THIS->apply_config(*config); %}; %code%{ RETVAL = THIS->apply_config(*config); %};
@ -166,6 +164,7 @@ _constant()
%}; %};
Clone<BoundingBox> bounding_box(); Clone<BoundingBox> bounding_box();
Clone<BoundingBox> total_bounding_box(); Clone<BoundingBox> total_bounding_box();
Clone<Point> size() %code%{ RETVAL = THIS->bounding_box().size(); %};
void set_callback_event(int evt) %code%{ void set_callback_event(int evt) %code%{
%}; %};
@ -196,4 +195,11 @@ _constant()
} }
%}; %};
void export_png(char *path) %code%{
try {
THIS->export_png(path);
} catch (std::exception& e) {
croak(e.what());
}
%};
}; };