diff --git a/include/PrimeTower.h b/include/PrimeTower.h index c0e50685bf..c2909295d8 100644 --- a/include/PrimeTower.h +++ b/include/PrimeTower.h @@ -41,6 +41,7 @@ class PrimeTower std::vector pattern_per_extruder; //!< For each extruder the pattern to print on all layers of the prime tower. std::vector pattern_per_extruder_layer0; //!< For each extruder the pattern to print on the first layer + std::vector pattern_per_extruder_layer_raft; //!< For each extruder the pattern to print on the raft layers public: bool enabled; //!< Whether the prime tower is enabled. diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index 8f7d993811..bd29bcef24 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -163,8 +163,8 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep run_multiple_producers_ordered_consumer( process_layer_starting_layer_nr, //-Raft::getTotalExtraLayers(), - total_layers + Raft::getFillerLayerCount() - 1, - // total_layers, + // total_layers + Raft::getFillerLayerCount() - 1, + total_layers, [&storage, total_layers, this](int layer_nr) { return &processLayer(storage, layer_nr, total_layers); diff --git a/src/PrimeTower.cpp b/src/PrimeTower.cpp index 9845eff054..b0bf9e853e 100644 --- a/src/PrimeTower.cpp +++ b/src/PrimeTower.cpp @@ -117,6 +117,7 @@ void PrimeTower::generatePaths_denseInfill() const coord_t layer_height = mesh_group_settings.get("layer_height"); pattern_per_extruder.resize(extruder_count); pattern_per_extruder_layer0.resize(extruder_count); + pattern_per_extruder_layer_raft.resize(extruder_count); coord_t cumulative_inset = 0; // Each tower shape is going to be printed inside the other. This is the inset we're doing for each extruder. for (size_t extruder_nr : extruder_order) @@ -150,7 +151,7 @@ void PrimeTower::generatePaths_denseInfill() { // Generate the pattern for the first layer. const coord_t line_width_layer0 = scene.extruders[extruder_nr].settings.get("raft_base_line_width"); - ExtrusionMoves& pattern_layer0 = pattern_per_extruder_layer0[extruder_nr]; + ExtrusionMoves& pattern_layer_raft = pattern_per_extruder_layer_raft[extruder_nr]; // Generate a concentric infill pattern in the form insets for the prime tower's first layer instead of using // the infill pattern because the infill pattern tries to connect polygons in different insets which causes the @@ -158,16 +159,29 @@ void PrimeTower::generatePaths_denseInfill() Polygons inset = outer_poly.offset(-cumulative_inset - line_width_layer0 / 2); while (! inset.empty()) { - pattern_layer0.polygons.add(inset); + pattern_layer_raft.polygons.add(inset); inset = inset.offset(-line_width_layer0); } Polygons outset = outer_poly.offset(cumulative_inset + line_width_layer0 / 2); for (int i = 0; i < 15; ++i) { - pattern_layer0.polygons.add(outset); + pattern_layer_raft.polygons.add(outset); outset = outset.offset(line_width_layer0); } + + // Generate the pattern for the raft layers + ExtrusionMoves& pattern_layer0 = pattern_per_extruder_layer0[extruder_nr]; + + // Generate a concentric infill pattern in the form insets for the prime tower's first layer instead of using + // the infill pattern because the infill pattern tries to connect polygons in different insets which causes the + // first layer of the prime tower to not stick well. + outset = outer_poly.offset(cumulative_inset + line_width / 2); + for (int i = 0; i < 15; ++i) + { + pattern_layer0.polygons.add(outset); + outset = outset.offset(line_width); + } } cumulative_inset += wall_nr * line_width; } @@ -235,24 +249,71 @@ void PrimeTower::addToGcode_denseInfill(LayerPlan& gcode_layer, const size_t ext const GCodePathConfig& config = gcode_layer.getLayerNr() < 0 ? gcode_layer.configs_storage.raft_base_config : gcode_layer.configs_storage.prime_tower_config_per_extruder[extruder_nr]; - - // if (gcode_layer.getLayerNr() == -static_cast(Raft::getTotalExtraLayers())) - if (gcode_layer.getLayerNr() < 0 && extruder_nr == 0) + if (gcode_layer.getLayerNr() == -Raft::getTotalExtraLayers() && extruder_nr == 0) { + // Specific case for first layer => very high adhesion const GCodePathConfig& config = gcode_layer.configs_storage.raft_base_config; - const ExtrusionMoves& pattern0 = pattern_per_extruder_layer0[extruder_nr]; - gcode_layer.addPolygonsByOptimizer(pattern0.polygons, config); - gcode_layer.addLinesByOptimizer(pattern0.lines, config, SpaceFillType::Lines); + const ExtrusionMoves& pattern_raft = pattern_per_extruder_layer_raft[extruder_nr]; + gcode_layer.addPolygonsByOptimizer(pattern_raft.polygons, config); + gcode_layer.addLinesByOptimizer(pattern_raft.lines, config, SpaceFillType::Lines); } else { const GCodePathConfig& config = gcode_layer.configs_storage.prime_tower_config_per_extruder[extruder_nr]; + // Actual prime pattern + const ExtrusionMoves& pattern = pattern_per_extruder[extruder_nr]; + gcode_layer.addPolygonsByOptimizer(pattern.polygons, config); + gcode_layer.addLinesByOptimizer(pattern.lines, config, SpaceFillType::Lines); + + if (gcode_layer.getLayerNr() < 0 && extruder_nr == 0) + { + const ExtrusionMoves& pattern0 = pattern_per_extruder_layer0[extruder_nr]; + gcode_layer.addPolygonsByOptimizer(pattern0.polygons, config); + gcode_layer.addLinesByOptimizer(pattern0.lines, config, SpaceFillType::Lines); + } + } + + /* + if (gcode_layer.getLayerNr() > -static_cast(Raft::getTotalExtraLayers())) + { + const GCodePathConfig& config = gcode_layer.configs_storage.prime_tower_config_per_extruder[extruder_nr]; + + // Actual prime pattern const ExtrusionMoves& pattern = pattern_per_extruder[extruder_nr]; gcode_layer.addPolygonsByOptimizer(pattern.polygons, config); gcode_layer.addLinesByOptimizer(pattern.lines, config, SpaceFillType::Lines); + + if (gcode_layer.getLayerNr() < 0 && extruder_nr == 0) + { + const ExtrusionMoves& pattern0 = pattern_per_extruder_layer0[extruder_nr]; + gcode_layer.addPolygonsByOptimizer(pattern0.polygons, config); + gcode_layer.addLinesByOptimizer(pattern0.lines, config, SpaceFillType::Lines); + } } +*/ + + // if (gcode_layer.getLayerNr() == -static_cast(Raft::getTotalExtraLayers())) + /*if (gcode_layer.getLayerNr() < 0 && extruder_nr == 0) + { + if (gcode_layer.getLayerNr() == -Raft::getTotalExtraLayers()) + { + const GCodePathConfig& config = gcode_layer.configs_storage.raft_base_config; + + const ExtrusionMoves& pattern0 = pattern_per_extruder_layer0[extruder_nr]; + gcode_layer.addPolygonsByOptimizer(pattern0.polygons, config); + gcode_layer.addLinesByOptimizer(pattern0.lines, config, SpaceFillType::Lines); + } + else + { + const GCodePathConfig& config = gcode_layer.configs_storage.prime_tower_config_per_extruder[extruder_nr]; + + const ExtrusionMoves& pattern_raft = pattern_per_extruder_layer_raft[extruder_nr]; + gcode_layer.addPolygonsByOptimizer(pattern_raft.polygons, config); + gcode_layer.addLinesByOptimizer(pattern_raft.lines, config, SpaceFillType::Lines); + } + }*/ } void PrimeTower::subtractFromSupport(SliceDataStorage& storage) diff --git a/src/gcodeExport.cpp b/src/gcodeExport.cpp index 799ac84e0c..caff200811 100644 --- a/src/gcodeExport.cpp +++ b/src/gcodeExport.cpp @@ -1498,7 +1498,7 @@ void GCodeExport::writeTemperatureCommand(const size_t extruder, const Temperatu *output_stream << " T" << extruder; } #ifdef ASSERT_INSANE_OUTPUT - // assert(temperature >= 0); + assert(temperature >= 0); #endif // ASSERT_INSANE_OUTPUT *output_stream << " S" << PrecisionedDouble{ 1, temperature } << new_line; if (extruder != current_extruder && always_write_active_tool)