Skip to content

Commit cd01288

Browse files
committed
Merge remote-tracking branch 'origin/5.9'
2 parents 7876d03 + eb25b44 commit cd01288

14 files changed

+221
-137
lines changed

include/ExtruderPlan.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ class ExtruderPlan
124124
*/
125125
void applyBackPressureCompensation(const Ratio back_pressure_compensation);
126126

127+
/*!
128+
* Gets the mesh being printed first on this plan
129+
*/
130+
std::shared_ptr<const SliceMeshStorage> findFirstPrintedMesh() const;
131+
127132
private:
128133
LayerIndex layer_nr_{ 0 }; //!< The layer number at which we are currently printing.
129134
bool is_initial_layer_{ false }; //!< Whether this extruder plan is printed on the very first layer (which might be raft)

include/LayerPlan.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,11 @@ class LayerPlan : public NoCopy
761761
*/
762762
void applyGradualFlow();
763763

764+
/*!
765+
* Gets the mesh being printed first on this layer
766+
*/
767+
std::shared_ptr<const SliceMeshStorage> findFirstPrintedMesh() const;
768+
764769
private:
765770
/*!
766771
* \brief Compute the preferred or minimum combing boundary
@@ -881,9 +886,10 @@ class LayerPlan : public NoCopy
881886
* \param compute_distance_to_bridge_start Whether we should compute the distance to start of bridge. This is
882887
* possible only if PathType is ExtrusionLine and will be ignored otherwise.
883888
* \param func_add_segment The function to be called to actually add an extrusion segment with the given parameters
889+
* \return The index of the last traversed point, and the final position with the scarf seam
884890
*/
885891
template<class PathType>
886-
void addSplitWall(
892+
std::tuple<size_t, Point2LL> addSplitWall(
887893
const PathAdapter<PathType>& wall,
888894
const coord_t wall_length,
889895
const size_t start_idx,
@@ -926,9 +932,10 @@ class LayerPlan : public NoCopy
926932
* \param scarf_seam Indicates whether we may use a scarf seam for the path
927933
* \param smooth_speed Indicates whether we may use a speed gradient for the path
928934
* \param func_add_segment The function to be called to actually add an extrusion segment with the given parameters
935+
* \return The index of the last traversed point, and the final position with the scarf seam
929936
*/
930937
template<class PathType>
931-
void addWallWithScarfSeam(
938+
std::tuple<size_t, Point2LL> addWallWithScarfSeam(
932939
const PathAdapter<PathType>& wall,
933940
size_t start_idx,
934941
const Settings& settings,
@@ -942,6 +949,18 @@ class LayerPlan : public NoCopy
942949
const bool smooth_speed,
943950
const AddExtrusionSegmentFunction& func_add_segment);
944951

952+
/*!
953+
* \brief Add a wipe travel after the given path has been extruded
954+
* \tparam PathType The type of path to be processed, either ExtrusionLine or some subclass of Polyline
955+
* \param path The path that has just been extruded
956+
* \param wipe_distance The length of the wipe move to be added
957+
* \param backwards Indicates if the path has been processed backwards
958+
* \param start_index The index of the point where o start printing the path
959+
* \param last_path_position The actual last position of the extruder, which may be slightly forwards on the last printed segment
960+
*/
961+
template<class PathType>
962+
void addWipeTravel(const PathAdapter<PathType>& path, const coord_t wipe_distance, const bool backwards, const size_t start_index, const Point2LL& last_path_position);
963+
945964
/*!
946965
* Pre-calculates the coasting to be applied on the paths
947966
*

include/PathOrderOptimizer.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,10 @@ class PathOrderOptimizer
740740

741741
if (path.force_start_index_.has_value()) // Actually handles EZSeamType::USER_SPECIFIED
742742
{
743-
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, points.at(path.force_start_index_.value()));
743+
// Use a much smaller distance divider because we want points around the forced points to be filtered out very easily
744+
constexpr double distance_divider = 1.0;
745+
constexpr auto distance_type = DistanceScoringCriterion::DistanceType::Euclidian;
746+
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, points.at(path.force_start_index_.value()), distance_type, distance_divider);
744747
}
745748
else
746749
{

include/TreeSupportSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct TreeSupportSettings
3939
, maximum_move_distance((angle < TAU / 4) ? std::llround(tan(angle) * layer_height) : std::numeric_limits<coord_t>::max())
4040
, maximum_move_distance_slow((angle_slow < TAU / 4) ? std::llround(tan(angle_slow) * layer_height) : std::numeric_limits<coord_t>::max())
4141
, support_bottom_layers(mesh_group_settings.get<bool>("support_bottom_enable") ? round_divide(mesh_group_settings.get<coord_t>("support_bottom_height"), layer_height) : 0)
42-
, tip_layers(std::max((branch_radius - min_radius) / (support_line_width / 3), branch_radius / layer_height))
42+
, tip_layers(std::max(std::max((branch_radius - min_radius) / (support_line_width / 3), branch_radius / layer_height), 1LL))
4343
, // Ensure lines always stack nicely even if layer height is large
4444
diameter_angle_scale_factor(sin(mesh_group_settings.get<AngleRadians>("support_tree_branch_diameter_angle")) * layer_height / branch_radius)
4545
, max_to_model_radius_increase(mesh_group_settings.get<coord_t>("support_tree_max_diameter_increase_by_merges_when_support_to_model") / 2)

include/skin.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,9 @@ class SkinInfillAreaComputation
135135
void generateRoofingFillAndSkinFill(SliceLayerPart& part);
136136

137137
/*!
138-
* Remove the areas which are directly under air in the top-most surface and directly above air in bottom-most
139-
* surfaces from the \ref SkinPart::inner_infill and save them in the \ref SkinPart::bottom_most_surface_fill and
140-
* \ref SkinPart::top_most_surface_fill (respectively) of the \p part.
141-
*
142-
* \param[in,out] part Where to get the SkinParts to get the outline info from and to store the top and bottom-most
143-
* infill areas
138+
* Generate the top and bottom-most surfaces of the given \p part, i.e. the surfaces that have nothing above or below
144139
*/
145-
void generateTopAndBottomMostSkinFill(SliceLayerPart& part);
140+
void generateTopAndBottomMostSurfaces(SliceLayerPart& part);
146141

147142
/*!
148143
* Helper function to calculate and return the areas which are 'directly' under air.

include/sliceDataStorage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ class SkinPart
4545
//!< roofing and non-roofing.
4646
Shape skin_fill; //!< The part of the skin which is not roofing.
4747
Shape roofing_fill; //!< The inner infill which has air directly above
48-
Shape top_most_surface_fill; //!< The inner infill of the uppermost top layer which has air directly above.
49-
Shape bottom_most_surface_fill; //!< The inner infill of the bottommost bottom layer which has air directly below.
5048
};
5149

5250
/*!
@@ -69,6 +67,8 @@ class SliceLayerPart
6967
std::vector<SkinPart> skin_parts; //!< The skin parts which are filled for 100% with lines and/or insets.
7068
std::vector<VariableWidthLines> wall_toolpaths; //!< toolpaths for walls, will replace(?) the insets. Binned by inset_idx.
7169
std::vector<VariableWidthLines> infill_wall_toolpaths; //!< toolpaths for the walls of the infill areas. Binned by inset_idx.
70+
Shape top_most_surface; //!< Sub-part of the outline containing the area that is not covered by something above
71+
Shape bottom_most_surface; //!< Sub-part of the outline containing the area that has nothing below
7272

7373
/*!
7474
* The areas inside of the mesh.

include/utils/scoring/DistanceScoringCriterion.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,18 @@ class DistanceScoringCriterion : public ScoringCriterion
3030
const Point2LL& target_pos_;
3131
const DistanceType distance_type_;
3232

33+
/*!
34+
* Fixed divider for shortest distances computation. The divider should be set so that the minimum encountered
35+
* distance gives a score very close to 1.0, and a medium-far distance gives a score close to 0.5
36+
*/
37+
const double distance_divider_;
38+
3339
public:
34-
explicit DistanceScoringCriterion(const PointsSet& points, const Point2LL& target_pos, DistanceType distance_type = DistanceType::Euclidian);
40+
explicit DistanceScoringCriterion(
41+
const PointsSet& points,
42+
const Point2LL& target_pos,
43+
DistanceType distance_type = DistanceType::Euclidian,
44+
const double distance_divider = 20.0);
3545

3646
virtual double computeScore(const size_t candidate_index) const override;
3747
};

src/ExtruderPlan.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,18 @@ void ExtruderPlan::applyBackPressureCompensation(const Ratio back_pressure_compe
7070
path.speed_back_pressure_factor = std::max(epsilon_speed_factor, 1.0 + (nominal_width_for_path / line_width_for_path - 1.0) * back_pressure_compensation);
7171
}
7272
}
73+
74+
std::shared_ptr<const SliceMeshStorage> ExtruderPlan::findFirstPrintedMesh() const
75+
{
76+
for (const GCodePath& path : paths_)
77+
{
78+
if (path.mesh)
79+
{
80+
return path.mesh;
81+
}
82+
}
83+
84+
return nullptr;
85+
}
86+
7387
} // namespace cura

0 commit comments

Comments
 (0)