Make C++ gcode generator use C++ Extruder object directly.

This commit is contained in:
Y. Sapir 2014-04-08 02:43:02 +03:00
parent 66d23a2416
commit 04fad70cbf
3 changed files with 6 additions and 16 deletions

View File

@ -2,6 +2,7 @@
#include "ExtrusionEntityCollection.hpp"
#include "ExPolygonCollection.hpp"
#include "ClipperUtils.hpp"
#include "Extruder.hpp"
#include <sstream>
#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

View File

@ -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

View File

@ -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);
%{