Set custom color for color change

This commit is contained in:
YuSanka 2019-11-04 13:42:47 +01:00
parent c564f693e9
commit d5f7956a55
5 changed files with 150 additions and 142 deletions

View file

@ -749,27 +749,30 @@ public:
// Extensions for color print
struct CustomGCode
{
CustomGCode(double height, const std::string& code, int extruder) :
height(height), gcode(code), extruder(extruder) {}
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.height == this->height) &&
(other.gcode == this->gcode) &&
(other.extruder == this->extruder );
(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.extruder != this->extruder )||
(other.color != this->color );
}
double height;
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;
};
std::vector<CustomGCode> custom_gcode_per_height;