Merge branch 'master' into lm_tm_hollowing

This commit is contained in:
Lukas Matena 2019-12-20 10:33:53 +01:00
commit b3f15b1c98
68 changed files with 1399 additions and 917 deletions

View file

@ -470,6 +470,7 @@ public:
const Geometry::Transformation& get_transformation() const { return m_transformation; }
void set_transformation(const Geometry::Transformation& transformation) { m_transformation = transformation; }
void set_transformation(const Transform3d &trafo) { m_transformation.set_from_transform(trafo); }
const Vec3d& get_offset() const { return m_transformation.get_offset(); }
double get_offset(Axis axis) const { return m_transformation.get_offset(axis); }
@ -753,33 +754,30 @@ public:
// Extensions for color print
struct CustomGCode
{
CustomGCode(double height, const std::string& code, int extruder, const std::string& color) :
height(height), gcode(code), extruder(extruder), color(color) {}
bool operator<(const CustomGCode& other) const { return other.height > this->height; }
bool operator<(const CustomGCode& other) const { return other.print_z > this->print_z; }
bool operator==(const CustomGCode& other) const
{
return (other.height == this->height) &&
(other.gcode == this->gcode) &&
(other.extruder == this->extruder )&&
(other.color == this->color );
return (other.print_z == this->print_z ) &&
(other.gcode == this->gcode ) &&
(other.extruder == this->extruder ) &&
(other.color == this->color );
}
bool operator!=(const CustomGCode& other) const
{
return (other.height != this->height) ||
(other.gcode != this->gcode) ||
(other.extruder != this->extruder )||
(other.color != this->color );
return (other.print_z != this->print_z ) ||
(other.gcode != this->gcode ) ||
(other.extruder != this->extruder ) ||
(other.color != this->color );
}
double height;
double print_z;
std::string gcode;
int extruder; // 0 - "gcode" will be applied for whole print
// else - "gcode" will be applied only for "extruder" print
std::string color; // if gcode is equal to PausePrintCode,
// this field is used for save a short message shown on Printer display
};
std::vector<CustomGCode> custom_gcode_per_height;
std::vector<CustomGCode> custom_gcode_per_print_z;
// Default constructor assigns a new ID to the model.
Model() { assert(this->id().valid()); }
@ -845,7 +843,7 @@ public:
// Propose an output path, replace extension. The new_extension shall contain the initial dot.
std::string propose_export_file_name_and_path(const std::string &new_extension) const;
// from custom_gcode_per_height get just tool_change codes
// from custom_gcode_per_print_z get just tool_change codes
std::vector<std::pair<double, DynamicPrintConfig>> get_custom_tool_changes(double default_layer_height, size_t num_extruders) const;
private:
@ -881,6 +879,10 @@ extern bool model_volume_list_changed(const ModelObject &model_object_old, const
extern bool model_has_multi_part_objects(const Model &model);
// If the model has advanced features, then it cannot be processed in simple mode.
extern bool model_has_advanced_features(const Model &model);
/* If loaded configuration has a "colorprint_heights" option (if it was imported from older Slicer),
* then model.custom_gcode_per_print_z should be updated considering this option
* */
extern void update_custom_gcode_per_print_z_from_config(std::vector<Model::CustomGCode>& custom_gcode_per_print_z, DynamicPrintConfig* config);
#ifndef NDEBUG
// Verify whether the IDs of Model / ModelObject / ModelVolume / ModelInstance / ModelMaterial are valid and unique.