Fix of #10257 SPE-1641
The object labeling likely never worked. Likely it was contributed, but not reviewed sufficiently (by me I suppose). Now the object ID is calculated as an index in the list of PrintObjects, the order is arbitrary but stable, indices start with 0 and incremented for every printed object with no gap in indices. We are not quite sure how the indices are used by the OctoPrint "Cancel Object" plugin, I suppose this change is sufficient.
This commit is contained in:
parent
bceed00ae8
commit
fd3c41b4d3
1 changed files with 12 additions and 7 deletions
|
@ -2354,11 +2354,10 @@ void GCode::process_layer_single_object(
|
||||||
// Round 1 (wiping into object or infill) or round 2 (normal extrusions).
|
// Round 1 (wiping into object or infill) or round 2 (normal extrusions).
|
||||||
const bool print_wipe_extrusions)
|
const bool print_wipe_extrusions)
|
||||||
{
|
{
|
||||||
//FIXME what the heck ID is this? Layer ID or Object ID? More likely an Object ID.
|
bool first = true;
|
||||||
uint32_t layer_id = 0;
|
int object_id = 0;
|
||||||
bool first = true;
|
|
||||||
// Delay layer initialization as many layers may not print with all extruders.
|
// Delay layer initialization as many layers may not print with all extruders.
|
||||||
auto init_layer_delayed = [this, &print_instance, &layer_to_print, layer_id, &first, &gcode]() {
|
auto init_layer_delayed = [this, &print_instance, &layer_to_print, &first, &object_id, &gcode]() {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
const PrintObject &print_object = print_instance.print_object;
|
const PrintObject &print_object = print_instance.print_object;
|
||||||
|
@ -2374,8 +2373,14 @@ void GCode::process_layer_single_object(
|
||||||
m_avoid_crossing_perimeters.use_external_mp_once();
|
m_avoid_crossing_perimeters.use_external_mp_once();
|
||||||
m_last_obj_copy = this_object_copy;
|
m_last_obj_copy = this_object_copy;
|
||||||
this->set_origin(unscale(offset));
|
this->set_origin(unscale(offset));
|
||||||
if (this->config().gcode_label_objects)
|
if (this->config().gcode_label_objects) {
|
||||||
gcode += std::string("; printing object ") + print_object.model_object()->name + " id:" + std::to_string(layer_id) + " copy " + std::to_string(print_instance.instance_id) + "\n";
|
for (const PrintObject *po : print_object.print()->objects())
|
||||||
|
if (po == &print_object)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
++ object_id;
|
||||||
|
gcode += std::string("; printing object ") + print_object.model_object()->name + " id:" + std::to_string(object_id) + " copy " + std::to_string(print_instance.instance_id) + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2548,7 +2553,7 @@ void GCode::process_layer_single_object(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! first && this->config().gcode_label_objects)
|
if (! first && this->config().gcode_label_objects)
|
||||||
gcode += std::string("; stop printing object ") + print_object.model_object()->name + " id:" + std::to_string(layer_id) + " copy " + std::to_string(print_instance.instance_id) + "\n";
|
gcode += std::string("; stop printing object ") + print_object.model_object()->name + " id:" + std::to_string(object_id) + " copy " + std::to_string(print_instance.instance_id) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCode::apply_print_config(const PrintConfig &print_config)
|
void GCode::apply_print_config(const PrintConfig &print_config)
|
||||||
|
|
Loading…
Reference in a new issue