Some documentation, C++11 conversion, code beautification,

added some helper methods.
This commit is contained in:
bubnikv 2018-07-25 16:11:31 +02:00
parent 077680b806
commit 440e58573e
14 changed files with 109 additions and 82 deletions

View file

@ -61,12 +61,11 @@ ExPolygonCollection::rotate(double angle, const Point &center)
} }
template <class T> template <class T>
bool bool ExPolygonCollection::contains(const T &item) const
ExPolygonCollection::contains(const T &item) const
{ {
for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) { for (const ExPolygon &poly : this->expolygons)
if (it->contains(item)) return true; if (poly.contains(item))
} return true;
return false; return false;
} }
template bool ExPolygonCollection::contains<Point>(const Point &item) const; template bool ExPolygonCollection::contains<Point>(const Point &item) const;

View file

@ -91,6 +91,8 @@ public:
// Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm. // Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm.
virtual double min_mm3_per_mm() const = 0; virtual double min_mm3_per_mm() const = 0;
virtual Polyline as_polyline() const = 0; virtual Polyline as_polyline() const = 0;
virtual void collect_polylines(Polylines &dst) const = 0;
virtual Polylines as_polylines() const { Polylines dst; this->collect_polylines(dst); return dst; }
virtual double length() const = 0; virtual double length() const = 0;
virtual double total_volume() const = 0; virtual double total_volume() const = 0;
}; };
@ -123,8 +125,11 @@ public:
ExtrusionPath* clone() const { return new ExtrusionPath (*this); } ExtrusionPath* clone() const { return new ExtrusionPath (*this); }
void reverse() { this->polyline.reverse(); } void reverse() { this->polyline.reverse(); }
Point first_point() const { return this->polyline.points.front(); } Point first_point() const override { return this->polyline.points.front(); }
Point last_point() const { return this->polyline.points.back(); } Point last_point() const override { return this->polyline.points.back(); }
size_t size() const { return this->polyline.size(); }
bool empty() const { return this->polyline.empty(); }
bool is_closed() const { return ! this->empty() && this->polyline.points.front() == this->polyline.points.back(); }
// Produce a list of extrusion paths into retval by clipping this path by ExPolygonCollection. // Produce a list of extrusion paths into retval by clipping this path by ExPolygonCollection.
// Currently not used. // Currently not used.
void intersect_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const; void intersect_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
@ -133,8 +138,8 @@ public:
void subtract_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const; void subtract_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
void clip_end(double distance); void clip_end(double distance);
void simplify(double tolerance); void simplify(double tolerance);
virtual double length() const; double length() const override;
virtual ExtrusionRole role() const { return m_role; } ExtrusionRole role() const override { return m_role; }
// Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width. // Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width.
// Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps. // Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps.
void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const; void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const;
@ -149,7 +154,8 @@ public:
// Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm. // Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm.
double min_mm3_per_mm() const { return this->mm3_per_mm; } double min_mm3_per_mm() const { return this->mm3_per_mm; }
Polyline as_polyline() const { return this->polyline; } Polyline as_polyline() const { return this->polyline; }
virtual double total_volume() const { return mm3_per_mm * unscale(length()); } void collect_polylines(Polylines &dst) const override { if (! this->polyline.empty()) dst.emplace_back(this->polyline); }
double total_volume() const override { return mm3_per_mm * unscale(length()); }
private: private:
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const; void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
@ -178,10 +184,10 @@ public:
bool can_reverse() const { return true; } bool can_reverse() const { return true; }
ExtrusionMultiPath* clone() const { return new ExtrusionMultiPath(*this); } ExtrusionMultiPath* clone() const { return new ExtrusionMultiPath(*this); }
void reverse(); void reverse();
Point first_point() const { return this->paths.front().polyline.points.front(); } Point first_point() const override { return this->paths.front().polyline.points.front(); }
Point last_point() const { return this->paths.back().polyline.points.back(); } Point last_point() const override { return this->paths.back().polyline.points.back(); }
virtual double length() const; double length() const override;
virtual ExtrusionRole role() const { return this->paths.empty() ? erNone : this->paths.front().role(); } ExtrusionRole role() const override { return this->paths.empty() ? erNone : this->paths.front().role(); }
// Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width. // Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width.
// Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps. // Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps.
void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const; void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const;
@ -196,7 +202,8 @@ public:
// Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm. // Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm.
double min_mm3_per_mm() const; double min_mm3_per_mm() const;
Polyline as_polyline() const; Polyline as_polyline() const;
virtual double total_volume() const { double volume =0.; for (const auto& path : paths) volume += path.total_volume(); return volume; } void collect_polylines(Polylines &dst) const override { Polyline pl = this->as_polyline(); if (! pl.empty()) dst.emplace_back(std::move(pl)); }
double total_volume() const override { double volume =0.; for (const auto& path : paths) volume += path.total_volume(); return volume; }
}; };
// Single continuous extrusion loop, possibly with varying extrusion thickness, extrusion height or bridging / non bridging. // Single continuous extrusion loop, possibly with varying extrusion thickness, extrusion height or bridging / non bridging.
@ -218,18 +225,18 @@ public:
bool make_clockwise(); bool make_clockwise();
bool make_counter_clockwise(); bool make_counter_clockwise();
void reverse(); void reverse();
Point first_point() const { return this->paths.front().polyline.points.front(); } Point first_point() const override { return this->paths.front().polyline.points.front(); }
Point last_point() const { assert(first_point() == this->paths.back().polyline.points.back()); return first_point(); } Point last_point() const override { assert(first_point() == this->paths.back().polyline.points.back()); return first_point(); }
Polygon polygon() const; Polygon polygon() const;
virtual double length() const; double length() const override;
bool split_at_vertex(const Point &point); bool split_at_vertex(const Point &point);
void split_at(const Point &point, bool prefer_non_overhang); void split_at(const Point &point, bool prefer_non_overhang);
void clip_end(double distance, ExtrusionPaths* paths) const; void clip_end(double distance, ExtrusionPaths* paths) const;
// Test, whether the point is extruded by a bridging flow. // Test, whether the point is extruded by a bridging flow.
// This used to be used to avoid placing seams on overhangs, but now the EdgeGrid is used instead. // This used to be used to avoid placing seams on overhangs, but now the EdgeGrid is used instead.
bool has_overhang_point(const Point &point) const; bool has_overhang_point(const Point &point) const;
virtual ExtrusionRole role() const { return this->paths.empty() ? erNone : this->paths.front().role(); } ExtrusionRole role() const override { return this->paths.empty() ? erNone : this->paths.front().role(); }
ExtrusionLoopRole loop_role() const { return m_loop_role; } ExtrusionLoopRole loop_role() const { return m_loop_role; }
// Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width. // Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width.
// Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps. // Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps.
void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const; void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const;
@ -244,7 +251,8 @@ public:
// Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm. // Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm.
double min_mm3_per_mm() const; double min_mm3_per_mm() const;
Polyline as_polyline() const { return this->polygon().split_at_first_point(); } Polyline as_polyline() const { return this->polygon().split_at_first_point(); }
virtual double total_volume() const { double volume =0.; for (const auto& path : paths) volume += path.total_volume(); return volume; } void collect_polylines(Polylines &dst) const override { Polyline pl = this->as_polyline(); if (! pl.empty()) dst.emplace_back(std::move(pl)); }
double total_volume() const override { double volume =0.; for (const auto& path : paths) volume += path.total_volume(); return volume; }
private: private:
ExtrusionLoopRole m_loop_role; ExtrusionLoopRole m_loop_role;

View file

@ -24,7 +24,7 @@ public:
explicit operator ExtrusionPaths() const; explicit operator ExtrusionPaths() const;
bool is_collection() const { return true; }; bool is_collection() const { return true; };
virtual ExtrusionRole role() const { ExtrusionRole role() const override {
ExtrusionRole out = erNone; ExtrusionRole out = erNone;
for (const ExtrusionEntity *ee : entities) { for (const ExtrusionEntity *ee : entities) {
ExtrusionRole er = ee->role(); ExtrusionRole er = ee->role();
@ -66,11 +66,11 @@ public:
Point last_point() const { return this->entities.back()->last_point(); } Point last_point() const { return this->entities.back()->last_point(); }
// Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width. // Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion width.
// Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps. // Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps.
virtual void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const; void polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const override;
// Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion spacing. // Produce a list of 2D polygons covered by the extruded paths, offsetted by the extrusion spacing.
// Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps. // Increase the offset by scaled_epsilon to achieve an overlap, so a union will produce no gaps.
// Useful to calculate area of an infill, which has been really filled in by a 100% rectilinear infill. // Useful to calculate area of an infill, which has been really filled in by a 100% rectilinear infill.
virtual void polygons_covered_by_spacing(Polygons &out, const float scaled_epsilon) const; void polygons_covered_by_spacing(Polygons &out, const float scaled_epsilon) const override;
Polygons polygons_covered_by_width(const float scaled_epsilon = 0.f) const Polygons polygons_covered_by_width(const float scaled_epsilon = 0.f) const
{ Polygons out; this->polygons_covered_by_width(out, scaled_epsilon); return out; } { Polygons out; this->polygons_covered_by_width(out, scaled_epsilon); return out; }
Polygons polygons_covered_by_spacing(const float scaled_epsilon = 0.f) const Polygons polygons_covered_by_spacing(const float scaled_epsilon = 0.f) const
@ -79,14 +79,20 @@ public:
void flatten(ExtrusionEntityCollection* retval) const; void flatten(ExtrusionEntityCollection* retval) const;
ExtrusionEntityCollection flatten() const; ExtrusionEntityCollection flatten() const;
double min_mm3_per_mm() const; double min_mm3_per_mm() const;
virtual double total_volume() const {double volume=0.; for (const auto& ent : entities) volume+=ent->total_volume(); return volume; } double total_volume() const override { double volume=0.; for (const auto& ent : entities) volume+=ent->total_volume(); return volume; }
// Following methods shall never be called on an ExtrusionEntityCollection. // Following methods shall never be called on an ExtrusionEntityCollection.
Polyline as_polyline() const { Polyline as_polyline() const {
CONFESS("Calling as_polyline() on a ExtrusionEntityCollection"); CONFESS("Calling as_polyline() on a ExtrusionEntityCollection");
return Polyline(); return Polyline();
}; };
virtual double length() const {
void collect_polylines(Polylines &dst) const override {
for (ExtrusionEntity* extrusion_entity : this->entities)
extrusion_entity->collect_polylines(dst);
}
double length() const override {
CONFESS("Calling length() on a ExtrusionEntityCollection"); CONFESS("Calling length() on a ExtrusionEntityCollection");
return 0.; return 0.;
} }

View file

@ -115,7 +115,8 @@ Flow support_material_flow(const PrintObject *object, float layer_height)
// if object->config.support_material_extruder == 0 (which means to not trigger tool change, but use the current extruder instead), get_at will return the 0th component. // if object->config.support_material_extruder == 0 (which means to not trigger tool change, but use the current extruder instead), get_at will return the 0th component.
float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)), float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)),
(layer_height > 0.f) ? layer_height : float(object->config.layer_height.value), (layer_height > 0.f) ? layer_height : float(object->config.layer_height.value),
false); // bridge_flow_ratio
0.f);
} }
Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height) Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height)
@ -127,7 +128,8 @@ Flow support_material_1st_layer_flow(const PrintObject *object, float layer_heig
(width.value > 0) ? width : object->config.extrusion_width, (width.value > 0) ? width : object->config.extrusion_width,
float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)), float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)),
(layer_height > 0.f) ? layer_height : float(object->config.first_layer_height.get_abs_value(object->config.layer_height.value)), (layer_height > 0.f) ? layer_height : float(object->config.first_layer_height.get_abs_value(object->config.layer_height.value)),
false); // bridge_flow_ratio
0.f);
} }
Flow support_material_interface_flow(const PrintObject *object, float layer_height) Flow support_material_interface_flow(const PrintObject *object, float layer_height)
@ -139,7 +141,8 @@ Flow support_material_interface_flow(const PrintObject *object, float layer_heig
// if object->config.support_material_interface_extruder == 0 (which means to not trigger tool change, but use the current extruder instead), get_at will return the 0th component. // if object->config.support_material_interface_extruder == 0 (which means to not trigger tool change, but use the current extruder instead), get_at will return the 0th component.
float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_interface_extruder-1)), float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_interface_extruder-1)),
(layer_height > 0.f) ? layer_height : float(object->config.layer_height.value), (layer_height > 0.f) ? layer_height : float(object->config.layer_height.value),
false); // bridge_flow_ratio
0.f);
} }
} }

View file

@ -21,45 +21,37 @@ class LayerRegion
friend class Layer; friend class Layer;
public: public:
Layer* layer() { return this->_layer; } Layer* layer() { return this->_layer; }
const Layer* layer() const { return this->_layer; } const Layer* layer() const { return this->_layer; }
PrintRegion* region() { return this->_region; } PrintRegion* region() { return this->_region; }
const PrintRegion* region() const { return this->_region; } const PrintRegion* region() const { return this->_region; }
// collection of surfaces generated by slicing the original geometry // Collection of surfaces generated by slicing the original geometry, divided by type top/bottom/internal.
// divided by type top/bottom/internal SurfaceCollection slices;
SurfaceCollection slices;
// collection of extrusion paths/loops filling gaps
// These fills are generated by the perimeter generator.
// They are not printed on their own, but they are copied to this->fills during infill generation.
ExtrusionEntityCollection thin_fills;
// Unspecified fill polygons, used for overhang detection ("ensure vertical wall thickness feature") // Unspecified fill polygons, used for overhang detection ("ensure vertical wall thickness feature")
// and for re-starting of infills. // and for re-starting of infills.
ExPolygons fill_expolygons; ExPolygons fill_expolygons;
// collection of surfaces for infill generation // collection of surfaces for infill generation
SurfaceCollection fill_surfaces; SurfaceCollection fill_surfaces;
// Collection of extrusion paths/loops filling gaps.
// These fills are generated by the perimeter generator.
// They are not printed on their own, but they are copied to this->fills during infill generation.
ExtrusionEntityCollection thin_fills;
// Collection of perimeter surfaces. This is a cached result of diff(slices, fill_surfaces). // Collection of expolygons representing the bridged areas (thus not needing support material).
// While not necessary, the memory consumption is meager and it speeds up calculation. //FIXME Not used as of now.
// The perimeter_surfaces keep the IDs of the slices (top/bottom/) Polygons bridged;
SurfaceCollection perimeter_surfaces;
// collection of expolygons representing the bridged areas (thus not
// needing support material)
Polygons bridged;
// collection of polylines representing the unsupported bridge edges // collection of polylines representing the unsupported bridge edges
PolylineCollection unsupported_bridge_edges; PolylineCollection unsupported_bridge_edges;
// ordered collection of extrusion paths/loops to build all perimeters // Ordered collection of extrusion paths/loops to build all perimeters.
// (this collection contains only ExtrusionEntityCollection objects) // This collection contains only ExtrusionEntityCollection objects.
ExtrusionEntityCollection perimeters; ExtrusionEntityCollection perimeters;
// Ordered collection of extrusion paths to fill surfaces.
// ordered collection of extrusion paths to fill surfaces // This collection contains only ExtrusionEntityCollection objects.
// (this collection contains only ExtrusionEntityCollection objects) ExtrusionEntityCollection fills;
ExtrusionEntityCollection fills;
Flow flow(FlowRole role, bool bridge = false, double width = -1) const; Flow flow(FlowRole role, bool bridge = false, double width = -1) const;
void slices_to_fill_surfaces_clipped(); void slices_to_fill_surfaces_clipped();

View file

@ -15,8 +15,7 @@
namespace Slic3r { namespace Slic3r {
Flow Flow LayerRegion::flow(FlowRole role, bool bridge, double width) const
LayerRegion::flow(FlowRole role, bool bridge, double width) const
{ {
return this->_region->flow( return this->_region->flow(
role, role,
@ -51,8 +50,7 @@ void LayerRegion::slices_to_fill_surfaces_clipped()
} }
} }
void void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces)
LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces)
{ {
this->perimeters.clear(); this->perimeters.clear();
this->thin_fills.clear(); this->thin_fills.clear();
@ -340,8 +338,7 @@ void LayerRegion::process_external_surfaces(const Layer* lower_layer)
#endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */
} }
void void LayerRegion::prepare_fill_surfaces()
LayerRegion::prepare_fill_surfaces()
{ {
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING #ifdef SLIC3R_DEBUG_SLICE_PROCESSING
export_region_slices_to_svg_debug("2_prepare_fill_surfaces-initial"); export_region_slices_to_svg_debug("2_prepare_fill_surfaces-initial");
@ -382,8 +379,7 @@ LayerRegion::prepare_fill_surfaces()
#endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */
} }
double double LayerRegion::infill_area_threshold() const
LayerRegion::infill_area_threshold() const
{ {
double ss = this->flow(frSolidInfill).scaled_spacing(); double ss = this->flow(frSolidInfill).scaled_spacing();
return ss*ss; return ss*ss;

View file

@ -34,8 +34,10 @@ public:
Point first_point() const; Point first_point() const;
virtual Point last_point() const = 0; virtual Point last_point() const = 0;
virtual Lines lines() const = 0; virtual Lines lines() const = 0;
size_t size() const { return points.size(); }
bool empty() const { return points.empty(); }
double length() const; double length() const;
bool is_valid() const { return this->points.size() >= 2; } bool is_valid() const { return this->points.size() >= 2; }
int find_point(const Point &point) const; int find_point(const Point &point) const;
bool has_boundary_point(const Point &point) const; bool has_boundary_point(const Point &point) const;

View file

@ -103,6 +103,12 @@ inline void polygons_rotate(Polygons &polys, double angle)
p.rotate(cos_angle, sin_angle); p.rotate(cos_angle, sin_angle);
} }
inline void polygons_reverse(Polygons &polys)
{
for (Polygon &p : polys)
p.reverse();
}
inline Points to_points(const Polygon &poly) inline Points to_points(const Polygon &poly)
{ {
return poly.points; return poly.points;

View file

@ -193,23 +193,19 @@ Polyline::split_at(const Point &point, Polyline* p1, Polyline* p2) const
} }
} }
bool bool Polyline::is_straight() const
Polyline::is_straight() const
{ {
/* Check that each segment's direction is equal to the line connecting // Check that each segment's direction is equal to the line connecting
first point and last point. (Checking each line against the previous // first point and last point. (Checking each line against the previous
one would cause the error to accumulate.) */ // one would cause the error to accumulate.)
double dir = Line(this->first_point(), this->last_point()).direction(); double dir = Line(this->first_point(), this->last_point()).direction();
for (const auto &line: this->lines())
Lines lines = this->lines(); if (! line.parallel_to(dir))
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) { return false;
if (!line->parallel_to(dir)) return false;
}
return true; return true;
} }
std::string std::string Polyline::wkt() const
Polyline::wkt() const
{ {
std::ostringstream wkt; std::ostringstream wkt;
wkt << "LINESTRING(("; wkt << "LINESTRING((";

View file

@ -80,7 +80,10 @@ public:
Print* print() { return this->_print; } Print* print() { return this->_print; }
Flow flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, const PrintObject &object) const; Flow flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, const PrintObject &object) const;
// Average diameter of nozzles participating on extruding this region.
coordf_t nozzle_dmr_avg(const PrintConfig &print_config) const; coordf_t nozzle_dmr_avg(const PrintConfig &print_config) const;
// Average diameter of nozzles participating on extruding this region.
coordf_t bridging_height_avg(const PrintConfig &print_config) const;
private: private:
Print* _print; Print* _print;

View file

@ -310,6 +310,7 @@ public:
ConfigOptionFloatOrPercent extrusion_width; ConfigOptionFloatOrPercent extrusion_width;
ConfigOptionFloatOrPercent first_layer_height; ConfigOptionFloatOrPercent first_layer_height;
ConfigOptionBool infill_only_where_needed; ConfigOptionBool infill_only_where_needed;
// Force the generation of solid shells between adjacent materials/volumes.
ConfigOptionBool interface_shells; ConfigOptionBool interface_shells;
ConfigOptionFloat layer_height; ConfigOptionFloat layer_height;
ConfigOptionInt raft_layers; ConfigOptionInt raft_layers;
@ -317,6 +318,7 @@ public:
// ConfigOptionFloat seam_preferred_direction; // ConfigOptionFloat seam_preferred_direction;
// ConfigOptionFloat seam_preferred_direction_jitter; // ConfigOptionFloat seam_preferred_direction_jitter;
ConfigOptionBool support_material; ConfigOptionBool support_material;
// Direction of the support pattern (in XY plane).
ConfigOptionFloat support_material_angle; ConfigOptionFloat support_material_angle;
ConfigOptionBool support_material_buildplate_only; ConfigOptionBool support_material_buildplate_only;
ConfigOptionFloat support_material_contact_distance; ConfigOptionFloat support_material_contact_distance;
@ -326,12 +328,15 @@ public:
ConfigOptionBool support_material_interface_contact_loops; ConfigOptionBool support_material_interface_contact_loops;
ConfigOptionInt support_material_interface_extruder; ConfigOptionInt support_material_interface_extruder;
ConfigOptionInt support_material_interface_layers; ConfigOptionInt support_material_interface_layers;
// Spacing between interface lines (the hatching distance). Set zero to get a solid interface.
ConfigOptionFloat support_material_interface_spacing; ConfigOptionFloat support_material_interface_spacing;
ConfigOptionFloatOrPercent support_material_interface_speed; ConfigOptionFloatOrPercent support_material_interface_speed;
ConfigOptionEnum<SupportMaterialPattern> support_material_pattern; ConfigOptionEnum<SupportMaterialPattern> support_material_pattern;
// Spacing between support material lines (the hatching distance).
ConfigOptionFloat support_material_spacing; ConfigOptionFloat support_material_spacing;
ConfigOptionFloat support_material_speed; ConfigOptionFloat support_material_speed;
ConfigOptionBool support_material_synchronize_layers; ConfigOptionBool support_material_synchronize_layers;
// Overhang angle threshold.
ConfigOptionInt support_material_threshold; ConfigOptionInt support_material_threshold;
ConfigOptionBool support_material_with_sheath; ConfigOptionBool support_material_with_sheath;
ConfigOptionFloatOrPercent support_material_xy_spacing; ConfigOptionFloatOrPercent support_material_xy_spacing;
@ -401,10 +406,12 @@ public:
ConfigOptionInt infill_every_layers; ConfigOptionInt infill_every_layers;
ConfigOptionFloatOrPercent infill_overlap; ConfigOptionFloatOrPercent infill_overlap;
ConfigOptionFloat infill_speed; ConfigOptionFloat infill_speed;
// Detect bridging perimeters
ConfigOptionBool overhangs; ConfigOptionBool overhangs;
ConfigOptionInt perimeter_extruder; ConfigOptionInt perimeter_extruder;
ConfigOptionFloatOrPercent perimeter_extrusion_width; ConfigOptionFloatOrPercent perimeter_extrusion_width;
ConfigOptionFloat perimeter_speed; ConfigOptionFloat perimeter_speed;
// Total number of perimeters.
ConfigOptionInt perimeters; ConfigOptionInt perimeters;
ConfigOptionFloatOrPercent small_perimeter_speed; ConfigOptionFloatOrPercent small_perimeter_speed;
ConfigOptionFloat solid_infill_below_area; ConfigOptionFloat solid_infill_below_area;
@ -412,6 +419,7 @@ public:
ConfigOptionFloatOrPercent solid_infill_extrusion_width; ConfigOptionFloatOrPercent solid_infill_extrusion_width;
ConfigOptionInt solid_infill_every_layers; ConfigOptionInt solid_infill_every_layers;
ConfigOptionFloatOrPercent solid_infill_speed; ConfigOptionFloatOrPercent solid_infill_speed;
// Detect thin walls.
ConfigOptionBool thin_walls; ConfigOptionBool thin_walls;
ConfigOptionFloatOrPercent top_infill_extrusion_width; ConfigOptionFloatOrPercent top_infill_extrusion_width;
ConfigOptionInt top_solid_layers; ConfigOptionInt top_solid_layers;

View file

@ -57,4 +57,9 @@ coordf_t PrintRegion::nozzle_dmr_avg(const PrintConfig &print_config) const
print_config.nozzle_diameter.get_at(this->config.solid_infill_extruder.value - 1)) / 3.; print_config.nozzle_diameter.get_at(this->config.solid_infill_extruder.value - 1)) / 3.;
} }
coordf_t PrintRegion::bridging_height_avg(const PrintConfig &print_config) const
{
return this->nozzle_dmr_avg(print_config) * this->config.bridge_flow_ratio.value;
}
} }

View file

@ -37,6 +37,11 @@ public:
void clear() { surfaces.clear(); } void clear() { surfaces.clear(); }
bool empty() const { return surfaces.empty(); } bool empty() const { return surfaces.empty(); }
bool has(SurfaceType type) const {
for (const Surface &surface : this->surfaces)
if (surface.surface_type == type) return true;
return false;
}
void set(const SurfaceCollection &coll) { surfaces = coll.surfaces; } void set(const SurfaceCollection &coll) { surfaces = coll.surfaces; }
void set(SurfaceCollection &&coll) { surfaces = std::move(coll.surfaces); } void set(SurfaceCollection &&coll) { surfaces = std::move(coll.surfaces); }

View file

@ -17,8 +17,6 @@
%code%{ RETVAL = &THIS->thin_fills; %}; %code%{ RETVAL = &THIS->thin_fills; %};
Ref<SurfaceCollection> fill_surfaces() Ref<SurfaceCollection> fill_surfaces()
%code%{ RETVAL = &THIS->fill_surfaces; %}; %code%{ RETVAL = &THIS->fill_surfaces; %};
Ref<SurfaceCollection> perimeter_surfaces()
%code%{ RETVAL = &THIS->perimeter_surfaces; %};
Polygons bridged() Polygons bridged()
%code%{ RETVAL = THIS->bridged; %}; %code%{ RETVAL = THIS->bridged; %};
Ref<PolylineCollection> unsupported_bridge_edges() Ref<PolylineCollection> unsupported_bridge_edges()