2013-07-15 10:14:22 +00:00
|
|
|
#ifndef slic3r_ExtrusionEntity_hpp_
|
|
|
|
#define slic3r_ExtrusionEntity_hpp_
|
|
|
|
|
2013-07-16 19:04:14 +00:00
|
|
|
#include <myinit.h>
|
2013-07-15 10:14:22 +00:00
|
|
|
#include "Polygon.hpp"
|
|
|
|
#include "Polyline.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2013-11-21 16:53:50 +00:00
|
|
|
class ExPolygonCollection;
|
|
|
|
class ExtrusionEntityCollection;
|
2014-04-07 23:43:02 +00:00
|
|
|
class Extruder;
|
2013-11-21 16:53:50 +00:00
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
enum ExtrusionRole {
|
|
|
|
erPerimeter,
|
|
|
|
erExternalPerimeter,
|
|
|
|
erOverhangPerimeter,
|
|
|
|
erContourInternalPerimeter,
|
|
|
|
erFill,
|
|
|
|
erSolidFill,
|
|
|
|
erTopSolidFill,
|
2014-05-08 09:07:37 +00:00
|
|
|
erBridge,
|
2013-07-15 10:14:22 +00:00
|
|
|
erInternalBridge,
|
|
|
|
erSkirt,
|
|
|
|
erSupportMaterial,
|
|
|
|
erGapFill,
|
|
|
|
};
|
|
|
|
|
|
|
|
class ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
2013-08-29 09:47:59 +00:00
|
|
|
virtual ExtrusionEntity* clone() const = 0;
|
2013-07-18 17:09:07 +00:00
|
|
|
virtual ~ExtrusionEntity() {};
|
2013-08-29 09:47:59 +00:00
|
|
|
virtual void reverse() = 0;
|
2014-04-24 14:40:10 +00:00
|
|
|
virtual Point first_point() const = 0;
|
|
|
|
virtual Point last_point() const = 0;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
2013-07-18 17:09:07 +00:00
|
|
|
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
class ExtrusionPath : public ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Polyline polyline;
|
2014-05-08 09:07:37 +00:00
|
|
|
ExtrusionRole role;
|
|
|
|
double mm3_per_mm; // mm^3 of plastic per mm of linear head motion
|
|
|
|
float width;
|
|
|
|
float height;
|
|
|
|
|
|
|
|
ExtrusionPath() : mm3_per_mm(-1), width(-1), height(-1) {};
|
|
|
|
ExtrusionPath* clone() const;
|
2013-07-15 10:14:22 +00:00
|
|
|
void reverse();
|
2014-04-24 14:40:10 +00:00
|
|
|
Point first_point() const;
|
|
|
|
Point last_point() const;
|
2014-03-09 19:19:30 +00:00
|
|
|
void intersect_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
|
|
|
|
void subtract_expolygons(const ExPolygonCollection &collection, ExtrusionEntityCollection* retval) const;
|
2013-11-21 17:03:40 +00:00
|
|
|
void clip_end(double distance);
|
2013-11-21 19:25:24 +00:00
|
|
|
void simplify(double tolerance);
|
2013-11-21 17:03:40 +00:00
|
|
|
double length() const;
|
2014-05-08 09:07:37 +00:00
|
|
|
bool is_perimeter() const;
|
|
|
|
bool is_fill() const;
|
|
|
|
bool is_bridge() const;
|
2014-04-07 23:43:02 +00:00
|
|
|
std::string gcode(Extruder* extruder, double e, double F,
|
2014-04-01 13:54:57 +00:00
|
|
|
double xofs, double yofs, std::string extrusion_axis,
|
|
|
|
std::string gcode_line_suffix) const;
|
2014-05-08 09:07:37 +00:00
|
|
|
|
2013-11-21 16:53:50 +00:00
|
|
|
private:
|
2014-03-09 19:19:30 +00:00
|
|
|
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
2014-05-08 09:07:37 +00:00
|
|
|
typedef std::vector<ExtrusionPath> ExtrusionPaths;
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
class ExtrusionLoop : public ExtrusionEntity
|
|
|
|
{
|
|
|
|
public:
|
2014-05-08 09:07:37 +00:00
|
|
|
ExtrusionPaths paths;
|
2014-05-07 10:02:09 +00:00
|
|
|
|
2014-05-08 09:07:37 +00:00
|
|
|
operator Polygon() const;
|
2013-08-29 09:47:59 +00:00
|
|
|
ExtrusionLoop* clone() const;
|
2014-05-08 09:07:37 +00:00
|
|
|
bool make_clockwise();
|
2013-08-28 23:40:42 +00:00
|
|
|
bool make_counter_clockwise();
|
2013-08-29 09:47:59 +00:00
|
|
|
void reverse();
|
2014-04-24 14:40:10 +00:00
|
|
|
Point first_point() const;
|
|
|
|
Point last_point() const;
|
2014-05-07 10:02:09 +00:00
|
|
|
void polygon(Polygon* polygon) const;
|
2014-05-08 09:07:37 +00:00
|
|
|
double length() const;
|
|
|
|
void split_at(const Point &point);
|
|
|
|
void clip_end(double distance, ExtrusionPaths* paths) const;
|
|
|
|
bool has_overhang_point(const Point &point) const;
|
2013-07-15 10:14:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|