Ported the cooling changes from @alexrj: Don't slow down the external

perimeters if not necessary, don't take the bridging time into account
when slowing down the print.

Removed Extruder & GCodeWriter Perl bindings.
Improved Extruder for constness.
Refactored GCode::m_elapsed_time to struct ElapsedTime.
This commit is contained in:
bubnikv 2017-06-22 12:59:23 +02:00
parent c1146e298b
commit 0454cc95f9
17 changed files with 156 additions and 220 deletions

View file

@ -1,52 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#include "libslic3r/Extruder.hpp"
%}
%name{Slic3r::Extruder} class Extruder {
Extruder(unsigned int id, StaticPrintConfig* config)
%code%{ RETVAL = new Extruder (id, dynamic_cast<GCodeConfig*>(config)); %};
~Extruder();
void reset();
double extrude(double dE);
double retract(double length, double restart_extra);
double unretract();
double e_per_mm(double mm3_per_mm);
double extruded_volume();
double used_filament();
unsigned int id()
%code%{ RETVAL = THIS->id; %};
double E()
%code%{ RETVAL = THIS->E; %};
double set_E(double val)
%code%{ RETVAL = THIS->E = val; %};
double absolute_E()
%code%{ RETVAL = THIS->absolute_E; %};
double set_absolute_E(double val)
%code%{ RETVAL = THIS->absolute_E = val; %};
double retracted()
%code%{ RETVAL = THIS->retracted; %};
double set_retracted(double val)
%code%{ RETVAL = THIS->retracted = val; %};
double restart_extra()
%code%{ RETVAL = THIS->restart_extra; %};
double set_restart_extra(double val)
%code%{ RETVAL = THIS->restart_extra = val; %};
double e_per_mm3()
%code%{ RETVAL = THIS->e_per_mm3; %};
double filament_diameter();
double filament_density();
double filament_cost();
double extrusion_multiplier();
double retract_length();
double retract_lift();
int retract_speed();
double retract_restart_extra();
double retract_length_toolchange();
double retract_restart_extra_toolchange();
};

View file

@ -1,64 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#include "libslic3r/GCodeWriter.hpp"
%}
%name{Slic3r::GCode::Writer} class GCodeWriter {
GCodeWriter();
~GCodeWriter();
Ref<StaticPrintConfig> config()
%code%{ RETVAL = &THIS->config; %};
bool multiple_extruders()
%code{% RETVAL = THIS->multiple_extruders; %};
Ref<Extruder> extruder();
std::string extrusion_axis();
void apply_print_config(PrintConfig* print_config)
%code{% THIS->apply_print_config(*print_config); %};
void set_extruders(std::vector<unsigned int> extruder_ids);
std::string preamble();
std::string postamble();
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1);
std::string set_bed_temperature(unsigned int temperature, bool wait = false);
std::string set_fan(unsigned int speed, bool dont_save = false);
std::string set_acceleration(unsigned int acceleration);
std::string reset_e(bool force = false);
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false);
bool need_toolchange(unsigned int extruder_id);
std::string set_extruder(unsigned int extruder_id);
std::string toolchange(unsigned int extruder_id);
std::string set_speed(double F, std::string comment = std::string());
std::string travel_to_xy(Pointf* point, std::string comment = std::string())
%code{% RETVAL = THIS->travel_to_xy(*point, comment); %};
std::string travel_to_xyz(Pointf3* point, std::string comment = std::string())
%code{% RETVAL = THIS->travel_to_xyz(*point, comment); %};
std::string travel_to_z(double z, std::string comment = std::string());
bool will_move_z(double z);
std::string extrude_to_xy(Pointf* point, double dE, std::string comment = std::string())
%code{% RETVAL = THIS->extrude_to_xy(*point, dE, comment); %};
std::string extrude_to_xyz(Pointf3* point, double dE, std::string comment = std::string())
%code{% RETVAL = THIS->extrude_to_xyz(*point, dE, comment); %};
std::string retract();
std::string retract_for_toolchange();
std::string unretract();
std::string lift();
std::string unlift();
Clone<Pointf3> get_position() const;
%{
SV*
GCodeWriter::extruders()
CODE:
AV* av = newAV();
av_fill(av, THIS->extruders.size()-1);
int i = 0;
for (const Extruder &extruder : THIS->extruders)
av_store(av, i++, perl_to_SV_ref(const_cast<Extruder&>(extruder)));
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
RETVAL
%}
};

View file

@ -138,10 +138,6 @@ Clone<Surface> O_OBJECT_SLIC3R_T
SurfaceCollection* O_OBJECT_SLIC3R
Ref<SurfaceCollection> O_OBJECT_SLIC3R_T
Extruder* O_OBJECT_SLIC3R
Ref<Extruder> O_OBJECT_SLIC3R_T
Clone<Extruder> O_OBJECT_SLIC3R_T
Model* O_OBJECT_SLIC3R
Ref<Model> O_OBJECT_SLIC3R_T
Clone<Model> O_OBJECT_SLIC3R_T
@ -201,10 +197,6 @@ GCodeSender* O_OBJECT_SLIC3R
Ref<GCodeSender> O_OBJECT_SLIC3R_T
Clone<GCodeSender> O_OBJECT_SLIC3R_T
GCodeWriter* O_OBJECT_SLIC3R
Ref<GCodeWriter> O_OBJECT_SLIC3R_T
Clone<GCodeWriter> O_OBJECT_SLIC3R_T
BridgeDetector* O_OBJECT_SLIC3R
Ref<BridgeDetector> O_OBJECT_SLIC3R_T
Clone<BridgeDetector> O_OBJECT_SLIC3R_T

View file

@ -99,9 +99,6 @@
%typemap{MotionPlanner*};
%typemap{Ref<MotionPlanner>}{simple};
%typemap{Clone<MotionPlanner>}{simple};
%typemap{GCodeWriter*};
%typemap{Ref<GCodeWriter>}{simple};
%typemap{Clone<GCodeWriter>}{simple};
%typemap{GCodeSender*};
%typemap{Ref<GCodeSender>}{simple};
%typemap{Clone<GCodeSender>}{simple};
@ -169,9 +166,6 @@
%typemap{Polygons*};
%typemap{TriangleMesh*};
%typemap{TriangleMeshPtrs};
%typemap{Extruder*};
%typemap{Ref<Extruder>}{simple};
%typemap{Clone<Extruder>}{simple};
%typemap{Model*};
%typemap{Ref<Model>}{simple};
%typemap{Clone<Model>}{simple};