mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 20:35:54 +08:00
Octoprint-Cancelobject compatibility (when verbose gcode)
This commit is contained in:
parent
4e2ec2e57a
commit
5ceec2822e
@ -1341,10 +1341,10 @@ void GCode::process_layer(
|
|||||||
for (const ObjectByExtruder &object_by_extruder : objects_by_extruder_it->second) {
|
for (const ObjectByExtruder &object_by_extruder : objects_by_extruder_it->second) {
|
||||||
const size_t layer_id = &object_by_extruder - objects_by_extruder_it->second.data();
|
const size_t layer_id = &object_by_extruder - objects_by_extruder_it->second.data();
|
||||||
const PrintObject *print_object = layers[layer_id].object();
|
const PrintObject *print_object = layers[layer_id].object();
|
||||||
if (print_object == nullptr)
|
if (print_object == nullptr)
|
||||||
// This layer is empty for this particular object, it has neither object extrusions nor support extrusions at this print_z.
|
// This layer is empty for this particular object, it has neither object extrusions nor support extrusions at this print_z.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_config.apply(print_object->config, true);
|
m_config.apply(print_object->config, true);
|
||||||
m_layer = layers[layer_id].layer();
|
m_layer = layers[layer_id].layer();
|
||||||
if (m_config.avoid_crossing_perimeters)
|
if (m_config.avoid_crossing_perimeters)
|
||||||
@ -1354,9 +1354,14 @@ void GCode::process_layer(
|
|||||||
copies = print_object->_shifted_copies;
|
copies = print_object->_shifted_copies;
|
||||||
else
|
else
|
||||||
copies.push_back(print_object->_shifted_copies[single_object_idx]);
|
copies.push_back(print_object->_shifted_copies[single_object_idx]);
|
||||||
// Sort the copies by the closest point starting with the current print position.
|
//FIXME: Sort the copies by the closest point starting with the current print position.
|
||||||
|
// be careful to set a good copy_idx (used to identify the copy).
|
||||||
|
|
||||||
|
int copy_idx = 0;
|
||||||
for (const Point © : copies) {
|
for (const Point © : copies) {
|
||||||
|
if (this->config().gcode_comments){
|
||||||
|
gcode += ((std::ostringstream&)(std::ostringstream() << "; printing object " << print_object->model_object()->name << " id:" << layer_id << " copy " << copy_idx << "\n")).str();
|
||||||
|
}
|
||||||
// When starting a new object, use the external motion planner for the first travel move.
|
// When starting a new object, use the external motion planner for the first travel move.
|
||||||
std::pair<const PrintObject*, Point> this_object_copy(print_object, copy);
|
std::pair<const PrintObject*, Point> this_object_copy(print_object, copy);
|
||||||
if (m_last_obj_copy != this_object_copy)
|
if (m_last_obj_copy != this_object_copy)
|
||||||
@ -1379,6 +1384,10 @@ void GCode::process_layer(
|
|||||||
gcode += this->extrude_infill(print, island.by_region);
|
gcode += this->extrude_infill(print, island.by_region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this->config().gcode_comments){
|
||||||
|
gcode += ((std::ostringstream&)(std::ostringstream() << "; stop printing object " << print_object->model_object()->name << " id:" << layer_id << " copy " << copy_idx << "\n")).str();
|
||||||
|
}
|
||||||
|
copy_idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2362,6 +2371,10 @@ std::string GCode::retract(bool toolchange)
|
|||||||
|
|
||||||
if (m_writer.extruder() == nullptr)
|
if (m_writer.extruder() == nullptr)
|
||||||
return gcode;
|
return gcode;
|
||||||
|
|
||||||
|
// We need to reset e before any extrusion or wipe to allow the reset to happen at the real
|
||||||
|
// begining of an object gcode
|
||||||
|
gcode += m_writer.reset_e();
|
||||||
|
|
||||||
// wipe (if it's enabled for this extruder and we have a stored wipe path)
|
// wipe (if it's enabled for this extruder and we have a stored wipe path)
|
||||||
if (EXTRUDER_CONFIG(wipe) && m_wipe.has_path()) {
|
if (EXTRUDER_CONFIG(wipe) && m_wipe.has_path()) {
|
||||||
@ -2375,7 +2388,6 @@ std::string GCode::retract(bool toolchange)
|
|||||||
length is honored in case wipe path was too short. */
|
length is honored in case wipe path was too short. */
|
||||||
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
|
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
|
||||||
|
|
||||||
gcode += m_writer.reset_e();
|
|
||||||
if (m_writer.extruder()->retract_length() > 0 || m_config.use_firmware_retraction)
|
if (m_writer.extruder()->retract_length() > 0 || m_config.use_firmware_retraction)
|
||||||
gcode += m_writer.lift();
|
gcode += m_writer.lift();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user