OrcaSlicer/src/libslic3r/GCode/SmallAreaInfillFlowCompensator.hpp
Morton Jonuschat 82ead12cde
[FEATURE] Experimental small area flow compensation (#3334)
* [FEATURE] Experimental small area flow compensation

This is a native implementation of the [Small Area Flow Compensation](https://github.com/Alexander-T-Moss/Small-Area-Flow-Comp)
post-processor by Alexander Þór for OrcaSlicer.

Quite often small areas of solid infill appear to be over-extruded, despite
the rest of a print looking like it has a well-dialled-in EM/Flow. Currently,
there isn't a good understanding of why this happens, so this is an attempt
at a brute-force approach to treat the symptom.

This feature modifies the flow of extrusion lines inversely proportional to
the length of the extrusion line (the shorter the extrusion, the less flow
it should have).

Alexander Þór: Author of the original script implementation
Weaslus: Proof Reader, Hypeman & pestered folks into making this

* [TASK] Whitespace cleanup

* [TASK] Add credits, format code, improve input labels

* [TASK] Use multi-line textbox as input for flow model

* [TASK] Toggle flow compensation per object

* [TASK] Enable flow compensation for first layer

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
2024-01-21 12:07:52 +08:00

35 lines
928 B
C++

#ifndef slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_
#define slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
#include "../ExtrusionEntity.hpp"
#include "spline/spline.h"
namespace Slic3r {
class SmallAreaInfillFlowCompensator
{
public:
SmallAreaInfillFlowCompensator() = delete;
explicit SmallAreaInfillFlowCompensator(const Slic3r::GCodeConfig& config);
~SmallAreaInfillFlowCompensator() = default;
double modify_flow(const double line_length, const double dE, const ExtrusionRole role);
private:
// Model points
std::vector<double> eLengths;
std::vector<double> flowComps;
// TODO: Cubic Spline
tk::spline flowModel;
double flow_comp_model(const double line_length);
double max_modified_length() { return eLengths.back(); }
};
} // namespace Slic3r
#endif /* slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_ */