diff --git a/xs/src/ExtrusionEntity.cpp b/xs/src/ExtrusionEntity.cpp index 3865df877..0e023577e 100644 --- a/xs/src/ExtrusionEntity.cpp +++ b/xs/src/ExtrusionEntity.cpp @@ -2,6 +2,7 @@ #include "ExtrusionEntityCollection.hpp" #include "ExPolygonCollection.hpp" #include "ClipperUtils.hpp" +#include "Extruder.hpp" #include #ifdef SLIC3RXS #include "perlglue.hpp" @@ -109,7 +110,7 @@ ExtrusionPath::_inflate_collection(const Polylines &polylines, ExtrusionEntityCo REGISTER_CLASS(ExtrusionPath, "ExtrusionPath"); std::string -ExtrusionPath::gcode(SV* extruder, double e, double F, +ExtrusionPath::gcode(Extruder* extruder, double e, double F, double xofs, double yofs, std::string extrusion_axis, std::string gcode_line_suffix) const { @@ -127,19 +128,7 @@ ExtrusionPath::gcode(SV* extruder, double e, double F, const double line_length = line_it->length() * SCALING_FACTOR; // calculate extrusion length for this line - double E = 0; - if (e != 0) { - PUSHMARK(SP); - XPUSHs(extruder); - XPUSHs(sv_2mortal(newSVnv(e * line_length))); - PUTBACK; - - const int count = call_method("extrude", G_SCALAR); - SPAGAIN; - - // TODO: check that count is 1 - E = POPn; - } + double E = (e == 0) ? 0 : extruder->extrude(e * line_length); // compose G-code line diff --git a/xs/src/ExtrusionEntity.hpp b/xs/src/ExtrusionEntity.hpp index cab5be7d9..0e3c71ea7 100644 --- a/xs/src/ExtrusionEntity.hpp +++ b/xs/src/ExtrusionEntity.hpp @@ -9,6 +9,7 @@ namespace Slic3r { class ExPolygonCollection; class ExtrusionEntityCollection; +class Extruder; enum ExtrusionRole { erPerimeter, @@ -57,7 +58,7 @@ class ExtrusionPath : public ExtrusionEntity double length() const; #ifdef SLIC3RXS - std::string gcode(SV* extruder, double e, double F, + std::string gcode(Extruder* extruder, double e, double F, double xofs, double yofs, std::string extrusion_axis, std::string gcode_line_suffix) const; #endif diff --git a/xs/xsp/ExtrusionPath.xsp b/xs/xsp/ExtrusionPath.xsp index 5c013b182..2926f2eda 100644 --- a/xs/xsp/ExtrusionPath.xsp +++ b/xs/xsp/ExtrusionPath.xsp @@ -25,7 +25,7 @@ bool is_perimeter(); bool is_fill(); bool is_bridge(); - std::string gcode(SV* extruder, double e, double F, + std::string gcode(Extruder* extruder, double e, double F, double xofs, double yofs, std::string extrusion_axis, std::string gcode_line_suffix); %{