Skip to content

Commit

Permalink
Merge branch 'CURA-11041_fracional_support_gap' into CURA-10561-makerbot
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/FffGcodeWriter.cpp
  • Loading branch information
casperlamboo committed Oct 19, 2023
2 parents 87fbc0a + 1fed8a7 commit 98ea80d
Show file tree
Hide file tree
Showing 16 changed files with 200 additions and 101 deletions.
4 changes: 3 additions & 1 deletion include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,12 @@ class FffGcodeWriter : public NoCopy
* layer.
*
* \param[in] storage Where the slice data is stored.
* \param[in] support_roof_outlines which polygons to generate roofs for -- originally split-up because of fractional (layer-height) layers
* \param[in] current_roof_config config to be used -- most importantly, support has slightly different configs for fractional (layer-height) layers
* \param gcodeLayer The initial planning of the g-code of the layer.
* \return Whether any support skin was added to the layer plan.
*/
bool addSupportRoofsToGCode(const SliceDataStorage& storage, LayerPlan& gcodeLayer) const;
bool addSupportRoofsToGCode(const SliceDataStorage& storage, const Polygons& support_roof_outlines, const GCodePathConfig& current_roof_config, LayerPlan& gcode_layer) const;

/*!
* Add the support bottoms to the layer plan \p gcodeLayer of the current
Expand Down
1 change: 1 addition & 0 deletions include/GCodePathConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace cura
*/
struct GCodePathConfig
{
coord_t z_offset{};
PrintFeatureType type{}; //!< name of the feature type
coord_t line_width{}; //!< width of the line extruded
coord_t layer_thickness{}; //!< current layer height in micron
Expand Down
19 changes: 10 additions & 9 deletions include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ class LayerPlan : public NoCopy
*/
GCodePath* getLatestPathWithConfig(
const GCodePathConfig& config,
SpaceFillType space_fill_type,
const coord_t z_offset,
const SpaceFillType space_fill_type,
const Ratio flow = 1.0_r,
const Ratio width_factor = 1.0_r,
bool spiralize = false,
const bool spiralize = false,
const Ratio speed_factor = 1.0_r);

public:
Expand Down Expand Up @@ -281,7 +282,7 @@ class LayerPlan : public NoCopy
* \param p The point to travel to.
* \param force_retract Whether to force a retraction to occur.
*/
GCodePath& addTravel(const Point p, const bool force_retract = false);
GCodePath& addTravel(const Point p, const bool force_retract = false, const coord_t z_offset = 0);

/*!
* Add a travel path to a certain point and retract if needed.
Expand All @@ -291,7 +292,7 @@ class LayerPlan : public NoCopy
* \param p The point to travel to
* \param path (optional) The travel path to which to add the point \p p
*/
GCodePath& addTravel_simple(Point p, GCodePath* path = nullptr);
GCodePath& addTravel_simple(const Point p, GCodePath* path = nullptr);

/*!
* Plan a prime blob at the current location.
Expand All @@ -317,14 +318,14 @@ class LayerPlan : public NoCopy
* \param fan_speed Fan speed override for this path.
*/
void addExtrusionMove(
Point p,
const Point p,
const GCodePathConfig& config,
SpaceFillType space_fill_type,
const SpaceFillType space_fill_type,
const Ratio& flow = 1.0_r,
const Ratio width_factor = 1.0_r,
bool spiralize = false,
Ratio speed_factor = 1.0_r,
double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT);
const bool spiralize = false,
const Ratio speed_factor = 1.0_r,
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT);

/*!
* Add polygon to the gcode starting at vertex \p startIdx
Expand Down
19 changes: 10 additions & 9 deletions include/SupportInfillPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#ifndef SUPPORT_INFILL_PART_H
#define SUPPORT_INFILL_PART_H

#include <vector>

#include "utils/AABB.h"
#include "utils/ExtrusionLine.h"
#include "utils/polygon.h"

#include <vector>


namespace cura
{
Expand All @@ -25,17 +25,18 @@ namespace cura
class SupportInfillPart
{
public:
PolygonsPart outline; //!< The outline of the support infill area
AABB outline_boundary_box; //!< The boundary box for the infill area
coord_t support_line_width; //!< The support line width
int inset_count_to_generate; //!< The number of insets need to be generated from the outline. This is not the actual insets that will be generated.
std::vector<std::vector<Polygons>> infill_area_per_combine_per_density; //!< a list of separated sub-areas which requires different infill densities and combined thicknesses
// for infill_areas[x][n], x means the density level and n means the thickness
PolygonsPart outline; //!< The outline of the support infill area
AABB outline_boundary_box; //!< The boundary box for the infill area
coord_t support_line_width; //!< The support line width
int inset_count_to_generate; //!< The number of insets need to be generated from the outline. This is not the actual insets that will be generated.
std::vector<std::vector<Polygons>> infill_area_per_combine_per_density; //!< a list of separated sub-areas which requires different infill densities and combined thicknesses
// 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;
bool use_fractional_config;

SupportInfillPart(const PolygonsPart& outline, coord_t support_line_width, int inset_count_to_generate = 0, coord_t custom_line_distance = 0 );
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);

const Polygons& getInfillArea() const;
};
Expand Down
1 change: 1 addition & 0 deletions include/pathPlanning/GCodePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace cura
*/
struct GCodePath
{
coord_t z_offset{};
GCodePathConfig config{}; //!< The configuration settings of the path.
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;
SpaceFillType space_fill_type{}; //!< The type of space filling of which this path is a part
Expand Down
2 changes: 2 additions & 0 deletions include/settings/PathConfigStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class PathConfigStorage
std::vector<GCodePathConfig> prime_tower_config_per_extruder; //!< Configuration for the prime tower per extruder.

std::vector<GCodePathConfig> support_infill_config; //!< The config used to print the normal support, rather than the support interface
std::vector<GCodePathConfig> support_fractional_infill_config; //!< The config used to print the normal support on fractional layer-height parts.
GCodePathConfig support_roof_config; //!< The config used to print the dense roofs of support.
GCodePathConfig support_fractional_roof_config; //!< The config used to print the dense roofs of support on fractional layer-height parts.
GCodePathConfig support_bottom_config; //!< The config to use to print the dense bottoms of support

std::vector<MeshPathConfigs> mesh_configs; //!< For each meash the config for all its feature types
Expand Down
21 changes: 21 additions & 0 deletions include/sliceDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ class SupportLayer
std::vector<SupportInfillPart> support_infill_parts; //!< a list of support infill parts
Polygons support_bottom; //!< Piece of support below the support and above the model. This must not overlap with any of the support_infill_parts or support_roof.
Polygons support_roof; //!< Piece of support above the support and below the model. This must not overlap with any of the support_infill_parts or support_bottom.
// NOTE: This is _all_ of the support_roof, and as such, overlaps with support_fractional_roof!
Polygons support_fractional_roof; //!< If the support distance is not exactly a multiple of the layer height,
// the first part of support just underneath the model needs to be printed at a fracional layer height.
Polygons support_mesh_drop_down; //!< Areas from support meshes which should be supported by more support
Polygons support_mesh; //!< Areas from support meshes which should NOT be supported by more support
Polygons anti_overhang; //!< Areas where no overhang should be detected.
Expand All @@ -223,6 +226,24 @@ class SupportLayer
* \param exclude_polygons_boundary_box The boundary box for the polygons to exclude
*/
void excludeAreasFromSupportInfillAreas(const Polygons& exclude_polygons, const AABB& exclude_polygons_boundary_box);

/* Fill up the infill parts for the support with the given support polygons. The support polygons will be split into parts. This also takes into account fractional-height
* support layers.
*
* \param layer_nr Current layer index.
* \param support_fill_per_layer All of the (infill) support (since the layer above might be needed).
* \param support_line_width Line width of the support extrusions.
* \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.
*/
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);
};

class SupportStorage
Expand Down
Loading

0 comments on commit 98ea80d

Please sign in to comment.