Skip to content

Commit

Permalink
Add basic skin generation
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Dec 18, 2024
1 parent bfbd3a2 commit be09f20
Show file tree
Hide file tree
Showing 5 changed files with 367 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ set(engine_SRCS # Except main.cpp.
src/feature_generation/MeshFeatureGenerator.cpp include/feature_generation/MeshFeatureGenerator.h
src/feature_generation/MeshInfillGenerator.cpp include/feature_generation/MeshInfillGenerator.h
src/feature_generation/MeshInsetsGenerator.cpp include/feature_generation/MeshInsetsGenerator.h
src/feature_generation/MeshSkinGenerator.cpp include/feature_generation/MeshSkinGenerator.h
src/feature_generation/SkirtBrimAppender.cpp include/feature_generation/SkirtBrimAppender.h

src/infill/ImageBasedDensityProvider.cpp
Expand Down
46 changes: 46 additions & 0 deletions include/feature_generation/MeshSkinGenerator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2024 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#pragma once

#include <utils/Coord_t.h>

#include "feature_generation/MeshFeatureGenerator.h"

namespace cura
{

enum class EFillMethod;
enum class PrintFeatureType : unsigned char;
struct GCodePathConfig;
struct Ratio;
class AngleDegrees;
class SkinPart;
class Shape;

class MeshSkinGenerator : public MeshFeatureGenerator
{
public:
explicit MeshSkinGenerator(const std::shared_ptr<SliceMeshStorage>& mesh);

protected:
void generateFeatures(const SliceDataStorage& storage, const LayerPlanPtr& layer_plan, const std::vector<ExtruderPlanPtr>& extruder_plans, const SliceLayerPart& part)
const override;

private:
void processRoofing(const LayerPlanPtr& layer_plan, const SkinPart& skin_part, const ExtruderPlanPtr& extruder_plan) const;

void processTopBottom(const SliceDataStorage& storage, const LayerPlanPtr& layer_plan, const SkinPart& skin_part, const ExtruderPlanPtr& extruder_plan) const;

void processSkinPrintFeature(
const LayerPlanPtr& layer_plan,
const Shape& area,
const GCodePathConfig& config,
EFillMethod pattern,
const AngleDegrees skin_angle,
const Ratio skin_density,
const PrintFeatureType feature_type,
const ExtruderPlanPtr& extruder_plan) const;
};

} // namespace cura
4 changes: 3 additions & 1 deletion src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "feature_generation/FeatureGenerator.h"
#include "feature_generation/MeshInfillGenerator.h"
#include "feature_generation/MeshInsetsGenerator.h"
#include "feature_generation/MeshSkinGenerator.h"
#include "geometry/LinesSet.h"
#include "geometry/OpenPolyline.h"
#include "geometry/PointMatrix.h"
Expand Down Expand Up @@ -196,9 +197,10 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep
{
feature_generators_.push_back(std::make_shared<MeshInsetsGenerator>(mesh));
feature_generators_.push_back(std::make_shared<MeshInfillGenerator>(mesh));
feature_generators_.push_back(std::make_shared<MeshSkinGenerator>(mesh));
}

// Filter out generators that are actually useless in this context. Not highly useful, but helps for debugging.
// Filter out generators that are actually useless in this context, to save significant time on next steps
ranges::remove_if(
feature_generators_,
[](const std::shared_ptr<FeatureGenerator>& generator)
Expand Down
4 changes: 2 additions & 2 deletions src/feature_generation/MeshInfillGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ void MeshInfillGenerator::generateFeatures(
feature_extrusion->appendExtruderMoveSequence(ContinuousExtruderMoveSequence::makeFrom(extrusion_line, infill_config.getSpeed()));
}
}

extruder_plan_infill->appendFeatureExtrusion(feature_extrusion);
}

extruder_plan_infill->appendFeatureExtrusion(feature_extrusion);
}
}

Expand Down
Loading

0 comments on commit be09f20

Please sign in to comment.