G code generator will include marks for the G-code analyzer, so

the path preview will be colored with a fine granularity.
This commit is contained in:
bubnikv 2016-09-26 12:52:40 +02:00
parent 8564ac391c
commit feb269c97c
3 changed files with 23 additions and 7 deletions

View file

@ -211,7 +211,7 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
GCode::GCode()
: placeholder_parser(NULL), enable_loop_clipping(true),
enable_cooling_markers(false), enable_extrusion_role_markers(false),
enable_cooling_markers(false), enable_extrusion_role_markers(false), enable_analyzer_markers(false),
layer_count(0),
layer_index(-1), layer(NULL), first_layer(false), elapsed_time(0.0), volumetric_speed(0),
_last_pos_defined(false),
@ -303,6 +303,15 @@ GCode::change_layer(const Layer &layer)
this->first_layer = (layer.id() == 0);
delete this->_lower_layer_edge_grid;
this->_lower_layer_edge_grid = NULL;
std::string gcode;
if (enable_analyzer_markers) {
// Store the binary pointer to the layer object directly into the G-code to be accessed by the GCodeAnalyzer.
char buf[64];
sprintf(buf, ";_LAYEROBJ:%p\n", this->layer);
gcode += buf;
}
// avoid computing islands and overhangs if they're not needed
if (this->config.avoid_crossing_perimeters) {
@ -311,7 +320,6 @@ GCode::change_layer(const Layer &layer)
this->avoid_crossing_perimeters.init_layer_mp(islands);
}
std::string gcode;
if (this->layer_count > 0) {
gcode += this->writer.update_progress(this->layer_index, this->layer_count);
}
@ -864,7 +872,7 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
double F = speed * 60; // convert mm/sec to mm/min
// extrude arc or line
if (this->enable_extrusion_role_markers) {
if (this->enable_extrusion_role_markers || this->enable_analyzer_markers) {
if (path.role != this->_last_extrusion_role) {
this->_last_extrusion_role = path.role;
char buf[32];

View file

@ -85,8 +85,16 @@ class GCode {
// Markers for the Pressure Equalizer to recognize the extrusion type.
// The Pressure Equalizer removes the markers from the final G-code.
bool enable_extrusion_role_markers;
// Extended markers for the G-code Analyzer.
// The G-code Analyzer will remove these comments from the final G-code.
bool enable_analyzer_markers;
// How many times will change_layer() be called?
// change_layer() will update the progress bar.
size_t layer_count;
int layer_index; // just a counter
// Progress bar indicator. Increments from -1 up to layer_count.
int layer_index;
// Current layer processed. Insequential printing mode, only a single copy will be printed.
// In non-sequential mode, all its copies will be printed.
const Layer* layer;
std::map<const PrintObject*,Point> _seam_position;
// Distance Field structure to

View file

@ -69,7 +69,7 @@ class GCodeSender : private boost::noncopyable {
void send();
};
}
} // namespace Slic3r
#endif
#endif
#endif /* BOOST_LIBS */
#endif /* slic3r_GCodeSender_hpp_ */