PrusaSlicer-NonPlainar/xs/xsp/GCode.xsp
bubnikv 1385018724 Unicode handling:
Removed the Perl dependencies on Encode, Encode::Locale and Unicode::Normalize.
Added dependency on boost::locale.
Added encode_path, decode_path, normalize_utf8 functions to Slic3r.xs

Slic3r.xs has been made mostly utf8 safe by using the boost::nowide library,
thanks to @alexrj for the idea.

Simplified the encode_path / decode_path stuff:
wxWidgets are unicode already, so there is no need to decode_path() from it.
Perl / win32 interfacing is non-unicode, so decode_path() is executed
on ARGV just at the beginning of the perl scripts.
2017-08-03 17:31:31 +02:00

46 lines
1.5 KiB
Plaintext

%module{Slic3r::XS};
%{
#include <xsinit.h>
#include "libslic3r/GCode.hpp"
#include "libslic3r/GCode/CoolingBuffer.hpp"
%}
%name{Slic3r::GCode::CoolingBuffer} class CoolingBuffer {
CoolingBuffer(GCode* gcode)
%code{% RETVAL = new CoolingBuffer(*gcode); %};
~CoolingBuffer();
Ref<GCode> gcodegen();
std::string process_layer(std::string gcode, size_t layer_id);
};
%name{Slic3r::GCode} class GCode {
GCode();
~GCode();
std::string do_export(Print *print, const char *path);
Ref<Pointf> origin()
%code{% RETVAL = &(THIS->origin()); %};
void set_origin(Pointf* pointf)
%code{% THIS->set_origin(*pointf); %};
Ref<Point> last_pos()
%code{% RETVAL = &(THIS->last_pos()); %};
unsigned int layer_count() const;
void set_layer_count(unsigned int value);
void set_extruders(std::vector<unsigned int> extruders)
%code{% THIS->writer().set_extruders(extruders); THIS->writer().set_extruder(0); %};
void apply_print_config(StaticPrintConfig* print_config)
%code{%
if (const PrintConfig* config = dynamic_cast<PrintConfig*>(print_config)) {
THIS->apply_print_config(*config);
} else {
CONFESS("A PrintConfig object was not supplied to apply_print_config()");
}
%};
Ref<StaticPrintConfig> config()
%code{% RETVAL = const_cast<StaticPrintConfig*>(dynamic_cast<const StaticPrintConfig*>(&THIS->config())); %};
};