From a3f5fbf5322aba4bee7401a5252d9ae465b16306 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 22 Feb 2024 16:48:03 +0100 Subject: [PATCH 1/9] adding an extra travel move at the beginning to machine_start_pos CURA-11444 --- src/FffGcodeWriter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index d4c64cb685..a21081daec 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -140,6 +140,12 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep mesh_order_per_extruder.push_back(calculateMeshOrder(storage, extruder_nr)); } } + + // Setting first travel move of the first extruder to the machine start position + const auto extruder_settings = Application::getInstance().current_slice_->scene.extruders[start_extruder_nr].settings_; + Point3LL p(extruder_settings.get("machine_extruder_start_pos_x"), extruder_settings.get("machine_extruder_start_pos_y"), gcode.getPositionZ()); + gcode.writeTravel(p, Application::getInstance().current_slice_->scene.extruders[gcode.getExtruderNr()].settings_.get("speed_travel"));; + calculateExtruderOrderPerLayer(storage); calculatePrimeLayerPerExtruder(storage); From 4548f7253d7ee9518748534e1a27d76e913597cc Mon Sep 17 00:00:00 2001 From: saumyaj3 Date: Thu, 22 Feb 2024 15:48:43 +0000 Subject: [PATCH 2/9] Applied clang-format. --- src/FffGcodeWriter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index a21081daec..c014d733f5 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -144,7 +144,8 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep // Setting first travel move of the first extruder to the machine start position const auto extruder_settings = Application::getInstance().current_slice_->scene.extruders[start_extruder_nr].settings_; Point3LL p(extruder_settings.get("machine_extruder_start_pos_x"), extruder_settings.get("machine_extruder_start_pos_y"), gcode.getPositionZ()); - gcode.writeTravel(p, Application::getInstance().current_slice_->scene.extruders[gcode.getExtruderNr()].settings_.get("speed_travel"));; + gcode.writeTravel(p, Application::getInstance().current_slice_->scene.extruders[gcode.getExtruderNr()].settings_.get("speed_travel")); + ; calculateExtruderOrderPerLayer(storage); calculatePrimeLayerPerExtruder(storage); From 8ea17cc29f672979dafce2bbc24f5d9c5dfe4b98 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 22 Feb 2024 16:54:32 +0100 Subject: [PATCH 3/9] removing extra semicolon CURA-11553 --- src/FffGcodeWriter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index c014d733f5..e6d7980f8b 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -145,7 +145,6 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep const auto extruder_settings = Application::getInstance().current_slice_->scene.extruders[start_extruder_nr].settings_; Point3LL p(extruder_settings.get("machine_extruder_start_pos_x"), extruder_settings.get("machine_extruder_start_pos_y"), gcode.getPositionZ()); gcode.writeTravel(p, Application::getInstance().current_slice_->scene.extruders[gcode.getExtruderNr()].settings_.get("speed_travel")); - ; calculateExtruderOrderPerLayer(storage); calculatePrimeLayerPerExtruder(storage); From 404c1c690c82a8863176ab995d3426476a2fb737 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 22 Feb 2024 17:15:03 +0100 Subject: [PATCH 4/9] writeing initial travel move of the extruder to avoid scarring CURA-11553 --- src/FffGcodeWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index e6d7980f8b..dcef0e3eab 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -142,9 +142,9 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep } // Setting first travel move of the first extruder to the machine start position - const auto extruder_settings = Application::getInstance().current_slice_->scene.extruders[start_extruder_nr].settings_; + const auto extruder_settings = Application::getInstance().current_slice_->scene.extruders[gcode.getExtruderNr()].settings_; Point3LL p(extruder_settings.get("machine_extruder_start_pos_x"), extruder_settings.get("machine_extruder_start_pos_y"), gcode.getPositionZ()); - gcode.writeTravel(p, Application::getInstance().current_slice_->scene.extruders[gcode.getExtruderNr()].settings_.get("speed_travel")); + gcode.writeTravel(p, extruder_settings.get("speed_travel")); calculateExtruderOrderPerLayer(storage); calculatePrimeLayerPerExtruder(storage); From e4d47de651763e77567a889a170b68766957ba3a Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 22 Feb 2024 23:03:59 +0100 Subject: [PATCH 5/9] skip first --- .github/workflows/gcodeanalyzer.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index 29c83817de..b42ada8717 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -178,7 +178,7 @@ jobs: - name: Collect STL-files, run CuraEngine, output GCode-files run: | - for file in `ls ../NightlyTestModels/*.stl`; + for file in `ls ../NightlyTestModels/*.stl | tail -n 3`; do ( time ./build/Release/CuraEngine slice --force-read-parent --force-read-nondefault -v -p -j ../Cura/resources/definitions/ultimaker_s3.def.json -l $file -o ../`basename $file .stl`.gcode ) 2> ../`basename $file .stl`.time done @@ -308,15 +308,15 @@ jobs: shell: python working-directory: GCodeAnalyzer - - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1 - with: - name: CGcodeAnalyzer - output-file-path: output.json - gh-repository: github.com/Ultimaker/CuraEngineBenchmarks - gh-pages-branch: main - benchmark-data-dir-path: dev/gcodeanalyzer - tool: customBiggerIsBetter - github-token: ${{ secrets.CURA_BENCHMARK_PAT }} - auto-push: true - max-items-in-chart: 250 +# - name: Store benchmark result +# uses: benchmark-action/github-action-benchmark@v1 +# with: +# name: CGcodeAnalyzer +# output-file-path: output.json +# gh-repository: github.com/Ultimaker/CuraEngineBenchmarks +# gh-pages-branch: main +# benchmark-data-dir-path: dev/gcodeanalyzer +# tool: customBiggerIsBetter +# github-token: ${{ secrets.CURA_BENCHMARK_PAT }} +# auto-push: true +# max-items-in-chart: 250 From 24cfc945977988b410a2818dd863d04da802273b Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 23 Feb 2024 07:46:07 +0100 Subject: [PATCH 6/9] Add fallback on last extruder of previous layer when used extruder list is empty CURA-11649 --- src/FffGcodeWriter.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index d4c64cb685..04aacf5deb 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -1173,13 +1173,29 @@ FffGcodeWriter::ProcessLayerResult FffGcodeWriter::processLayer(const SliceDataS const std::vector& extruder_order = (layer_nr < 0) ? extruder_order_per_layer_negative_layers[extruder_order_per_layer_negative_layers.size() + layer_nr] : extruder_order_per_layer[layer_nr]; - const coord_t first_outer_wall_line_width = scene.extruders[extruder_order.front().extruder_nr].settings_.get("wall_line_width_0"); + size_t first_extruder; + if (extruder_order.size() > 0) + { + first_extruder = extruder_order.front().extruder_nr; + } + else + { + // find the last extruder used in the previous layer + size_t last_extruder_nr_layer = layer_nr - 1; + while (extruder_order_per_layer[last_extruder_nr_layer].size() == 0 && last_extruder_nr_layer >= 0) + { + last_extruder_nr_layer--; + } + first_extruder = extruder_order_per_layer[last_extruder_nr_layer].back().extruder_nr; + } + + const coord_t first_outer_wall_line_width = scene.extruders[first_extruder].settings_.get("wall_line_width_0"); LayerPlan& gcode_layer = *new LayerPlan( storage, layer_nr, z, layer_thickness, - extruder_order.front().extruder_nr, + first_extruder, fan_speed_layer_time_settings_per_extruder, comb_offset_from_outlines, first_outer_wall_line_width, From 2127371789c489da73ecad8a7ce0ed2aadcd9638 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 23 Feb 2024 07:47:25 +0100 Subject: [PATCH 7/9] analyse all models again --- .github/workflows/gcodeanalyzer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index b42ada8717..310469f4a8 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -178,7 +178,7 @@ jobs: - name: Collect STL-files, run CuraEngine, output GCode-files run: | - for file in `ls ../NightlyTestModels/*.stl | tail -n 3`; + for file in `ls ../NightlyTestModels/*.stl`; do ( time ./build/Release/CuraEngine slice --force-read-parent --force-read-nondefault -v -p -j ../Cura/resources/definitions/ultimaker_s3.def.json -l $file -o ../`basename $file .stl`.gcode ) 2> ../`basename $file .stl`.time done From 3543e011515f53c07c6225136fab7537019f5f5a Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 23 Feb 2024 07:59:06 +0100 Subject: [PATCH 8/9] Re enable uploading gcode analyser data --- .github/workflows/gcodeanalyzer.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index 310469f4a8..29c83817de 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -308,15 +308,15 @@ jobs: shell: python working-directory: GCodeAnalyzer -# - name: Store benchmark result -# uses: benchmark-action/github-action-benchmark@v1 -# with: -# name: CGcodeAnalyzer -# output-file-path: output.json -# gh-repository: github.com/Ultimaker/CuraEngineBenchmarks -# gh-pages-branch: main -# benchmark-data-dir-path: dev/gcodeanalyzer -# tool: customBiggerIsBetter -# github-token: ${{ secrets.CURA_BENCHMARK_PAT }} -# auto-push: true -# max-items-in-chart: 250 + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: CGcodeAnalyzer + output-file-path: output.json + gh-repository: github.com/Ultimaker/CuraEngineBenchmarks + gh-pages-branch: main + benchmark-data-dir-path: dev/gcodeanalyzer + tool: customBiggerIsBetter + github-token: ${{ secrets.CURA_BENCHMARK_PAT }} + auto-push: true + max-items-in-chart: 250 From 68cc5c594a988eddcc73a6aeb444f207bac8e9e9 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 26 Feb 2024 12:31:09 +0100 Subject: [PATCH 9/9] Fix travel length regression CURA-11653 --- src/FffGcodeWriter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index d9803c93be..0db1fc54f1 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -1775,12 +1775,15 @@ void FffGcodeWriter::addMeshLayerToGCode( PathOrderOptimizer part_order_optimizer(gcode_layer.getLastPlannedPositionOrStartingPosition(), z_seam_config); for (const SliceLayerPart& part : layer.parts) { + if (part.outline.empty()) + { + continue; + } part_order_optimizer.addPolygon(&part); } - if (part_order_optimizer.vertices_to_paths_.size() > 1) - { - part_order_optimizer.optimize(false); - } + + part_order_optimizer.optimize(false); + for (const PathOrdering& path : part_order_optimizer.paths_) { addMeshPartToGCode(storage, mesh, extruder_nr, mesh_config, *path.vertices_, gcode_layer);