Skip to content

Commit 4177843

Browse files
committed
Merge remote-tracking branch 'origin/main' into CURA-12580_paint-on-support
2 parents 945b11b + 4dafaef commit 4177843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2332
-1134
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ set(engine_SRCS # Except main.cpp.
6565
src/multiVolumes.cpp
6666
src/path_ordering.cpp
6767
src/PathAdapter.cpp
68+
src/PathOrderMonotonic.cpp
6869
src/Preheat.cpp
6970
src/PrimeTower/PrimeTower.cpp
7071
src/PrimeTower/PrimeTowerNormal.cpp
@@ -177,13 +178,16 @@ set(engine_SRCS # Except main.cpp.
177178
src/geometry/Point3LL.cpp
178179
src/geometry/Polygon.cpp
179180
src/geometry/Shape.cpp
181+
src/geometry/PointMatrix.cpp
180182
src/geometry/PointsSet.cpp
181183
src/geometry/SingleShape.cpp
182184
src/geometry/PartsView.cpp
183185
src/geometry/LinesSet.cpp
184186
src/geometry/Polyline.cpp
185187
src/geometry/ClosedPolyline.cpp
186188
src/geometry/MixedLinesSet.cpp
189+
190+
src/geometry/conversions/Point2D_Point2LL.cpp
187191
)
188192

189193
add_library(_CuraEngine STATIC ${engine_SRCS} ${engine_PB_SRCS})
@@ -235,9 +239,9 @@ find_package(fmt REQUIRED)
235239
find_package(range-v3 REQUIRED)
236240
find_package(scripta REQUIRED)
237241
find_package(PNG REQUIRED)
238-
if(NOT EMSCRIPTEN)
242+
if (NOT EMSCRIPTEN)
239243
find_package(TBB REQUIRED)
240-
endif()
244+
endif ()
241245

242246
if (ENABLE_SENTRY)
243247
find_package(sentry REQUIRED)

conandata.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "5.11.0"
1+
version: "5.12.0-alpha.0"
22
commit: "unknown"
33
requirements:
44
- "scripta/[>=1.1.0]@ultimaker/testing"
@@ -9,4 +9,4 @@ requirements_arcus:
99
requirements_plugins:
1010
- "curaengine_grpc_definitions/0.3.2"
1111
requirements_cura_resources:
12-
- "cura_resources/5.11.0"
12+
- "cura_resources/5.12.0-alpha.0"

include/FffGcodeWriter.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "FanSpeedLayerTime.h"
1212
#include "GCodePathConfig.h"
1313
#include "LayerPlanBuffer.h"
14+
#include "LinesOrderingMethod.h"
1415
#include "gcodeExport.h"
1516
#include "utils/LayerVector.h"
1617
#include "utils/NoCopy.h"
@@ -417,10 +418,18 @@ class FffGcodeWriter : public NoCopy
417418
* mesh which should be printed with this extruder.
418419
* \param mesh_config The line config with which to print a print feature.
419420
* \param part The part for which to create gcode.
421+
* \param start_move_inwards_length The length of the extra inwards moves to be added at the start of each infill line
422+
* \param end_move_inwards_length The length of the extra inwards moves to be added at the end of each infill line
420423
* \return Whether this function added anything to the layer plan.
421424
*/
422-
bool processMultiLayerInfill(LayerPlan& gcodeLayer, const SliceMeshStorage& mesh, const size_t extruder_nr, const MeshPathConfigs& mesh_config, const SliceLayerPart& part)
423-
const;
425+
bool processMultiLayerInfill(
426+
LayerPlan& gcodeLayer,
427+
const SliceMeshStorage& mesh,
428+
const size_t extruder_nr,
429+
const MeshPathConfigs& mesh_config,
430+
const SliceLayerPart& part,
431+
const coord_t start_move_inwards_length = 0,
432+
const coord_t end_move_inwards_length = 0) const;
424433

425434
/*!
426435
* \brief Add normal sparse infill for a given part in a layer.
@@ -430,6 +439,8 @@ class FffGcodeWriter : public NoCopy
430439
* mesh which should be printed with this extruder
431440
* \param mesh_config The line config with which to print a print feature.
432441
* \param part The part for which to create gcode.
442+
* \param start_move_inwards_length The length of the extra inwards moves to be added at the start of each infill line
443+
* \param end_move_inwards_length The length of the extra inwards moves to be added at the end of each infill line
433444
* \return Whether this function added anything to the layer plan.
434445
*/
435446
bool processSingleLayerInfill(
@@ -438,7 +449,9 @@ class FffGcodeWriter : public NoCopy
438449
const SliceMeshStorage& mesh,
439450
const size_t extruder_nr,
440451
const MeshPathConfigs& mesh_config,
441-
const SliceLayerPart& part) const;
452+
const SliceLayerPart& part,
453+
const coord_t start_move_inwards_length = 0,
454+
const coord_t end_move_inwards_length = 0) const;
442455

443456
/*!
444457
* Generate the insets for the walls of a given layer part.
@@ -579,6 +592,7 @@ class FffGcodeWriter : public NoCopy
579592
* minimise travel moves (``false``).
580593
* \param[out] added_something Whether this function added anything to the layer plan
581594
* \param fan_speed fan speed override for this skin area
595+
* \param forced_small_area_width A specific value to be used for small_area_width when generating the infill, or nullopt to use the normal value
582596
*/
583597
void processSkinPrintFeature(
584598
const SliceDataStorage& storage,
@@ -591,10 +605,11 @@ class FffGcodeWriter : public NoCopy
591605
const AngleDegrees skin_angle,
592606
const coord_t skin_overlap,
593607
const Ratio skin_density,
594-
const bool monotonic,
608+
const LinesOrderingMethod ordering,
595609
const bool is_roofing_flooring,
596610
bool& added_something,
597-
double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT) const;
611+
double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
612+
std::optional<coord_t> forced_small_area_width = std::nullopt) const;
598613

599614
/*!
600615
* see if we can avoid printing a lines or zig zag style skin part in multiple segments by moving to

include/LayerPlan.h

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace cura
3737
class Comb;
3838
class SliceDataStorage;
3939
class LayerPlanBuffer;
40+
class STHalfEdge;
4041

4142
template<typename PathType>
4243
class PathAdapter;
@@ -511,6 +512,7 @@ class LayerPlan : public NoCopy
511512
* If unset, this causes it to start near the last planned location.
512513
* \param scarf_seam Indicates whether we may use a scarf seam for the path
513514
* \param smooth_speed Indicates whether we may use a speed gradient for the path
515+
* \param texture_data_provider The texture provider to be used to place the seam
514516
*/
515517
void addPolygonsByOptimizer(
516518
const Shape& polygons,
@@ -524,7 +526,29 @@ class LayerPlan : public NoCopy
524526
bool reverse_order = false,
525527
const std::optional<Point2LL> start_near_location = std::optional<Point2LL>(),
526528
bool scarf_seam = false,
527-
bool smooth_acceleration = false);
529+
bool smooth_speed = false,
530+
const std::shared_ptr<TextureDataProvider>& texture_data_provider = nullptr);
531+
532+
/*!
533+
* Adds infill polygons to the gcode with optimized order.
534+
*
535+
* In case we need to generate extra inwards moves for the infill, we cannot treat them as polygons anymore, since the lines will be un-closed. Thus, the resulting open
536+
* polylines are returned in \p remaining_lines and should be re-added to the gcode, e.g. by using addLinesByOptimizer().
537+
*
538+
* @param polygons The infill polygons to be added
539+
* @param[out] remaining_lines The list to be filled with generates open polylines. The given list may be non-empty, only new lines will be appended. * @param config The
540+
* config with which to print the polygon lines
541+
* @param settings The current settings to retrieve values from
542+
* @param add_extra_inwards_move Indicates whether extra start/end inwards extrusion moves will be generated
543+
* @param near_start_location Optional: Location near where to add the first line. If not provided the last position is used.
544+
*/
545+
void addInfillPolygonsByOptimizer(
546+
const Shape& polygons,
547+
OpenLinesSet& remaining_lines,
548+
const GCodePathConfig& config,
549+
const Settings& settings,
550+
const bool add_extra_inwards_move = false,
551+
const std::optional<Point2LL>& near_start_location = std::optional<Point2LL>());
528552

529553
/*!
530554
* Add a single line that is part of a wall to the gcode.
@@ -685,6 +709,9 @@ class LayerPlan : public NoCopy
685709
* \param fan_speed optional fan speed override for this path
686710
* \param reverse_print_direction Whether to reverse the optimized order and their printing direction.
687711
* \param order_requirements Pairs where first needs to be printed before second. Pointers are pointing to elements of \p lines
712+
* \param extra_inwards_start_move_length The length of the extra inwards moves to be added at the start of each infill line
713+
* \param extra_inwards_end_move_length The length of the extra inwards moves to be added at the end of each infill line
714+
* \param extra_inwards_move_contour The contour to be considered in order to add the inwards moves
688715
*/
689716
template<class LineType>
690717
void addLinesByOptimizer(
@@ -697,7 +724,10 @@ class LayerPlan : public NoCopy
697724
const std::optional<Point2LL> near_start_location = std::optional<Point2LL>(),
698725
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
699726
const bool reverse_print_direction = false,
700-
const std::unordered_multimap<const Polyline*, const Polyline*>& order_requirements = PathOrderOptimizer<const Polyline*>::no_order_requirements_);
727+
const std::unordered_multimap<const Polyline*, const Polyline*>& order_requirements = PathOrderOptimizer<const Polyline*>::no_order_requirements_,
728+
const coord_t extra_inwards_start_move_length = 0,
729+
const coord_t extra_inwards_end_move_length = 0,
730+
const Shape& extra_inwards_move_contour = Shape());
701731

702732
/*!
703733
* Add lines to the gcode with optimized order.
@@ -755,7 +785,8 @@ class LayerPlan : public NoCopy
755785
const coord_t exclude_distance = 0,
756786
const coord_t wipe_dist = 0,
757787
const Ratio flow_ratio = 1.0_r,
758-
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT);
788+
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
789+
const bool interlaced = false);
759790

760791
/*!
761792
* Add a spiralized slice of wall that is interpolated in X/Y between \p last_wall and \p wall.
@@ -868,14 +899,55 @@ class LayerPlan : public NoCopy
868899
* \param wipe_dist (optional) the distance wiped without extruding after laying down a line.
869900
* \param flow_ratio The ratio with which to multiply the extrusion amount
870901
* \param fan_speed optional fan speed override for this path
902+
* \param extra_inwards_start_move_length The length of the extra inwards moves to be added at the start of each infill line
903+
* \param extra_inwards_end_move_length The length of the extra inwards moves to be added at the end of each infill line
904+
* \param extra_inwards_move_contour The contour to be considered in order to add the inwards moves
871905
*/
872906
void addLinesInGivenOrder(
873907
const std::vector<PathOrdering<const Polyline*>>& lines,
874908
const GCodePathConfig& config,
875909
const SpaceFillType space_fill_type,
876910
const coord_t wipe_dist,
877911
const Ratio flow_ratio,
878-
const double fan_speed);
912+
const double fan_speed,
913+
const coord_t extra_inwards_start_move_length = 0,
914+
const coord_t extra_inwards_end_move_length = 0,
915+
const Shape& extra_inwards_move_contour = Shape());
916+
917+
/*!
918+
* Add order optimized polygons to the gcode.
919+
* Add polygons to the gcode with optimized order.
920+
*
921+
* \param polygons The polygons.
922+
* \param config The config with which to print the polygon lines.
923+
* for each given segment (optionally nullptr).
924+
* \param settings The settings which should apply to these polygons added to the layer plan
925+
* \param z_seam_config Optional configuration for z-seam.
926+
* \param wall_0_wipe_dist The distance to travel along each polygon after
927+
* it has been laid down, in order to wipe the start and end of the wall
928+
* together.
929+
* \param spiralize Whether to gradually increase the z height from the
930+
* normal layer height to the height of the next layer over each polygon
931+
* printed.
932+
* \param flow_ratio The ratio with which to multiply the extrusion amount.
933+
* \param always_retract Whether to force a retraction when moving to the
934+
* start of the polygon (used for outer walls).
935+
* \param reverse_order Adds polygons in reverse order.
936+
* \param scarf_seam Indicates whether we may use a scarf seam for the path
937+
* \param smooth_speed Indicates whether we may use a speed gradient for the path
938+
*/
939+
void addPolygonsInGivenOrder(
940+
const std::vector<PathOrdering<const Polygon*>>& polygons,
941+
const GCodePathConfig& config,
942+
const Settings& settings,
943+
const ZSeamConfig& z_seam_config = ZSeamConfig(),
944+
coord_t wall_0_wipe_dist = 0,
945+
bool spiralize = false,
946+
const Ratio flow_ratio = 1.0_r,
947+
bool always_retract = false,
948+
bool reverse_order = false,
949+
bool scarf_seam = false,
950+
bool smooth_speed = false);
879951

880952
/*!
881953
* @brief Send a GCodePath line to the communication object, applying proper Z offsets
@@ -1148,6 +1220,16 @@ class LayerPlan : public NoCopy
11481220
const std::optional<TravelAntiOozing>& priming_amounts,
11491221
const Velocity& speed,
11501222
const size_t point_index);
1223+
1224+
/*!
1225+
* Generates an extrusion move that goes as inwards as possible given a skeletized contour, starting from the given point
1226+
* @param trapezoidal_edges The edges of the skeletal trapezoidation for the contour
1227+
* @param start_point The point to start generating the move from
1228+
* @param move_inwards_length The length of the move to be generated
1229+
* @return Extrusion path to be started from the given start point, going further inwards. It may be empty if not possible or if the start point is
1230+
* already inwards the contour enough.
1231+
*/
1232+
static OpenPolyline makeInwardsMove(const std::list<STHalfEdge>& trapezoidal_edges, const Point2LL& start_point, const coord_t move_inwards_length);
11511233
};
11521234

11531235
} // namespace cura

include/LinesOrderingMethod.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2025 UltiMaker
2+
// CuraEngine is released under the terms of the AGPLv3 or higher
3+
4+
#ifndef LINES_ORDERING_METHOD_H
5+
#define LINES_ORDERING_METHOD_H
6+
7+
8+
namespace cura
9+
{
10+
11+
enum class LinesOrderingMethod
12+
{
13+
Basic, // Lines are ordered by shortest distance
14+
Monotonic, // Lines are ordered so that they will always form a continuous print along a direction
15+
Interlaced, // Similar to monotonic, but with 2 passes so that adjacent lines will not be printed just after each other
16+
};
17+
18+
} // namespace cura
19+
20+
#endif

include/MeshMaterialSplitter.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ namespace MeshMaterialSplitter
1515

1616
/*!
1717
* Generate a modifier mesh for every extruder other than 0, that has some user-painted texture data
18-
* @param mesh The mesh being sliced
19-
* @param meshgroup The group to add the modifier meshes to
18+
* @param meshgroup The group to take the sliced meshes from and add the modifier meshes to
2019
*/
21-
void makePaintingModifierMeshes(const Mesh& mesh, MeshGroup* meshgroup);
20+
void makePaintingModifierMeshes(MeshGroup* meshgroup);
2221

2322
} // namespace MeshMaterialSplitter
2423

0 commit comments

Comments
 (0)