Skip to content

Commit

Permalink
Merge branch 'main' into CURA-11378_stress_benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
rburema authored Nov 28, 2023
2 parents e1b9641 + 574c4b9 commit 9809416
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 18 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CuraEngineConan(ConanFile):

def set_version(self):
if not self.version:
self.version = "5.6.0-beta.1"
self.version = "5.7.0-alpha"

def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
Expand Down
2 changes: 1 addition & 1 deletion include/SupportInfillPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SupportInfillPart
// for infill_areas[x][n], x means the density level and n means the thickness
std::vector<VariableWidthLines> wall_toolpaths; //!< Any walls go here, not in the areas, where they could be combined vertically (don't combine walls). Binned by inset_idx.

coord_t custom_line_distance;
coord_t custom_line_distance; //!< The distance between support infill lines. 0 means use the default line distance instead.
bool use_fractional_config; //!< Request to use the configuration used to fill a partial layer height here, instead of the normal full layer height configuration.

SupportInfillPart(const PolygonsPart& outline, coord_t support_line_width, bool use_fractional_config, int inset_count_to_generate = 0, coord_t custom_line_distance = 0);
Expand Down
2 changes: 1 addition & 1 deletion include/progress/Progress.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#define PROGRESS_H

#include <array>
#include <optional>
#include <string>
#include <string_view>
#include <optional>

#include "utils/gettime.h"

Expand Down
4 changes: 3 additions & 1 deletion include/sliceDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@ class SupportLayer
* \param wall_line_count Wall-line count around the fill.
* \param grow_layer_above (optional, default to 0) In cases where support shrinks per layer up, an appropriate offset may be nescesary.
* \param unionAll (optional, default to false) Wether to 'union all' for the split into parts bit.
* \param custom_line_distance (optional, default to 0) Distance between lines of the infill pattern. custom_line_distance of 0 means use the default instead.
*/
void fillInfillParts(
const LayerIndex layer_nr,
const std::vector<Polygons>& support_fill_per_layer,
const coord_t support_line_width,
const coord_t wall_line_count,
const coord_t grow_layer_above = 0,
const bool unionAll = false);
const bool unionAll = false,
const coord_t custom_line_distance = 0);
};

class SupportStorage
Expand Down
28 changes: 27 additions & 1 deletion src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,9 +929,35 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
skip_some_zags,
zag_skip_count,
pocket_size);

std::vector<VariableWidthLines> raft_paths; // Should remain empty, since we have no walls.
infill_comp.generate(raft_paths, raft_polygons, raft_lines, surface_settings, layer_nr, SectionType::ADHESION);
gcode_layer.addLinesByOptimizer(raft_lines, gcode_layer.configs_storage.raft_surface_config, SpaceFillType::Lines, false, 0, 1.0, last_planned_position);

const auto wipe_dist = 0;
const auto spiralize = false;
const auto flow_ratio = 1.0_r;
const auto enable_travel_optimization = false;
const auto always_retract = false;
const auto reverse_order = false;

gcode_layer.addLinesByOptimizer(
raft_lines,
gcode_layer.configs_storage.raft_surface_config,
SpaceFillType::Lines,
enable_travel_optimization,
wipe_dist,
flow_ratio,
last_planned_position);
gcode_layer.addPolygonsByOptimizer(
raft_polygons,
gcode_layer.configs_storage.raft_surface_config,
ZSeamConfig(),
wipe_dist,
spiralize,
flow_ratio,
always_retract,
reverse_order,
gcode_layer.getLastPlannedPositionOrStartingPosition());

raft_polygons.clear();
raft_lines.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/TreeSupportTipGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ void TreeSupportTipGenerator::generateTips(
if (use_fake_roof)
{
storage.support.supportLayers[layer_idx]
.fillInfillParts(layer_idx, support_roof_drawn, config.support_line_width, support_roof_line_distance, config.maximum_move_distance);
.fillInfillParts(layer_idx, support_roof_drawn, config.support_line_width, 0, config.maximum_move_distance, false, support_roof_line_distance);
placed_support_lines_support_areas[layer_idx].add(TreeSupportUtils::generateSupportInfillLines(
support_roof_drawn[layer_idx],
config,
Expand Down
26 changes: 16 additions & 10 deletions src/gcodeExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

#include "gcodeExport.h"

#include <assert.h>
#include <cmath>
#include <iomanip>
#include <stdarg.h>

#include <spdlog/spdlog.h>

#include "Application.h" //To send layer view data.
#include "ExtruderTrain.h"
#include "PrintFeature.h"
Expand All @@ -14,13 +21,6 @@
#include "utils/Date.h"
#include "utils/string.h" // MMtoStream, PrecisionedDouble

#include <spdlog/spdlog.h>

#include <assert.h>
#include <cmath>
#include <iomanip>
#include <stdarg.h>

namespace cura
{

Expand Down Expand Up @@ -1254,8 +1254,8 @@ void GCodeExport::startExtruder(const size_t new_extruder)
assert(getCurrentExtrudedVolume() == 0.0 && "Just after an extruder switch we haven't extruded anything yet!");
resetExtrusionValue(); // zero the E value on the new extruder, just to be sure

const std::string start_code = Application::getInstance().current_slice->scene.extruders[new_extruder].settings.get<std::string>("machine_extruder_start_code");

const auto extruder_settings = Application::getInstance().current_slice->scene.extruders[new_extruder].settings;
const auto start_code = extruder_settings.get<std::string>("machine_extruder_start_code");
if (! start_code.empty())
{
if (relative_extrusion)
Expand All @@ -1271,6 +1271,9 @@ void GCodeExport::startExtruder(const size_t new_extruder)
}
}

const auto start_code_duration = extruder_settings.get<Duration>("machine_extruder_start_code_duration");
estimateCalculator.addTime(start_code_duration);

Application::getInstance().communication->setExtruderForSend(Application::getInstance().current_slice->scene.extruders[new_extruder]);
Application::getInstance().communication->sendCurrentPosition(getPositionXY());

Expand Down Expand Up @@ -1302,7 +1305,7 @@ void GCodeExport::switchExtruder(size_t new_extruder, const RetractionConfig& re

resetExtrusionValue(); // zero the E value on the old extruder, so that the current_e_value is registered on the old extruder

const std::string end_code = old_extruder_settings.get<std::string>("machine_extruder_end_code");
const auto end_code = old_extruder_settings.get<std::string>("machine_extruder_end_code");

if (! end_code.empty())
{
Expand All @@ -1319,6 +1322,9 @@ void GCodeExport::switchExtruder(size_t new_extruder, const RetractionConfig& re
}
}

const auto end_code_duration = old_extruder_settings.get<Duration>("machine_extruder_end_code_duration");
estimateCalculator.addTime(end_code_duration);

startExtruder(new_extruder);
}

Expand Down
5 changes: 3 additions & 2 deletions src/sliceDataStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,8 @@ void SupportLayer::fillInfillParts(
const coord_t support_line_width,
const coord_t wall_line_count,
const coord_t grow_layer_above /*has default 0*/,
const bool unionAll /*has default false*/)
const bool unionAll /*has default false*/,
const coord_t custom_line_distance /*has default 0*/)
{
const Polygons& support_this_layer = support_fill_per_layer[layer_nr];
const Polygons& support_layer_above
Expand All @@ -732,7 +733,7 @@ void SupportLayer::fillInfillParts(
{
for (const PolygonsPart& island_outline : support_areas.splitIntoParts(unionAll))
{
support_infill_parts.emplace_back(island_outline, support_line_width, use_fractional_config, wall_line_count);
support_infill_parts.emplace_back(island_outline, support_line_width, use_fractional_config, wall_line_count, custom_line_distance);
}
use_fractional_config = false;
}
Expand Down
7 changes: 7 additions & 0 deletions tests/GCodeExportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,21 @@ TEST_F(GCodeExportTest, SwitchExtruderSimple)

scene.extruders.emplace_back(0, nullptr);
ExtruderTrain& train1 = scene.extruders.back();

train1.settings.add("machine_extruder_start_code", ";FIRST EXTRUDER START G-CODE!");
train1.settings.add("machine_extruder_end_code", ";FIRST EXTRUDER END G-CODE!");
train1.settings.add("machine_extruder_start_code_duration", "0.0");
train1.settings.add("machine_extruder_end_code_duration", "0.0");
train1.settings.add("machine_firmware_retract", "True");
train1.settings.add("retraction_enable", "True");

scene.extruders.emplace_back(1, nullptr);
ExtruderTrain& train2 = scene.extruders.back();

train2.settings.add("machine_extruder_start_code", ";SECOND EXTRUDER START G-CODE!");
train2.settings.add("machine_extruder_end_code", ";SECOND EXTRUDER END G-CODE!");
train2.settings.add("machine_extruder_start_code_duration", "0.0");
train2.settings.add("machine_extruder_end_code_duration", "0.0");
train2.settings.add("machine_firmware_retract", "True");
train2.settings.add("retraction_enable", "True");

Expand Down

0 comments on commit 9809416

Please sign in to comment.