OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::PrintStatisticsConfigDef Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/PrintConfig.hpp>

Inheritance diagram for Slic3r::PrintStatisticsConfigDef:
Collaboration diagram for Slic3r::PrintStatisticsConfigDef:

Public Member Functions

 PrintStatisticsConfigDef ()
bool has (const t_config_option_key &opt_key) const
const ConfigOptionDef * get (const t_config_option_key &opt_key) const
std::vector< std::string > keys () const
bool empty ()
std::ostream & print_cli_help (std::ostream &out, bool show_defaults, std::function< bool(const ConfigOptionDef &)> filter=[](const ConfigOptionDef &){ return true;}) const

Public Attributes

t_optiondef_map options
std::map< size_t, const ConfigOptionDef * > by_serialization_key_ordinal

Protected Member Functions

ConfigOptionDef * add (const t_config_option_key &opt_key, ConfigOptionType type)
ConfigOptionDef * add_nullable (const t_config_option_key &opt_key, ConfigOptionType type)

Detailed Description

Constructor & Destructor Documentation

◆ PrintStatisticsConfigDef()

Slic3r::PrintStatisticsConfigDef::PrintStatisticsConfigDef ( )
13391{
13392 ConfigOptionDef* def;
13393
13394 def = this->add("extruded_volume", coFloats);
13395 def->label = L("Volume per extruder");
13396 def->tooltip = L("Total filament volume extruded per extruder during the entire print.");
13397
13398 def = this->add("total_toolchanges", coInt);
13399 def->label = L("Total tool changes");
13400 def->tooltip = L("Number of tool changes during the print.");
13401
13402 def = this->add("extruded_volume_total", coFloat);
13403 def->label = L("Total volume");
13404 def->tooltip = L("Total volume of filament used during the entire print.");
13405
13406 def = this->add("extruded_weight", coFloats);
13407 def->label = L("Weight per extruder");
13408 def->tooltip = L("Weight per extruder extruded during the entire print. Calculated from filament_density value in Filament Settings.");
13409
13410 def = this->add("extruded_weight_total", coFloat);
13411 def->label = L("Total weight");
13412 def->tooltip = L("Total weight of the print. Calculated from filament_density value in Filament Settings.");
13413
13414 def = this->add("total_layer_count", coInt);
13415 def->label = L("Total layer count");
13416 def->tooltip = L("Number of layers in the entire print.");
13417
13418 def = this->add("normal_print_time", coString);
13419 def->label = L("Print time (normal mode)");
13420 def->tooltip = L("Estimated print time when printed in normal mode (i.e. not in silent mode). Same as print_time.");
13421
13422 //def = this->add("num_printing_extruders", coInt);
13423 //def->label = L("Number of printing extruders");
13424 //def->tooltip = L("Number of extruders used during the print.");
13425
13426 def = this->add("print_time", coString);
13427 def->label = L("Print time (normal mode)");
13428 def->tooltip = L("Estimated print time when printed in normal mode (i.e. not in silent mode). Same as normal_print_time.");
13429
13430 //def = this->add("printing_filament_types", coString);
13431 //def->label = L("Used filament types");
13432 //def->tooltip = L("Comma-separated list of all filament types used during the print.");
13433
13434 def = this->add("silent_print_time", coString);
13435 def->label = L("Print time (silent mode)");
13436 def->tooltip = L("Estimated print time when printed in silent mode.");
13437
13438 def = this->add("total_cost", coFloat);
13439 def->label = L("Total cost");
13440 def->tooltip = L("Total cost of all material used in the print. Calculated from filament_cost value in Filament Settings.");
13441
13442 def = this->add("total_weight", coFloat);
13443 def->label = L("Total weight");
13444 def->tooltip = L("Total weight of the print. Calculated from filament_density value in Filament Settings.");
13445
13446 def = this->add("total_wipe_tower_cost", coFloat);
13447 def->label = L("Total wipe tower cost");
13448 def->tooltip = L("Total cost of the material wasted on the wipe tower. Calculated from filament_cost value in Filament Settings.");
13449
13450 def = this->add("total_wipe_tower_filament", coFloat);
13451 def->label = L("Total wipe tower filament");
13452 def->tooltip = L("Total length of filament used on the wipe tower, in mm.");
13453
13454 def = this->add("used_filament", coFloat);
13455 def->label = L("Used filament");
13456 def->tooltip = L("Total length of filament used in the print.");
13457
13458 def = this->add("print_time_total_sec", coString);
13459 def->label = L("Print time (total seconds)");
13460 def->tooltip = L("Total estimated print time in seconds. Replaced with actual value during post-processing.");
13461
13462 def = this->add("print_time_day", coString);
13463 def->label = L("Print time (days component)");
13464 def->tooltip = L("Estimated print time day component (normal mode). Replaced with actual value during post-processing.");
13465
13466 def = this->add("print_time_hour", coString);
13467 def->label = L("Print time (hours component)");
13468 def->tooltip = L("Estimated print time hour component (normal mode). Replaced with actual value during post-processing.");
13469
13470 def = this->add("print_time_minute", coString);
13471 def->label = L("Print time (minutes component)");
13472 def->tooltip = L("Estimated print time minute component (normal mode). Replaced with actual value during post-processing.");
13473
13474 def = this->add("print_time_sec", coString);
13475 def->label = L("Print time (seconds component)");
13476 def->tooltip = L("Estimated print time second component (normal mode). Replaced with actual value during post-processing.");
13477
13478 def = this->add("used_filament_length", coString);
13479 def->label = L("Filament length (meters)");
13480 def->tooltip = L("Total filament length used in meters. Replaced with actual value during post-processing.");
13481}
#define L(s)
Definition ExtrusionEntity.cpp:25
ConfigOptionDef * add(const t_config_option_key &opt_key, ConfigOptionType type)
Definition Config.cpp:363
@ coString
Definition Config.hpp:192
@ coInt
Definition Config.hpp:188
@ coFloat
Definition Config.hpp:184
@ coFloats
Definition Config.hpp:186

References Slic3r::ConfigDef::add(), Slic3r::coFloat, Slic3r::coFloats, Slic3r::coInt, Slic3r::coString, L, Slic3r::ConfigOptionDef::label, and Slic3r::ConfigOptionDef::tooltip.

Here is the call graph for this function:

Member Function Documentation

◆ add()

ConfigOptionDef * Slic3r::ConfigDef::add ( const t_config_option_key & opt_key,
ConfigOptionType type )
protectedinherited
364{
365 static size_t serialization_key_ordinal_last = 0;
366 ConfigOptionDef *opt = &this->options[opt_key];
367 opt->opt_key = opt_key;
368 opt->type = type;
369 opt->serialization_key_ordinal = ++ serialization_key_ordinal_last;
370 this->by_serialization_key_ordinal[opt->serialization_key_ordinal] = opt;
371 return opt;
372}
std::map< size_t, const ConfigOptionDef * > by_serialization_key_ordinal
Definition Config.hpp:2659
t_optiondef_map options
Definition Config.hpp:2658

References by_serialization_key_ordinal, and options.

Referenced by Slic3r::CLIMiscConfigDef::CLIMiscConfigDef(), Slic3r::CLITransformConfigDef::CLITransformConfigDef(), Slic3r::CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef(), Slic3r::DimensionsConfigDef::DimensionsConfigDef(), Slic3r::ObjectsInfoConfigDef::ObjectsInfoConfigDef(), Slic3r::OtherPresetsConfigDef::OtherPresetsConfigDef(), Slic3r::OtherSlicingStatesConfigDef::OtherSlicingStatesConfigDef(), Slic3r::PrintStatisticsConfigDef::PrintStatisticsConfigDef(), Slic3r::ReadOnlySlicingStatesConfigDef::ReadOnlySlicingStatesConfigDef(), Slic3r::ReadWriteSlicingStatesConfigDef::ReadWriteSlicingStatesConfigDef(), Slic3r::TimestampsConfigDef::TimestampsConfigDef(), add_nullable(), Slic3r::PrintConfigDef::init_common_params(), Slic3r::PrintConfigDef::init_fff_params(), and Slic3r::PrintConfigDef::init_sla_params().

Here is the caller graph for this function:

◆ add_nullable()

ConfigOptionDef * Slic3r::ConfigDef::add_nullable ( const t_config_option_key & opt_key,
ConfigOptionType type )
protectedinherited
375{
376 ConfigOptionDef *def = this->add(opt_key, type);
377 def->nullable = true;
378 return def;
379}

References add(), and Slic3r::ConfigOptionDef::nullable.

Referenced by Slic3r::PrintConfigDef::init_fff_params().

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

◆ empty()

bool Slic3r::ConfigDef::empty ( )
inlineinherited
2673{ return options.empty(); }

References options.

◆ get()

const ConfigOptionDef * Slic3r::ConfigDef::get ( const t_config_option_key & opt_key) const
inlineinherited

◆ has()

bool Slic3r::ConfigDef::has ( const t_config_option_key & opt_key) const
inlineinherited
2661{ return this->options.count(opt_key) > 0; }

Referenced by Slic3r::GUI::EditGCodeDialog::selection_changed().

Here is the caller graph for this function:

◆ keys()

std::vector< std::string > Slic3r::ConfigDef::keys ( ) const
inlineinherited
2666 {
2667 std::vector<std::string> out;
2668 out.reserve(options.size());
2669 for(auto const& kvp : options)
2670 out.push_back(kvp.first);
2671 return out;
2672 }

References options.

◆ print_cli_help()

std::ostream & Slic3r::ConfigDef::print_cli_help ( std::ostream & out,
bool show_defaults,
std::function< bool(const ConfigOptionDef &)> filter = [](const ConfigOptionDef &){ return true; } ) const
inherited
382{
383 // prepare a function for wrapping text
384 auto wrap = [](std::string text, size_t line_length) -> std::string {
385 std::istringstream words(text);
386 std::ostringstream wrapped;
387 std::string word;
388
389 if (words >> word) {
390 wrapped << word;
391 size_t space_left = line_length - word.length();
392 while (words >> word) {
393 if (space_left < word.length() + 1) {
394 wrapped << '\n' << word;
395 space_left = line_length - word.length();
396 } else {
397 wrapped << ' ' << word;
398 space_left -= word.length() + 1;
399 }
400 }
401 }
402 return wrapped.str();
403 };
404
405 // get the unique categories
406 std::set<std::string> categories;
407 for (const auto& opt : this->options) {
408 const ConfigOptionDef& def = opt.second;
409 if (filter(def))
410 categories.insert(def.category);
411 }
412
413 for (auto category : categories) {
414 if (category != "") {
415 out << category << ":" << std::endl;
416 } else if (categories.size() > 1) {
417 out << "Misc options:" << std::endl;
418 }
419
420 for (const auto& opt : this->options) {
421 const ConfigOptionDef& def = opt.second;
422 if (def.category != category || def.cli == ConfigOptionDef::nocli || !filter(def))
423 continue;
424
425 // get all possible variations: --foo, --foobar, -f...
426 std::vector<std::string> cli_args = def.cli_args(opt.first);
427 if (cli_args.empty())
428 continue;
429
430 for (auto& arg : cli_args) {
431 arg.insert(0, (arg.size() == 1) ? "-" : "--");
432 //BBS: refine the print help format
433 if (!def.cli_params.empty())
434 arg += " " + def.cli_params;
435 /*if ( def.type == coInt || def.type == coInts) {
436 arg += " int_value";
437 } else if (def.type == coFloat || def.type == coFloatOrPercent || def.type == coFloats) {
438 arg += " float_value";
439 } else if (def.type == coPoint) {
440 arg += " X,Y";
441 } else if (def.type == coPoint3) {
442 arg += " X,Y,Z";
443 } else if (def.type == coString || def.type == coStrings) {
444 arg += " filename_lists";
445 }*/
446 }
447
448 // left: command line options
449 const std::string cli = boost::algorithm::join(cli_args, ", ");
450 out << " " << std::left << std::setw(20) << cli;
451
452 // right: option description
453 std::string descr = def.tooltip;
454 bool show_defaults_this = show_defaults || def.opt_key == "config_compatibility";
455 if (show_defaults_this && def.default_value && def.type != coBool
456 && (def.type != coString || !def.default_value->serialize().empty())) {
457 descr += " (";
458 if (!def.sidetext.empty()) {
459 descr += def.sidetext + ", ";
460 } else if (!def.enum_values.empty()) {
461 descr += boost::algorithm::join(def.enum_values, ", ") + "; ";
462 }
463 descr += "default: " + def.default_value->serialize() + ")";
464 }
465
466 // wrap lines of description
467 descr = wrap(descr, 80);
468 std::vector<std::string> lines;
469 boost::split(lines, descr, boost::is_any_of("\n"));
470
471 // if command line options are too long, print description in new line
472 for (size_t i = 0; i < lines.size(); ++i) {
473 if (i == 0 && cli.size() > 19)
474 out << std::endl;
475 if (i > 0 || cli.size() > 19)
476 out << std::string(21, ' ');
477 out << lines[i] << std::endl;
478 }
479 }
480 }
481 return out;
482}
static const constexpr char * nocli
Definition Config.hpp:2636
@ coBool
Definition Config.hpp:210

References Slic3r::ConfigOptionDef::category, Slic3r::ConfigOptionDef::cli, Slic3r::ConfigOptionDef::cli_args(), Slic3r::ConfigOptionDef::cli_params, Slic3r::coBool, Slic3r::coString, Slic3r::ConfigOptionDef::default_value, Slic3r::ConfigOptionDef::enum_values, Slic3r::ConfigOptionDef::nocli, Slic3r::ConfigOptionDef::opt_key, options, Slic3r::ConfigOptionDef::sidetext, Slic3r::ConfigOptionDef::tooltip, and Slic3r::ConfigOptionDef::type.

Here is the call graph for this function:

Member Data Documentation

◆ by_serialization_key_ordinal

std::map<size_t, const ConfigOptionDef*> Slic3r::ConfigDef::by_serialization_key_ordinal
inherited

◆ options


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