Skip to content

Commit

Permalink
Merge branch 'main' into optimized-prime-tower
Browse files Browse the repository at this point in the history
  • Loading branch information
jellespijker authored Feb 16, 2024
2 parents 8907c38 + db1231e commit 7653914
Show file tree
Hide file tree
Showing 19 changed files with 419 additions and 183 deletions.
14 changes: 9 additions & 5 deletions include/InsetOrderOptimizer.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Ultimaker B.V.
// Copyright (c) 2024 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef INSET_ORDER_OPTIMIZER_H
Expand Down Expand Up @@ -43,8 +43,10 @@ class InsetOrderOptimizer
LayerPlan& gcode_layer,
const Settings& settings,
const int extruder_nr,
const GCodePathConfig& inset_0_non_bridge_config,
const GCodePathConfig& inset_X_non_bridge_config,
const GCodePathConfig& inset_0_default_config,
const GCodePathConfig& inset_X_default_config,
const GCodePathConfig& inset_0_roofing_config,
const GCodePathConfig& inset_X_roofing_config,
const GCodePathConfig& inset_0_bridge_config,
const GCodePathConfig& inset_X_bridge_config,
const bool retract_before_outer_wall,
Expand Down Expand Up @@ -90,8 +92,10 @@ class InsetOrderOptimizer
LayerPlan& gcode_layer_;
const Settings& settings_;
const size_t extruder_nr_;
const GCodePathConfig& inset_0_non_bridge_config_;
const GCodePathConfig& inset_X_non_bridge_config_;
const GCodePathConfig& inset_0_default_config_;
const GCodePathConfig& inset_X_default_config_;
const GCodePathConfig& inset_0_roofing_config_;
const GCodePathConfig& inset_X_roofing_config_;
const GCodePathConfig& inset_0_bridge_config_;
const GCodePathConfig& inset_X_bridge_config_;
const bool retract_before_outer_wall_;
Expand Down
49 changes: 34 additions & 15 deletions include/LayerPlan.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 UltiMaker
// Copyright (c) 2024 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef LAYER_PLAN_H
Expand Down Expand Up @@ -98,6 +98,7 @@ class LayerPlan : public NoCopy
coord_t comb_move_inside_distance_; //!< Whenever using the minimum boundary for combing it tries to move the coordinates inside by this distance after calculating the combing.
Polygons bridge_wall_mask_; //!< The regions of a layer part that are not supported, used for bridging
Polygons overhang_mask_; //!< The regions of a layer part where the walls overhang
Polygons roofing_mask_; //!< The regions of a layer part where the walls are exposed to the air

const std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder_;

Expand Down Expand Up @@ -279,6 +280,13 @@ class LayerPlan : public NoCopy
*/
void setOverhangMask(const Polygons& polys);

/*!
* Set roofing_mask.
*
* \param polys The areas of the part currently being processed that will require roofing.
*/
void setRoofingMask(const Polygons& polys);

/*!
* Travel to a certain point, with all of the procedures necessary to do so.
*
Expand Down Expand Up @@ -417,8 +425,10 @@ class LayerPlan : public NoCopy
* \param p1 The end vertex of the line.
* \param settings The settings which should apply to this line added to the
* layer plan.
* \param non_bridge_config The config with which to print the wall lines
* that are not spanning a bridge.
* \param default_config The config with which to print the wall lines
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param bridge_config The config with which to print the wall lines that
* are spanning a bridge.
* \param flow The ratio with which to multiply the extrusion amount.
Expand All @@ -435,7 +445,8 @@ class LayerPlan : public NoCopy
const Point2LL& p0,
const Point2LL& p1,
const Settings& settings,
const GCodePathConfig& non_bridge_config,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& bridge_config,
double flow,
const Ratio width_factor,
Expand All @@ -448,10 +459,10 @@ class LayerPlan : public NoCopy
* \param wall The vertices of the wall to add.
* \param start_idx The index of the starting vertex to start at.
* \param settings The settings which should apply to this wall added to the layer plan.
* \param non_bridge_config The config with which to print the wall lines
* that are not spanning a bridge.
* \param bridge_config The config with which to print the wall lines that
* are spanning a bridge.
* \param default_config The config with which to print the wall lines
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param wall_0_wipe_dist The distance to travel along the wall after it
* has been laid down, in order to wipe the start and end of the wall
* \param flow_ratio The ratio with which to multiply the extrusion amount.
Expand All @@ -462,7 +473,8 @@ class LayerPlan : public NoCopy
ConstPolygonRef wall,
int start_idx,
const Settings& settings,
const GCodePathConfig& non_bridge_config,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& bridge_config,
coord_t wall_0_wipe_dist,
double flow_ratio,
Expand All @@ -473,8 +485,10 @@ class LayerPlan : public NoCopy
* \param wall The wall of type ExtrusionJunctions
* \param start_idx The index of the starting vertex to start at.
* \param mesh The current mesh being added to the layer plan.
* \param non_bridge_config The config with which to print the wall lines
* that are not spanning a bridge.
* \param default_config The config with which to print the wall lines
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param bridge_config The config with which to print the wall lines that
* are spanning a bridge
* \param wall_0_wipe_dist The distance to travel along the wall after it
Expand All @@ -491,7 +505,8 @@ class LayerPlan : public NoCopy
const ExtrusionLine& wall,
int start_idx,
const Settings& settings,
const GCodePathConfig& non_bridge_config,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& bridge_config,
coord_t wall_0_wipe_dist,
double flow_ratio,
Expand All @@ -512,7 +527,10 @@ class LayerPlan : public NoCopy
* Add walls (polygons) to the gcode with optimized order.
* \param walls The walls
* \param settings The settings which should apply to these walls added to the layer plan.
* \param non_bridge_config The config with which to print the wall lines that are not spanning a bridge
* \param default_config The config with which to print the wall lines
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param bridge_config The config with which to print the wall lines that are spanning a bridge
* \param z_seam_config Optional configuration for z-seam
* \param wall_0_wipe_dist The distance to travel along each wall after it has been laid down, in order to wipe the start and end of the wall together
Expand All @@ -523,7 +541,8 @@ class LayerPlan : public NoCopy
void addWalls(
const Polygons& walls,
const Settings& settings,
const GCodePathConfig& non_bridge_config,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& bridge_config,
const ZSeamConfig& z_seam_config = ZSeamConfig(),
coord_t wall_0_wipe_dist = 0,
Expand Down Expand Up @@ -647,7 +666,7 @@ class LayerPlan : public NoCopy
return start_idx;
}

Polygons air_below(bridge_wall_mask_.unionPolygons(overhang_mask_));
const auto air_below = bridge_wall_mask_.unionPolygons(overhang_mask_);

unsigned curr_idx = start_idx;

Expand Down
11 changes: 10 additions & 1 deletion include/PathOrder.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PathOrder
* The location where the nozzle is assumed to start from before printing
* these parts.
*/
Point2LL start_point_;
const Point2LL start_point_;

/*!
* Seam settings.
Expand Down Expand Up @@ -97,6 +97,15 @@ class PathOrder
*/
constexpr static coord_t coincident_point_distance_ = 10;

/*!
* \brief Basic constructor with a given start point
* \param start_point The location where the nozzle is assumed to start
* from before printing these parts.
*/
PathOrder(const Point2LL& start_point)
: start_point_(start_point)
{
}

/*!
* In the current set of paths, detect all loops and mark them as such.
Expand Down
4 changes: 2 additions & 2 deletions include/PathOrderMonotonic.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class PathOrderMonotonic : public PathOrder<PathType>
using PathOrder<PathType>::coincident_point_distance_;

PathOrderMonotonic(const AngleRadians monotonic_direction, const coord_t max_adjacent_distance, const Point2LL start_point)
: PathOrder<PathType>(start_point)
// The monotonic vector needs to rotate clockwise instead of counter-clockwise, the same as how the infill patterns are generated.
: monotonic_vector_(-std::cos(monotonic_direction) * monotonic_vector_resolution_, std::sin(monotonic_direction) * monotonic_vector_resolution_)
, monotonic_vector_(-std::cos(monotonic_direction) * monotonic_vector_resolution_, std::sin(monotonic_direction) * monotonic_vector_resolution_)
, max_adjacent_distance_(max_adjacent_distance)
{
this->start_point_ = start_point;
}

void optimize()
Expand Down
3 changes: 2 additions & 1 deletion include/TreeSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ class TreeSupport
*
* \param storage[in] Background storage to access meshes.
* \param currently_processing_meshes[in] Indexes of all meshes that are processed in this iteration
* \return Uppermost layer precalculated. -1 if no layer were precalculated as no overhang is present.
*/
void precalculate(const SliceDataStorage& storage, std::vector<size_t> currently_processing_meshes);
LayerIndex precalculate(const SliceDataStorage& storage, std::vector<size_t> currently_processing_meshes);


/*!
Expand Down
Loading

0 comments on commit 7653914

Please sign in to comment.