2014-01-05 12:16:13 +00:00
|
|
|
#ifndef slic3r_Flow_hpp_
|
|
|
|
#define slic3r_Flow_hpp_
|
|
|
|
|
2015-12-07 23:39:54 +00:00
|
|
|
#include "libslic3r.h"
|
2014-01-05 12:16:13 +00:00
|
|
|
#include "Config.hpp"
|
|
|
|
#include "ExtrusionEntity.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2017-05-03 16:28:22 +00:00
|
|
|
class PrintObject;
|
|
|
|
|
2016-11-23 14:51:47 +00:00
|
|
|
// Extra spacing of bridge threads, in mm.
|
2014-01-05 12:16:13 +00:00
|
|
|
#define BRIDGE_EXTRA_SPACING 0.05
|
2016-11-23 14:51:47 +00:00
|
|
|
|
|
|
|
// Overlap factor of perimeter lines. Currently no overlap.
|
|
|
|
#ifdef HAS_PERIMETER_LINE_OVERLAP
|
|
|
|
#define PERIMETER_LINE_OVERLAP_FACTOR 1.0
|
|
|
|
#endif
|
2014-01-05 12:16:13 +00:00
|
|
|
|
|
|
|
enum FlowRole {
|
2014-06-09 19:14:48 +00:00
|
|
|
frExternalPerimeter,
|
2014-01-05 12:16:13 +00:00
|
|
|
frPerimeter,
|
|
|
|
frInfill,
|
|
|
|
frSolidInfill,
|
|
|
|
frTopSolidInfill,
|
|
|
|
frSupportMaterial,
|
|
|
|
frSupportMaterialInterface,
|
|
|
|
};
|
|
|
|
|
|
|
|
class Flow
|
|
|
|
{
|
2016-11-23 14:51:47 +00:00
|
|
|
public:
|
|
|
|
// Non bridging flow: Maximum width of an extrusion with semicircles at the ends.
|
|
|
|
// Bridging flow: Bridge thread diameter.
|
|
|
|
float width;
|
|
|
|
// Non bridging flow: Layer height.
|
|
|
|
// Bridging flow: Bridge thread diameter = layer height.
|
|
|
|
float height;
|
2017-07-19 13:53:43 +00:00
|
|
|
// Nozzle diameter.
|
2016-11-23 14:51:47 +00:00
|
|
|
float nozzle_diameter;
|
|
|
|
// Is it a bridge?
|
|
|
|
bool bridge;
|
2014-01-05 12:16:13 +00:00
|
|
|
|
2017-07-19 13:53:43 +00:00
|
|
|
Flow(float _w, float _h, float _nd, bool _bridge = false) :
|
2019-03-05 10:54:04 +00:00
|
|
|
width(_w), height(_h), nozzle_diameter(_nd), bridge(_bridge) {}
|
2017-07-19 13:53:43 +00:00
|
|
|
|
|
|
|
float spacing() const;
|
|
|
|
float spacing(const Flow &other) const;
|
|
|
|
double mm3_per_mm() const;
|
2019-03-05 10:54:04 +00:00
|
|
|
coord_t scaled_width() const { return coord_t(scale_(this->width)); }
|
|
|
|
coord_t scaled_spacing() const { return coord_t(scale_(this->spacing())); }
|
|
|
|
coord_t scaled_spacing(const Flow &other) const { return coord_t(scale_(this->spacing(other))); }
|
|
|
|
|
|
|
|
// Elephant foot compensation spacing to be used to detect narrow parts, where the elephant foot compensation cannot be applied.
|
|
|
|
// To be used on frExternalPerimeter only.
|
|
|
|
// Enable some perimeter squish (see INSET_OVERLAP_TOLERANCE).
|
|
|
|
// Here an overlap of 0.2x external perimeter spacing is allowed for by the elephant foot compensation.
|
|
|
|
coord_t scaled_elephant_foot_spacing() const { return coord_t(0.5f * float(this->scaled_width() + 0.6f * this->scaled_spacing())); }
|
2019-09-04 14:11:16 +00:00
|
|
|
|
|
|
|
bool operator==(const Flow &rhs) const { return this->width == rhs.width && this->height == rhs.height && this->nozzle_diameter == rhs.nozzle_diameter && this->bridge == rhs.bridge; }
|
2014-06-11 23:00:13 +00:00
|
|
|
|
2014-01-05 12:16:13 +00:00
|
|
|
static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float bridge_flow_ratio);
|
2017-11-09 09:48:06 +00:00
|
|
|
// Create a flow from the spacing of extrusion lines.
|
|
|
|
// This method is used exclusively to calculate new flow of 100% infill, where the extrusion width was allowed to scale
|
|
|
|
// to fit a region with integer number of lines.
|
2014-01-05 12:16:13 +00:00
|
|
|
static Flow new_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge);
|
|
|
|
};
|
|
|
|
|
2017-05-03 16:28:22 +00:00
|
|
|
extern Flow support_material_flow(const PrintObject *object, float layer_height = 0.f);
|
|
|
|
extern Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height = 0.f);
|
|
|
|
extern Flow support_material_interface_flow(const PrintObject *object, float layer_height = 0.f);
|
|
|
|
|
2014-01-05 12:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|