@@ -1529,11 +1529,18 @@ void GCode::process_layers(
1529
1529
{
1530
1530
// The pipeline is variable: The vase mode filter is optional.
1531
1531
size_t layer_to_print_idx = 0 ;
1532
- const auto generator = tbb::make_filter<void , GCode::LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1533
- [this , &print, &tool_ordering, &print_object_instances_ordering, &layers_to_print, &layer_to_print_idx](tbb::flow_control& fc) -> GCode::LayerResult {
1534
- if (layer_to_print_idx == layers_to_print.size ()) {
1535
- fc.stop ();
1536
- return {};
1532
+ const auto generator = tbb::make_filter<void , LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1533
+ [this , &print, &tool_ordering, &print_object_instances_ordering, &layers_to_print, &layer_to_print_idx](tbb::flow_control& fc) -> LayerResult {
1534
+ if (layer_to_print_idx >= layers_to_print.size ()) {
1535
+ if ((!m_pressure_equalizer && layer_to_print_idx == layers_to_print.size ()) || (m_pressure_equalizer && layer_to_print_idx == (layers_to_print.size () + 1 ))) {
1536
+ fc.stop ();
1537
+ return {};
1538
+ } else {
1539
+ // Pressure equalizer need insert empty input. Because it returns one layer back.
1540
+ // Insert NOP (no operation) layer;
1541
+ ++layer_to_print_idx;
1542
+ return LayerResult::make_nop_layer_result ();
1543
+ }
1537
1544
} else {
1538
1545
const std::pair<coordf_t , std::vector<LayerToPrint>>& layer = layers_to_print[layer_to_print_idx++];
1539
1546
const LayerTools& layer_tools = tool_ordering.tools_for_layer (layer.first );
@@ -1543,17 +1550,23 @@ void GCode::process_layers(
1543
1550
return this ->process_layer (print, layer.second , layer_tools, &layer == &layers_to_print.back (), &print_object_instances_ordering, size_t (-1 ));
1544
1551
}
1545
1552
});
1546
- const auto spiral_vase = tbb::make_filter<GCode::LayerResult, GCode::LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1547
- [&spiral_vase = *this ->m_spiral_vase ](GCode::LayerResult in) -> GCode::LayerResult {
1553
+ const auto spiral_vase = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1554
+ [&spiral_vase = *this ->m_spiral_vase ](LayerResult in) -> LayerResult {
1555
+ if (in.nop_layer_result )
1556
+ return in;
1557
+
1548
1558
spiral_vase.enable (in.spiral_vase_enable );
1549
- return { spiral_vase.process_layer (std::move (in.gcode )), in.layer_id , in.spiral_vase_enable , in.cooling_buffer_flush , in. pressure_equalizer_buffer_flush };
1559
+ return { spiral_vase.process_layer (std::move (in.gcode )), in.layer_id , in.spiral_vase_enable , in.cooling_buffer_flush };
1550
1560
});
1551
- const auto pressure_equalizer = tbb::make_filter<GCode:: LayerResult, GCode:: LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1552
- [&pressure_equalizer = *this ->m_pressure_equalizer ](GCode:: LayerResult in) -> GCode:: LayerResult {
1553
- return { std::string ( pressure_equalizer.process_layer (std::move (in. gcode . c_str ()), in. pressure_equalizer_buffer_flush )), in. layer_id , in. spiral_vase_enable , in. cooling_buffer_flush , in. pressure_equalizer_buffer_flush } ;
1561
+ const auto pressure_equalizer = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1562
+ [&pressure_equalizer = *this ->m_pressure_equalizer ](LayerResult in) -> LayerResult {
1563
+ return pressure_equalizer.process_layer (std::move (in)) ;
1554
1564
});
1555
- const auto cooling = tbb::make_filter<GCode::LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
1556
- [&cooling_buffer = *this ->m_cooling_buffer ](GCode::LayerResult in) -> std::string {
1565
+ const auto cooling = tbb::make_filter<LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
1566
+ [&cooling_buffer = *this ->m_cooling_buffer ](LayerResult in) -> std::string {
1567
+ if (in.nop_layer_result )
1568
+ return in.gcode ;
1569
+
1557
1570
return cooling_buffer.process_layer (std::move (in.gcode ), in.layer_id , in.cooling_buffer_flush );
1558
1571
});
1559
1572
const auto find_replace = tbb::make_filter<std::string, std::string>(slic3r_tbb_filtermode::serial_in_order,
@@ -1601,28 +1614,39 @@ void GCode::process_layers(
1601
1614
{
1602
1615
// The pipeline is variable: The vase mode filter is optional.
1603
1616
size_t layer_to_print_idx = 0 ;
1604
- const auto generator = tbb::make_filter<void , GCode::LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1605
- [this , &print, &tool_ordering, &layers_to_print, &layer_to_print_idx, single_object_idx](tbb::flow_control& fc) -> GCode::LayerResult {
1606
- if (layer_to_print_idx == layers_to_print.size ()) {
1607
- fc.stop ();
1608
- return {};
1617
+ const auto generator = tbb::make_filter<void , LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1618
+ [this , &print, &tool_ordering, &layers_to_print, &layer_to_print_idx, single_object_idx](tbb::flow_control& fc) -> LayerResult {
1619
+ if (layer_to_print_idx >= layers_to_print.size ()) {
1620
+ if ((!m_pressure_equalizer && layer_to_print_idx == layers_to_print.size ()) || (m_pressure_equalizer && layer_to_print_idx == (layers_to_print.size () + 1 ))) {
1621
+ fc.stop ();
1622
+ return {};
1623
+ } else {
1624
+ // Pressure equalizer need insert empty input. Because it returns one layer back.
1625
+ // Insert NOP (no operation) layer;
1626
+ ++layer_to_print_idx;
1627
+ return LayerResult::make_nop_layer_result ();
1628
+ }
1609
1629
} else {
1610
1630
LayerToPrint &layer = layers_to_print[layer_to_print_idx ++];
1611
1631
print.throw_if_canceled ();
1612
1632
return this ->process_layer (print, { std::move (layer) }, tool_ordering.tools_for_layer (layer.print_z ()), &layer == &layers_to_print.back (), nullptr , single_object_idx);
1613
1633
}
1614
1634
});
1615
- const auto spiral_vase = tbb::make_filter<GCode::LayerResult, GCode::LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1616
- [&spiral_vase = *this ->m_spiral_vase ](GCode::LayerResult in)->GCode ::LayerResult {
1635
+ const auto spiral_vase = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1636
+ [&spiral_vase = *this ->m_spiral_vase ](LayerResult in)->LayerResult {
1637
+ if (in.nop_layer_result )
1638
+ return in;
1617
1639
spiral_vase.enable (in.spiral_vase_enable );
1618
- return { spiral_vase.process_layer (std::move (in.gcode )), in.layer_id , in.spiral_vase_enable , in.cooling_buffer_flush , in. pressure_equalizer_buffer_flush };
1640
+ return { spiral_vase.process_layer (std::move (in.gcode )), in.layer_id , in.spiral_vase_enable , in.cooling_buffer_flush };
1619
1641
});
1620
- const auto pressure_equalizer = tbb::make_filter<GCode:: LayerResult, GCode:: LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1621
- [&pressure_equalizer = *this ->m_pressure_equalizer ](GCode:: LayerResult in) -> GCode:: LayerResult {
1622
- return { std::string ( pressure_equalizer.process_layer (std::move (in. gcode . c_str ()), in. pressure_equalizer_buffer_flush )), in. layer_id , in. spiral_vase_enable , in. cooling_buffer_flush , in. pressure_equalizer_buffer_flush } ;
1642
+ const auto pressure_equalizer = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
1643
+ [&pressure_equalizer = *this ->m_pressure_equalizer ](LayerResult in) -> LayerResult {
1644
+ return pressure_equalizer.process_layer (std::move (in)) ;
1623
1645
});
1624
- const auto cooling = tbb::make_filter<GCode::LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
1625
- [&cooling_buffer = *this ->m_cooling_buffer ](GCode::LayerResult in)->std ::string {
1646
+ const auto cooling = tbb::make_filter<LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
1647
+ [&cooling_buffer = *this ->m_cooling_buffer ](LayerResult in)->std ::string {
1648
+ if (in.nop_layer_result )
1649
+ return in.gcode ;
1626
1650
return cooling_buffer.process_layer (std::move (in.gcode ), in.layer_id , in.cooling_buffer_flush );
1627
1651
});
1628
1652
const auto find_replace = tbb::make_filter<std::string, std::string>(slic3r_tbb_filtermode::serial_in_order,
@@ -2079,7 +2103,7 @@ namespace Skirt {
2079
2103
// In non-sequential mode, process_layer is called per each print_z height with all object and support layers accumulated.
2080
2104
// For multi-material prints, this routine minimizes extruder switches by gathering extruder specific extrusion paths
2081
2105
// and performing the extruder specific extrusions together.
2082
- GCode:: LayerResult GCode::process_layer (
2106
+ LayerResult GCode::process_layer (
2083
2107
const Print &print,
2084
2108
// Set of object & print layers of the same PrintObject and with the same print_z.
2085
2109
const std::vector<LayerToPrint> &layers,
@@ -2110,7 +2134,7 @@ GCode::LayerResult GCode::process_layer(
2110
2134
}
2111
2135
}
2112
2136
const Layer &layer = (object_layer != nullptr ) ? *object_layer : *support_layer;
2113
- GCode:: LayerResult result { {}, layer.id (), false , last_layer, last_layer };
2137
+ LayerResult result { {}, layer.id (), false , last_layer, false };
2114
2138
if (layer_tools.extruders .empty ())
2115
2139
// Nothing to extrude.
2116
2140
return result;
0 commit comments