Skip to content

Commit 2b58c00

Browse files
committed
Properly generate mesh insets
CURA-12250
1 parent d5b56d5 commit 2b58c00

28 files changed

+219
-228
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ set(engine_SRCS # Except main.cpp.
130130
include/print_operation/ContinuousExtruderMoveSequencePtr.h
131131
include/print_operation/ExtruderPlanPtr.h
132132
include/print_operation/FeatureExtrusionPtr.h
133+
include/print_operation/LayerPlanPtr.h
133134
include/print_operation/PrintOperationPtr.h
134135
src/print_operation/ContinuousExtruderMoveSequence.cpp include/print_operation/ContinuousExtruderMoveSequence.h
135136
src/print_operation/ExtruderMove.cpp include/print_operation/ExtruderMove.h

include/feature_generation/FeatureGenerator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <vector>
77

88
#include "print_operation/ExtruderPlanPtr.h"
9+
#include "print_operation/LayerPlanPtr.h"
910

1011
namespace cura
1112
{
@@ -20,7 +21,7 @@ class FeatureGenerator
2021

2122
virtual bool isActive() const = 0;
2223

23-
virtual void generateFeatures(const SliceDataStorage& storage, const LayerIndex& layer_index, const std::vector<ExtruderPlanPtr>& extruder_plans) const = 0;
24+
virtual void generateFeatures(const SliceDataStorage& storage, const LayerPlanPtr& layer_plan, const std::vector<ExtruderPlanPtr>& extruder_plans) const = 0;
2425
};
2526

2627
} // namespace cura

include/feature_generation/MeshFeatureGenerator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class MeshFeatureGenerator : public FeatureGenerator
1818

1919
bool isActive() const override;
2020

21-
void generateFeatures(const SliceDataStorage& storage, const LayerIndex& layer_index, const std::vector<ExtruderPlanPtr>& extruder_plans) const final;
21+
void generateFeatures(const SliceDataStorage& storage, const LayerPlanPtr& layer_plan, const std::vector<ExtruderPlanPtr>& extruder_plans) const final;
2222

2323
protected:
2424
std::shared_ptr<SliceMeshStorage> getMesh() const;
2525

2626
virtual void
27-
generateFeatures(const SliceDataStorage& storage, const LayerIndex& layer_index, const std::vector<ExtruderPlanPtr>& extruder_plans, const SliceLayerPart& part) const
27+
generateFeatures(const SliceDataStorage& storage, const LayerPlanPtr& layer_plan, const std::vector<ExtruderPlanPtr>& extruder_plans, const SliceLayerPart& part) const
2828
= 0;
2929

3030
private:

include/feature_generation/MeshInsetsGenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MeshInsetsGenerator : public MeshFeatureGenerator
1818
bool isActive() const override;
1919

2020
protected:
21-
void generateFeatures(const SliceDataStorage& storage, const LayerIndex& layer_index, const std::vector<ExtruderPlanPtr>& extruder_plans, const SliceLayerPart& part)
21+
void generateFeatures(const SliceDataStorage& storage, const LayerPlanPtr& layer_plan, const std::vector<ExtruderPlanPtr>& extruder_plans, const SliceLayerPart& part)
2222
const override;
2323
};
2424

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Copyright (c) 2024 UltiMaker
22
// CuraEngine is released under the terms of the AGPLv3 or higher
33

4-
#ifndef PATHPLANNING_CONTINUOUSEXTRUDERMOVESEQUENCE_H
5-
#define PATHPLANNING_CONTINUOUSEXTRUDERMOVESEQUENCE_H
4+
#pragma once
65

76
#include "GCodePathConfig.h"
87
#include "SpaceFillType.h"
@@ -25,16 +24,10 @@ class ContinuousExtruderMoveSequence : public PrintOperationSequence
2524
public:
2625
explicit ContinuousExtruderMoveSequence(bool closed, const Point3LL& start_position = Point3LL());
2726

28-
void appendExtruderMove(const Point3LL& position, const Ratio& line_width_ratio = 1.0_r);
27+
void appendExtruderMove(const std::shared_ptr<ExtruderMove>& extruder_move);
2928

3029
std::optional<Point3LL> findStartPosition() const override;
3130

32-
coord_t getZOffset() const;
33-
34-
const Ratio& getSpeedFactor() const;
35-
36-
const Ratio& getSpeedBackPressureFactor() const;
37-
3831
bool isClosed() const;
3932

4033
void reorderToEndWith(const std::shared_ptr<ExtruderMove>& extruder_move);
@@ -43,15 +36,7 @@ class ContinuousExtruderMoveSequence : public PrintOperationSequence
4336

4437
private:
4538
Point3LL start_position_;
46-
bool closed_;
47-
coord_t z_offset_{ 0 }; //<! Vertical offset from 'full' layer height, applied to the whole path (can be different from the one in the config)
48-
std::shared_ptr<const SliceMeshStorage> mesh_; //!< Which mesh this path belongs to, if any. If it's not part of any mesh, the mesh should be nullptr;
49-
SpaceFillType space_fill_type_{ SpaceFillType::None }; //!< The type of space filling of which this path is a part
50-
Ratio speed_factor_{ 1.0 }; //!< A speed factor that is multiplied with the travel speed. This factor can be used to change the travel speed.
51-
Ratio speed_back_pressure_factor_{ 1.0 }; // <! The factor the (non-travel) speed should be multiplied with as a consequence of back pressure compensation.
52-
double fan_speed_{ GCodePathConfig::FAN_SPEED_DEFAULT }; //!< fan speed override for this path, value should be within range 0-100 (inclusive) and ignored otherwise
39+
const bool closed_;
5340
};
5441

5542
} // namespace cura
56-
57-
#endif // PATHPLANNING_CONTINUOUSEXTRUDERMOVESEQUENCE_H

include/print_operation/ExtrusionMove.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
// Copyright (c) 2024 UltiMaker
22
// CuraEngine is released under the terms of the AGPLv3 or higher
33

4-
#ifndef PATHPLANNING_EXTRUSIONMOVE_H
5-
#define PATHPLANNING_EXTRUSIONMOVE_H
4+
#pragma once
5+
6+
#include <settings/types/Ratio.h>
7+
#include <settings/types/Velocity.h>
68

79
#include "print_operation/ExtruderMove.h"
8-
#include "settings/types/Ratio.h"
910

1011
namespace cura
1112
{
1213

1314
class ExtrusionMove : public ExtruderMove
1415
{
1516
public:
16-
explicit ExtrusionMove(const Point3LL& position, const coord_t line_width_start, const std::optional<coord_t>& line_width_end = std::nullopt);
17+
explicit ExtrusionMove(const Point3LL& position, const coord_t line_width_start, const Velocity& speed, const std::optional<coord_t>& line_width_end = std::nullopt);
1718

1819
void write(PlanExporter& exporter) const override;
1920

2021
private:
2122
coord_t line_width_start_{ 0 };
2223
coord_t line_width_end_{ 0 };
24+
Velocity speed_;
25+
Ratio flow_ratio_{ 1.0_r };
2326
};
2427

2528
} // namespace cura
26-
27-
#endif // PATHPLANNING_EXTRUSIONMOVE_H

include/print_operation/FeatureExtrusion.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#define PATHPLANNING_FEATUREEXTRUSION_H
66

77
#include "GCodePathConfig.h"
8-
#include "geometry/Point3LL.h"
98
#include "print_operation/ContinuousExtruderMoveSequencePtr.h"
109
#include "print_operation/PrintOperationSequence.h"
1110

@@ -15,27 +14,17 @@ namespace cura
1514
class FeatureExtrusion : public PrintOperationSequence
1615
{
1716
public:
18-
explicit FeatureExtrusion(const GCodePathConfig& config);
17+
explicit FeatureExtrusion(const PrintFeatureType type, const coord_t nominal_line_width);
1918

2019
void appendExtruderMoveSequence(const ContinuousExtruderMoveSequencePtr& extruder_move_sequence, bool check_non_empty = true);
2120

22-
const Velocity& getSpeed() const;
21+
PrintFeatureType getType() const;
2322

24-
double getExtrusionMM3perMM() const;
25-
26-
PrintFeatureType getPrintFeatureType() const;
27-
28-
coord_t getLineWidth() const;
29-
30-
private:
31-
const Ratio& getFlow() const;
32-
33-
const Ratio& getWidthFactor() const;
23+
coord_t getNominalLineWidth() const;
3424

3525
private:
36-
GCodePathConfig config_; //!< The configuration settings of the path.
37-
Ratio flow_{ 1.0 }; //!< A type-independent flow configuration
38-
Ratio width_factor_{ 1.0 }; //!< Adjustment to the line width. Similar to flow, but causes the speed_back_pressure_factor to be adjusted.
26+
const PrintFeatureType type_;
27+
const coord_t nominal_line_width_;
3928
};
4029

4130
} // namespace cura

include/print_operation/LayerPlan.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class LayerPlan : public PrintOperationSequence
2727

2828
coord_t getThickness() const;
2929

30-
void write(PlanExporter& exporter) const override;
30+
const std::shared_ptr<PathConfigStorage>& getConfigsStorage() const;
3131

32-
std::optional<Point3LL> findExtruderStartPosition() const;
32+
void write(PlanExporter& exporter) const override;
3333

34-
Point3LL getAbsolutePosition(const ContinuousExtruderMoveSequence& move_sequence, const Point3LL& relative_position) const;
34+
Point3LL getAbsolutePosition(const Point3LL& relative_position) const;
3535

3636
private:
3737
const LayerIndex layer_index_;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2024 UltiMaker
2+
// CuraEngine is released under the terms of the AGPLv3 or higher
3+
4+
#pragma once
5+
6+
#include <memory>
7+
8+
namespace cura
9+
{
10+
11+
class LayerPlan;
12+
13+
using LayerPlanPtr = std::shared_ptr<LayerPlan>;
14+
using ConstLayerPlanPtr = std::shared_ptr<const LayerPlan>;
15+
16+
} // namespace cura

include/print_operation/MeshFeatureExtrusion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace cura
1212
class MeshFeatureExtrusion : public FeatureExtrusion
1313
{
1414
public:
15-
explicit MeshFeatureExtrusion(const GCodePathConfig& config, const std::shared_ptr<const SliceMeshStorage>& mesh);
15+
explicit MeshFeatureExtrusion(const PrintFeatureType type, const coord_t nominal_line_width, const std::shared_ptr<const SliceMeshStorage>& mesh);
1616

1717
const std::shared_ptr<const SliceMeshStorage>& getMesh() const;
1818

0 commit comments

Comments
 (0)