2013-12-20 00:36:42 +00:00
|
|
|
#ifndef slic3r_Print_hpp_
|
|
|
|
#define slic3r_Print_hpp_
|
|
|
|
|
2014-05-08 12:52:48 +00:00
|
|
|
#include <myinit.h>
|
2013-12-20 00:36:42 +00:00
|
|
|
#include <set>
|
2014-05-06 08:07:18 +00:00
|
|
|
#include <vector>
|
|
|
|
#include "PrintConfig.hpp"
|
|
|
|
#include "Point.hpp"
|
|
|
|
#include "Layer.hpp"
|
|
|
|
#include "PlaceholderParser.hpp"
|
|
|
|
|
2013-12-20 00:36:42 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
class Print;
|
|
|
|
class ModelObject;
|
|
|
|
|
|
|
|
|
2013-12-20 00:36:42 +00:00
|
|
|
enum PrintStep {
|
2014-06-10 22:15:02 +00:00
|
|
|
psInitExtruders, psSkirt, psBrim,
|
|
|
|
};
|
|
|
|
enum PrintObjectStep {
|
|
|
|
posSlice, posPerimeters, posPrepareInfill,
|
|
|
|
posInfill, posSupportMaterial,
|
2013-12-20 00:36:42 +00:00
|
|
|
};
|
|
|
|
|
2014-06-10 22:15:02 +00:00
|
|
|
template <class StepType>
|
2013-12-20 00:36:42 +00:00
|
|
|
class PrintState
|
|
|
|
{
|
|
|
|
public:
|
2014-06-13 09:19:53 +00:00
|
|
|
std::set<StepType> started, done;
|
|
|
|
|
|
|
|
bool is_started(StepType step) const;
|
|
|
|
bool is_done(StepType step) const;
|
2014-06-10 22:15:02 +00:00
|
|
|
void set_started(StepType step);
|
|
|
|
void set_done(StepType step);
|
2014-06-13 09:19:53 +00:00
|
|
|
bool invalidate(StepType step);
|
2013-12-20 00:36:42 +00:00
|
|
|
};
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
// A PrintRegion object represents a group of volumes to print
|
|
|
|
// sharing the same config (including the same assigned extruder(s))
|
|
|
|
class PrintRegion
|
|
|
|
{
|
|
|
|
friend class Print;
|
|
|
|
|
|
|
|
public:
|
|
|
|
PrintRegionConfig config;
|
|
|
|
|
2014-05-19 20:38:10 +00:00
|
|
|
Print* print();
|
2014-05-06 08:07:18 +00:00
|
|
|
|
|
|
|
private:
|
2014-05-19 20:38:10 +00:00
|
|
|
Print* _print;
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
PrintRegion(Print* print);
|
2014-06-10 14:01:57 +00:00
|
|
|
~PrintRegion();
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::vector<Layer*> LayerPtrs;
|
|
|
|
typedef std::vector<SupportLayer*> SupportLayerPtrs;
|
|
|
|
class BoundingBoxf3; // TODO: for temporary constructor parameter
|
|
|
|
|
|
|
|
class PrintObject
|
|
|
|
{
|
|
|
|
friend class Print;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// vector of (vectors of volume ids), indexed by region_id
|
|
|
|
std::vector<std::vector<int> > region_volumes;
|
|
|
|
Points copies; // Slic3r::Point objects in scaled G-code coordinates
|
|
|
|
PrintObjectConfig config;
|
|
|
|
t_layer_height_ranges layer_height_ranges;
|
|
|
|
|
|
|
|
Point3 size; // XYZ in scaled coordinates
|
|
|
|
|
|
|
|
// scaled coordinates to add to copies (to compensate for the alignment
|
|
|
|
// operated when creating the object but still preserving a coherent API
|
|
|
|
// for external callers)
|
|
|
|
Point _copies_shift;
|
|
|
|
|
|
|
|
// Slic3r::Point objects in scaled G-code coordinates in our coordinates
|
|
|
|
Points _shifted_copies;
|
|
|
|
|
|
|
|
LayerPtrs layers;
|
|
|
|
SupportLayerPtrs support_layers;
|
|
|
|
// TODO: Fill* fill_maker => (is => 'lazy');
|
2014-06-10 22:15:02 +00:00
|
|
|
PrintState<PrintObjectStep> state;
|
2014-06-10 14:01:57 +00:00
|
|
|
|
2014-05-19 20:38:10 +00:00
|
|
|
Print* print();
|
|
|
|
ModelObject* model_object();
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
// adds region_id, too, if necessary
|
|
|
|
void add_region_volume(int region_id, int volume_id);
|
|
|
|
|
|
|
|
size_t layer_count();
|
|
|
|
void clear_layers();
|
|
|
|
Layer* get_layer(int idx);
|
2014-06-10 14:01:57 +00:00
|
|
|
Layer* add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
|
2014-05-06 08:07:18 +00:00
|
|
|
void delete_layer(int idx);
|
|
|
|
|
|
|
|
size_t support_layer_count();
|
|
|
|
void clear_support_layers();
|
|
|
|
SupportLayer* get_support_layer(int idx);
|
2014-06-10 14:01:57 +00:00
|
|
|
SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
|
2014-05-06 08:07:18 +00:00
|
|
|
void delete_support_layer(int idx);
|
2014-06-10 22:15:02 +00:00
|
|
|
|
|
|
|
// methods for handling state
|
|
|
|
bool invalidate_state_by_config_options(const std::vector<t_config_option_key> &opt_keys);
|
2014-06-13 09:19:53 +00:00
|
|
|
bool invalidate_step(PrintObjectStep step);
|
|
|
|
bool invalidate_all_steps();
|
2014-06-10 22:15:02 +00:00
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
private:
|
2014-05-19 20:38:10 +00:00
|
|
|
Print* _print;
|
|
|
|
ModelObject* _model_object;
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
// TODO: call model_object->get_bounding_box() instead of accepting
|
|
|
|
// parameter
|
2014-06-10 14:01:57 +00:00
|
|
|
PrintObject(Print* print, ModelObject* model_object, const BoundingBoxf3 &modobj_bbox);
|
|
|
|
~PrintObject();
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<PrintObject*> PrintObjectPtrs;
|
|
|
|
typedef std::vector<PrintRegion*> PrintRegionPtrs;
|
|
|
|
|
|
|
|
class Print
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PrintConfig config;
|
|
|
|
PrintObjectConfig default_object_config;
|
|
|
|
PrintRegionConfig default_region_config;
|
|
|
|
PrintObjectPtrs objects;
|
|
|
|
PrintRegionPtrs regions;
|
|
|
|
PlaceholderParser placeholder_parser;
|
|
|
|
// TODO: status_cb
|
2014-06-10 14:01:57 +00:00
|
|
|
double total_used_filament, total_extruded_volume;
|
2014-06-10 22:15:02 +00:00
|
|
|
PrintState<PrintStep> state;
|
2014-05-06 08:07:18 +00:00
|
|
|
|
2014-06-10 14:01:57 +00:00
|
|
|
// ordered collections of extrusion paths to build skirt loops and brim
|
|
|
|
ExtrusionEntityCollection skirt, brim;
|
2014-05-06 08:07:18 +00:00
|
|
|
|
|
|
|
Print();
|
2014-06-10 14:01:57 +00:00
|
|
|
~Print();
|
|
|
|
|
|
|
|
// methods for handling objects
|
2014-05-06 08:07:18 +00:00
|
|
|
void clear_objects();
|
2014-06-10 14:01:57 +00:00
|
|
|
PrintObject* get_object(size_t idx);
|
|
|
|
PrintObject* add_object(ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
|
|
|
PrintObject* set_new_object(size_t idx, ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
|
|
|
void delete_object(size_t idx);
|
|
|
|
|
|
|
|
// methods for handling regions
|
|
|
|
PrintRegion* get_region(size_t idx);
|
2014-05-06 08:07:18 +00:00
|
|
|
PrintRegion* add_region();
|
2014-06-10 22:15:02 +00:00
|
|
|
|
|
|
|
// methods for handling state
|
|
|
|
bool invalidate_state_by_config_options(const std::vector<t_config_option_key> &opt_keys);
|
2014-06-13 09:19:53 +00:00
|
|
|
bool invalidate_step(PrintStep step);
|
|
|
|
bool invalidate_all_steps();
|
2014-05-24 21:10:20 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void clear_regions();
|
2014-06-10 14:01:57 +00:00
|
|
|
void delete_region(size_t idx);
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|
|
|
|
|
2013-12-20 00:36:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|