Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::PrintStatistics Struct Reference

#include <src/libslic3r/Print.hpp>

+ Collaboration diagram for Slic3r::PrintStatistics:

Public Member Functions

 PrintStatistics ()
 
DynamicConfig config () const
 
std::string finalize_output_path (const std::string &path_in) const
 
void clear ()
 

Static Public Member Functions

static DynamicConfig placeholders ()
 

Public Attributes

std::string estimated_normal_print_time
 
std::string estimated_silent_print_time
 
double total_used_filament
 
double total_extruded_volume
 
double total_cost
 
int total_toolchanges
 
double total_weight
 
double total_wipe_tower_cost
 
double total_wipe_tower_filament
 
std::vector< unsigned int > printing_extruders
 
unsigned int initial_extruder_id
 
std::string initial_filament_type
 
std::string printing_filament_types
 
std::map< size_t, double > filament_stats
 

Detailed Description

Constructor & Destructor Documentation

◆ PrintStatistics()

Slic3r::PrintStatistics::PrintStatistics ( )
inline
494{ clear(); }
void clear()
Definition Print.hpp:517

References clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

void Slic3r::PrintStatistics::clear ( )
inline
517 {
520 total_cost = 0.;
522 total_weight = 0.;
526 initial_filament_type.clear();
528 filament_stats.clear();
529 printing_extruders.clear();
530 }
std::vector< unsigned int > printing_extruders
Definition Print.hpp:504
double total_wipe_tower_cost
Definition Print.hpp:502
unsigned int initial_extruder_id
Definition Print.hpp:505
std::map< size_t, double > filament_stats
Definition Print.hpp:508
double total_used_filament
Definition Print.hpp:497
double total_wipe_tower_filament
Definition Print.hpp:503
int total_toolchanges
Definition Print.hpp:500
double total_extruded_volume
Definition Print.hpp:498
double total_cost
Definition Print.hpp:499
std::string initial_filament_type
Definition Print.hpp:506
std::string printing_filament_types
Definition Print.hpp:507
double total_weight
Definition Print.hpp:501

References filament_stats, initial_extruder_id, initial_filament_type, printing_extruders, printing_filament_types, total_cost, total_extruded_volume, total_toolchanges, total_used_filament, total_weight, total_wipe_tower_cost, and total_wipe_tower_filament.

Referenced by PrintStatistics(), and Slic3r::DoExport::update_print_stats_and_format_filament_stats().

+ Here is the caller graph for this function:

◆ config()

DynamicConfig Slic3r::PrintStatistics::config ( ) const
1549{
1550 DynamicConfig config;
1551 std::string normal_print_time = short_time(this->estimated_normal_print_time);
1552 std::string silent_print_time = short_time(this->estimated_silent_print_time);
1553 config.set_key_value("print_time", new ConfigOptionString(normal_print_time));
1554 config.set_key_value("normal_print_time", new ConfigOptionString(normal_print_time));
1555 config.set_key_value("silent_print_time", new ConfigOptionString(silent_print_time));
1556 config.set_key_value("used_filament", new ConfigOptionFloat(this->total_used_filament / 1000.));
1557 config.set_key_value("extruded_volume", new ConfigOptionFloat(this->total_extruded_volume));
1558 config.set_key_value("total_cost", new ConfigOptionFloat(this->total_cost));
1559 config.set_key_value("total_toolchanges", new ConfigOptionInt(this->total_toolchanges));
1560 config.set_key_value("total_weight", new ConfigOptionFloat(this->total_weight));
1561 config.set_key_value("total_wipe_tower_cost", new ConfigOptionFloat(this->total_wipe_tower_cost));
1562 config.set_key_value("total_wipe_tower_filament", new ConfigOptionFloat(this->total_wipe_tower_filament));
1563 config.set_key_value("initial_tool", new ConfigOptionInt(int(this->initial_extruder_id)));
1564 config.set_key_value("initial_extruder", new ConfigOptionInt(int(this->initial_extruder_id)));
1565 config.set_key_value("initial_filament_type", new ConfigOptionString(this->initial_filament_type));
1566 config.set_key_value("printing_filament_types", new ConfigOptionString(this->printing_filament_types));
1567 config.set_key_value("num_printing_extruders", new ConfigOptionInt(int(this->printing_extruders.size())));
1568// config.set_key_value("printing_extruders", new ConfigOptionInts(std::vector<int>(this->printing_extruders.begin(), this->printing_extruders.end())));
1569
1570 return config;
1571}
bool set_key_value(const std::string &opt_key, ConfigOption *opt)
Definition Config.hpp:2431
ConfigOptionFloat
Definition PrintConfig.hpp:570
std::string short_time(const std::string &time, bool force_localization)
Definition utils.cpp:989
std::string estimated_normal_print_time
Definition Print.hpp:495
std::string estimated_silent_print_time
Definition Print.hpp:496
DynamicConfig config() const
Definition Print.cpp:1548

References config(), estimated_normal_print_time, estimated_silent_print_time, initial_extruder_id, initial_filament_type, printing_extruders, printing_filament_types, Slic3r::DynamicConfig::set_key_value(), Slic3r::short_time(), total_cost, total_extruded_volume, total_toolchanges, total_used_filament, total_weight, total_wipe_tower_cost, and total_wipe_tower_filament.

Referenced by config(), finalize_output_path(), Slic3r::Print::output_filename(), and placeholders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finalize_output_path()

std::string Slic3r::PrintStatistics::finalize_output_path ( const std::string &  path_in) const
1586{
1587 std::string final_path;
1588 try {
1589 boost::filesystem::path path(path_in);
1590 DynamicConfig cfg = this->config();
1591 PlaceholderParser pp;
1592 std::string new_stem = pp.process(path.stem().string(), 0, &cfg);
1593 final_path = (path.parent_path() / (new_stem + path.extension().string())).string();
1594 } catch (const std::exception &ex) {
1595 BOOST_LOG_TRIVIAL(error) << "Failed to apply the print statistics to the export file name: " << ex.what();
1596 final_path = path_in;
1597 }
1598 return final_path;
1599}
static char error[256]
Definition tga.cpp:50

References config(), error, and Slic3r::PlaceholderParser::process().

Referenced by Slic3r::BackgroundSlicingProcess::finalize_gcode(), Slic3r::BackgroundSlicingProcess::prepare_upload(), and Slic3r::CLI::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ placeholders()

DynamicConfig Slic3r::PrintStatistics::placeholders ( )
static
1574{
1575 DynamicConfig config;
1576 for (const std::string &key : {
1577 "print_time", "normal_print_time", "silent_print_time",
1578 "used_filament", "extruded_volume", "total_cost", "total_weight",
1579 "total_toolchanges", "total_wipe_tower_cost", "total_wipe_tower_filament",
1580 "initial_tool", "initial_extruder", "initial_filament_type", "printing_filament_types", "num_printing_extruders" })
1581 config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}"));
1582 return config;
1583}

References config(), and Slic3r::DynamicConfig::set_key_value().

Referenced by Slic3r::Print::output_filename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ estimated_normal_print_time

std::string Slic3r::PrintStatistics::estimated_normal_print_time

◆ estimated_silent_print_time

std::string Slic3r::PrintStatistics::estimated_silent_print_time

◆ filament_stats

std::map<size_t, double> Slic3r::PrintStatistics::filament_stats

◆ initial_extruder_id

unsigned int Slic3r::PrintStatistics::initial_extruder_id

◆ initial_filament_type

std::string Slic3r::PrintStatistics::initial_filament_type

◆ printing_extruders

std::vector<unsigned int> Slic3r::PrintStatistics::printing_extruders

◆ printing_filament_types

std::string Slic3r::PrintStatistics::printing_filament_types

◆ total_cost

◆ total_extruded_volume

◆ total_toolchanges

◆ total_used_filament

◆ total_weight

◆ total_wipe_tower_cost

◆ total_wipe_tower_filament

double Slic3r::PrintStatistics::total_wipe_tower_filament

The documentation for this struct was generated from the following files: