2014-05-10 13:08:49 +00:00
|
|
|
#ifndef slic3r_GCode_hpp_
|
|
|
|
#define slic3r_GCode_hpp_
|
|
|
|
|
|
|
|
#include <myinit.h>
|
2015-07-01 18:14:05 +00:00
|
|
|
#include "ExPolygon.hpp"
|
2015-07-01 19:47:17 +00:00
|
|
|
#include "GCodeWriter.hpp"
|
|
|
|
#include "Layer.hpp"
|
2015-07-01 18:14:05 +00:00
|
|
|
#include "MotionPlanner.hpp"
|
2015-07-01 19:47:17 +00:00
|
|
|
#include "Point.hpp"
|
|
|
|
#include "PlaceholderParser.hpp"
|
|
|
|
#include "Print.hpp"
|
|
|
|
#include "PrintConfig.hpp"
|
2014-05-10 13:08:49 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2015-07-01 21:00:52 +00:00
|
|
|
class GCode;
|
2014-05-10 13:08:49 +00:00
|
|
|
|
2015-07-01 18:14:05 +00:00
|
|
|
class AvoidCrossingPerimeters {
|
2014-05-10 13:08:49 +00:00
|
|
|
public:
|
|
|
|
|
2015-07-01 18:14:05 +00:00
|
|
|
// this flag triggers the use of the external configuration space
|
|
|
|
bool use_external_mp;
|
|
|
|
bool use_external_mp_once; // just for the next travel move
|
|
|
|
|
|
|
|
// this flag disables avoid_crossing_perimeters just for the next travel move
|
|
|
|
// we enable it by default for the first travel move in print
|
|
|
|
bool disable_once;
|
|
|
|
|
|
|
|
AvoidCrossingPerimeters();
|
|
|
|
~AvoidCrossingPerimeters();
|
|
|
|
void init_external_mp(const ExPolygons &islands);
|
|
|
|
void init_layer_mp(const ExPolygons &islands);
|
2015-07-01 21:00:52 +00:00
|
|
|
Polyline travel_to(GCode &gcodegen, Point point);
|
2015-07-01 18:14:05 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
MotionPlanner* _external_mp;
|
|
|
|
MotionPlanner* _layer_mp;
|
2014-05-10 13:08:49 +00:00
|
|
|
};
|
|
|
|
|
2015-07-01 19:01:42 +00:00
|
|
|
class OozePrevention {
|
|
|
|
public:
|
|
|
|
bool enable;
|
|
|
|
Points standby_points;
|
|
|
|
|
|
|
|
OozePrevention();
|
|
|
|
};
|
|
|
|
|
2015-07-01 18:57:16 +00:00
|
|
|
class Wipe {
|
|
|
|
public:
|
|
|
|
bool enable;
|
|
|
|
Polyline path;
|
|
|
|
|
|
|
|
Wipe();
|
|
|
|
bool has_path();
|
|
|
|
void reset_path();
|
2015-07-01 21:00:52 +00:00
|
|
|
std::string wipe(GCode &gcodegen, bool toolchange = false);
|
2015-07-01 18:57:16 +00:00
|
|
|
};
|
|
|
|
|
2015-07-01 19:47:17 +00:00
|
|
|
class GCode {
|
|
|
|
public:
|
|
|
|
|
|
|
|
/* Origin of print coordinates expressed in unscaled G-code coordinates.
|
|
|
|
This affects the input arguments supplied to the extrude*() and travel_to()
|
|
|
|
methods. */
|
|
|
|
Pointf origin;
|
|
|
|
FullPrintConfig config;
|
|
|
|
GCodeWriter writer;
|
|
|
|
PlaceholderParser* placeholder_parser;
|
|
|
|
OozePrevention ooze_prevention;
|
|
|
|
Wipe wipe;
|
|
|
|
AvoidCrossingPerimeters avoid_crossing_perimeters;
|
|
|
|
bool enable_loop_clipping;
|
|
|
|
bool enable_cooling_markers;
|
|
|
|
size_t layer_count;
|
|
|
|
int layer_index; // just a counter
|
|
|
|
Layer* layer;
|
|
|
|
std::map<PrintObject*,Point> _seam_position;
|
|
|
|
bool first_layer; // this flag triggers first layer speeds
|
|
|
|
unsigned int elapsed_time; // seconds
|
|
|
|
double volumetric_speed;
|
|
|
|
|
|
|
|
GCode();
|
2015-07-01 21:00:52 +00:00
|
|
|
Point& last_pos();
|
|
|
|
void set_last_pos(const Point &pos);
|
|
|
|
bool last_pos_defined() const;
|
|
|
|
void apply_print_config(const PrintConfig &print_config);
|
|
|
|
void set_origin(const Pointf &pointf);
|
|
|
|
std::string preamble();
|
2015-07-01 21:14:40 +00:00
|
|
|
bool needs_retraction(const Polyline &travel, ExtrusionRole role);
|
2015-07-01 21:00:52 +00:00
|
|
|
std::string retract(bool toolchange = false);
|
|
|
|
std::string unretract();
|
|
|
|
Pointf point_to_gcode(const Point &point);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Point _last_pos;
|
|
|
|
bool _last_pos_defined;
|
2015-07-01 19:47:17 +00:00
|
|
|
};
|
|
|
|
|
2014-05-10 13:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|