mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-11 16:29:00 +08:00
Added wipe tower weight into G-code metadata
This commit is contained in:
parent
01502f6a14
commit
64a9b546fd
4
deps/+LibBGCode/LibBGCode.cmake
vendored
4
deps/+LibBGCode/LibBGCode.cmake
vendored
@ -1,8 +1,8 @@
|
||||
set(LibBGCode_SOURCE_DIR "" CACHE PATH "Optionally specify local LibBGCode source directory")
|
||||
|
||||
set(_source_dir_line
|
||||
URL https://github.com/prusa3d/libbgcode/archive/04556c4f64d4b7a5942d8d193d1eb87fc7e1005f.zip
|
||||
URL_HASH SHA256=f0745b2dae95f0a49ae75bfbe4d775c751499fc4245864675e2dab06c13b2c8f
|
||||
URL https://github.com/prusa3d/libbgcode/archive/bc390aab4427589a6402b4c7f65cf4d0a8f987ec.zip
|
||||
URL_HASH SHA256=0c86cb67232089728233014f937e2a07d133a61e31dd8811a9c905e563a49f24
|
||||
)
|
||||
|
||||
if (LibBGCode_SOURCE_DIR)
|
||||
|
@ -776,8 +776,10 @@ namespace DoExport {
|
||||
print_statistics.total_used_filament += used_filament;
|
||||
print_statistics.total_extruded_volume += extruded_volume;
|
||||
print_statistics.total_wipe_tower_filament += has_wipe_tower ? used_filament - extruder.used_filament() : 0.;
|
||||
print_statistics.total_wipe_tower_filament_weight += has_wipe_tower ? (extruded_volume - extruder.extruded_volume()) * extruder.filament_density() * 0.001 : 0.;
|
||||
print_statistics.total_wipe_tower_cost += has_wipe_tower ? (extruded_volume - extruder.extruded_volume())* extruder.filament_density() * 0.001 * extruder.filament_cost() * 0.001 : 0.;
|
||||
}
|
||||
|
||||
if (!export_binary_data) {
|
||||
filament_stats_string_out += out_filament_used_mm.first;
|
||||
filament_stats_string_out += "\n" + out_filament_used_cm3.first;
|
||||
@ -1414,6 +1416,7 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail
|
||||
file.write("\n");
|
||||
file.write_format(PrintStatistics::TotalFilamentUsedGValueMask.c_str(), print.m_print_statistics.total_weight);
|
||||
file.write_format(PrintStatistics::TotalFilamentCostValueMask.c_str(), print.m_print_statistics.total_cost);
|
||||
file.write_format(PrintStatistics::TotalFilamentUsedWipeTowerValueMask.c_str(), print.m_print_statistics.total_wipe_tower_filament_weight);
|
||||
if (print.m_print_statistics.total_toolchanges > 0)
|
||||
file.write_format("; total toolchanges = %i\n", print.m_print_statistics.total_toolchanges);
|
||||
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
||||
|
@ -3695,6 +3695,8 @@ void GCodeProcessor::post_process()
|
||||
filament_total_cost += filament_cost[id];
|
||||
}
|
||||
|
||||
double total_g_wipe_tower = m_print->print_statistics().total_wipe_tower_filament_weight;
|
||||
|
||||
if (m_binarizer.is_enabled()) {
|
||||
// update print metadata
|
||||
auto stringify = [](const std::vector<double>& values) {
|
||||
@ -3715,11 +3717,13 @@ void GCodeProcessor::post_process()
|
||||
binary_data.print_metadata.raw_data.emplace_back(PrintStatistics::FilamentCost, stringify(filament_cost));
|
||||
binary_data.print_metadata.raw_data.emplace_back(PrintStatistics::TotalFilamentUsedG, stringify({ filament_total_g }));
|
||||
binary_data.print_metadata.raw_data.emplace_back(PrintStatistics::TotalFilamentCost, stringify({ filament_total_cost }));
|
||||
binary_data.print_metadata.raw_data.emplace_back(PrintStatistics::TotalFilamentUsedWipeTower, stringify({ total_g_wipe_tower }));
|
||||
|
||||
binary_data.printer_metadata.raw_data.emplace_back(PrintStatistics::FilamentUsedMm, stringify(filament_mm)); // duplicated into print metadata
|
||||
binary_data.printer_metadata.raw_data.emplace_back(PrintStatistics::FilamentUsedG, stringify(filament_g)); // duplicated into print metadata
|
||||
binary_data.printer_metadata.raw_data.emplace_back(PrintStatistics::FilamentCost, stringify(filament_cost)); // duplicated into print metadata
|
||||
binary_data.printer_metadata.raw_data.emplace_back(PrintStatistics::FilamentUsedCm3, stringify(filament_cm3)); // duplicated into print metadata
|
||||
binary_data.printer_metadata.raw_data.emplace_back(PrintStatistics::TotalFilamentUsedWipeTower, stringify({ total_g_wipe_tower })); // duplicated into print metadata
|
||||
|
||||
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
||||
const TimeMachine& machine = m_time_processor.machines[i];
|
||||
|
@ -1621,6 +1621,11 @@ const std::string PrintStatistics::TotalFilamentCost = "total filament
|
||||
const std::string PrintStatistics::TotalFilamentCostMask = "; total filament cost =";
|
||||
const std::string PrintStatistics::TotalFilamentCostValueMask = "; total filament cost = %.2lf\n";
|
||||
|
||||
const std::string PrintStatistics::TotalFilamentUsedWipeTower = "total filament used for wipe tower [g]";
|
||||
const std::string PrintStatistics::TotalFilamentUsedWipeTowerValueMask = "; total filament used for wipe tower [g] = %.2lf\n";
|
||||
|
||||
|
||||
|
||||
DynamicConfig PrintStatistics::config() const
|
||||
{
|
||||
DynamicConfig config;
|
||||
|
@ -505,6 +505,7 @@ struct PrintStatistics
|
||||
double total_weight;
|
||||
double total_wipe_tower_cost;
|
||||
double total_wipe_tower_filament;
|
||||
double total_wipe_tower_filament_weight;
|
||||
std::vector<unsigned int> printing_extruders;
|
||||
unsigned int initial_extruder_id;
|
||||
std::string initial_filament_type;
|
||||
@ -526,6 +527,7 @@ struct PrintStatistics
|
||||
total_weight = 0.;
|
||||
total_wipe_tower_cost = 0.;
|
||||
total_wipe_tower_filament = 0.;
|
||||
total_wipe_tower_filament_weight = 0.;
|
||||
initial_extruder_id = 0;
|
||||
initial_filament_type.clear();
|
||||
printing_filament_types.clear();
|
||||
@ -547,6 +549,8 @@ struct PrintStatistics
|
||||
static const std::string TotalFilamentCost;
|
||||
static const std::string TotalFilamentCostMask;
|
||||
static const std::string TotalFilamentCostValueMask;
|
||||
static const std::string TotalFilamentUsedWipeTower;
|
||||
static const std::string TotalFilamentUsedWipeTowerValueMask;
|
||||
};
|
||||
|
||||
using PrintObjectPtrs = std::vector<PrintObject*>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user