mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-28 11:11:16 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
cc7b0297a0
20 changed files with 295 additions and 154 deletions
|
|
@ -362,12 +362,11 @@ protected:
|
|||
bool m_second_layer_things_done;
|
||||
// Index of a last object copy extruded.
|
||||
std::pair<const PrintObject*, Point> m_last_obj_copy;
|
||||
/* Extensions for colorprint - now it's not a just color_print_heights,
|
||||
* there can be some custom gcode.
|
||||
* Updated before the export and erased during the process,
|
||||
* so no toolchange occurs twice.
|
||||
* */
|
||||
std::vector<Model::CustomGCode> m_custom_gcode_per_print_z;
|
||||
// Extensions for colorprint - now it's not a just color_print_heights,
|
||||
// there can be some custom gcode.
|
||||
// Updated before the export and erased during the process,
|
||||
// so no toolchange occurs twice.
|
||||
std::vector<Model::CustomGCode> m_custom_gcode_per_print_z;
|
||||
|
||||
// Time estimators
|
||||
GCodeTimeEstimator m_normal_time_estimator;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ Model& Model::assign_copy(Model &&rhs)
|
|||
rhs.objects.clear();
|
||||
|
||||
// copy custom code per height
|
||||
this->custom_gcode_per_print_z = rhs.custom_gcode_per_print_z;
|
||||
this->custom_gcode_per_print_z = std::move(rhs.custom_gcode_per_print_z);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -1946,25 +1946,23 @@ extern bool model_has_advanced_features(const Model &model)
|
|||
|
||||
extern void update_custom_gcode_per_print_z_from_config(std::vector<Model::CustomGCode>& custom_gcode_per_print_z, DynamicPrintConfig* config)
|
||||
{
|
||||
if (!config->has("colorprint_heights"))
|
||||
auto *colorprint_heights = config->option<ConfigOptionFloats>("colorprint_heights");
|
||||
if (colorprint_heights == nullptr)
|
||||
return;
|
||||
|
||||
const std::vector<std::string>& colors = GCodePreviewData::ColorPrintColors();
|
||||
|
||||
const auto& colorprint_values = config->option<ConfigOptionFloats>("colorprint_heights")->values;
|
||||
|
||||
if (!colorprint_values.empty())
|
||||
{
|
||||
if (custom_gcode_per_print_z.empty() && ! colorprint_heights->values.empty()) {
|
||||
// Convert the old colorprint_heighs only if there is no equivalent data in a new format.
|
||||
const std::vector<std::string>& colors = GCodePreviewData::ColorPrintColors();
|
||||
const auto& colorprint_values = colorprint_heights->values;
|
||||
custom_gcode_per_print_z.clear();
|
||||
custom_gcode_per_print_z.reserve(colorprint_values.size());
|
||||
int i = 0;
|
||||
for (auto val : colorprint_values)
|
||||
custom_gcode_per_print_z.emplace_back(Model::CustomGCode{ val, ColorChangeCode, 1, colors[(++i)%7] });
|
||||
}
|
||||
}
|
||||
|
||||
/* There is one and only place this configuration option is used now.
|
||||
* It wouldn't be used in the future, so erase it.
|
||||
* */
|
||||
// The "colorprint_heights" config value has been deprecated. At this point of time it has been converted
|
||||
// to a new format and therefore it shall be erased.
|
||||
config->erase("colorprint_heights");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -755,21 +755,15 @@ public:
|
|||
// Extensions for color print
|
||||
struct CustomGCode
|
||||
{
|
||||
bool operator<(const CustomGCode& other) const { return other.print_z > this->print_z; }
|
||||
bool operator==(const CustomGCode& other) const
|
||||
bool operator<(const CustomGCode& rhs) const { return this->print_z < rhs.print_z; }
|
||||
bool operator==(const CustomGCode& rhs) const
|
||||
{
|
||||
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.print_z != this->print_z ) ||
|
||||
(other.gcode != this->gcode ) ||
|
||||
(other.extruder != this->extruder ) ||
|
||||
(other.color != this->color );
|
||||
return (rhs.print_z == this->print_z ) &&
|
||||
(rhs.gcode == this->gcode ) &&
|
||||
(rhs.extruder == this->extruder ) &&
|
||||
(rhs.color == this->color );
|
||||
}
|
||||
bool operator!=(const CustomGCode& rhs) const { return ! (*this == rhs); }
|
||||
|
||||
double print_z;
|
||||
std::string gcode;
|
||||
|
|
@ -880,9 +874,9 @@ 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
|
||||
* */
|
||||
// If loaded configuration has a "colorprint_heights" option (if it was imported from older Slicer),
|
||||
// and if model.custom_gcode_per_print_z is empty (there is no color print data available in a new format
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -1333,9 +1333,11 @@ void PrintConfigDef::init_fff_params()
|
|||
def->enum_values.push_back("octoprint");
|
||||
def->enum_values.push_back("duet");
|
||||
def->enum_values.push_back("flashair");
|
||||
def->enum_values.push_back("astrobox");
|
||||
def->enum_labels.push_back("OctoPrint");
|
||||
def->enum_labels.push_back("Duet");
|
||||
def->enum_labels.push_back("FlashAir");
|
||||
def->enum_values.push_back("AstroBox");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));
|
||||
|
||||
|
|
@ -3433,7 +3435,8 @@ CLIMiscConfigDef::CLIMiscConfigDef()
|
|||
|
||||
def = this->add("loglevel", coInt);
|
||||
def->label = L("Logging level");
|
||||
def->tooltip = L("Messages with severity lower or eqal to the loglevel will be printed out. 0:trace, 1:debug, 2:info, 3:warning, 4:error, 5:fatal");
|
||||
def->tooltip = L("Sets logging sensitivity. 0:fatal, 1:error, 2:warning, 3:info, 4:debug, 5:trace\n"
|
||||
"For example. loglevel=2 logs fatal, error and warning level messages.");
|
||||
def->min = 0;
|
||||
|
||||
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(SLIC3R_GUI)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ enum GCodeFlavor : unsigned char {
|
|||
};
|
||||
|
||||
enum PrintHostType {
|
||||
htOctoPrint, htDuet, htFlashAir
|
||||
htOctoPrint, htDuet, htFlashAir, htAstroBox
|
||||
};
|
||||
|
||||
enum InfillPattern {
|
||||
|
|
@ -103,6 +103,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<PrintHostType>::g
|
|||
keys_map["octoprint"] = htOctoPrint;
|
||||
keys_map["duet"] = htDuet;
|
||||
keys_map["flashair"] = htFlashAir;
|
||||
keys_map["astrobox"] = htAstroBox;
|
||||
}
|
||||
return keys_map;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue