OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{GCodeStatistics.cpp} Namespace Reference

Classes

struct  Usage

Typedefs

using json = nlohmann::ordered_json

Functions

double rounded (double value, int decimals)
double weight_of (const GCodeProcessorResult &result, size_t filament, double volume)
json features_json (const std::map< ExtrusionRole, Usage > &features)

Typedef Documentation

◆ json

using Slic3r::anonymous_namespace{GCodeStatistics.cpp}::json = nlohmann::ordered_json

Function Documentation

◆ features_json()

json Slic3r::anonymous_namespace{GCodeStatistics.cpp}::features_json ( const std::map< ExtrusionRole, Usage > & features)
60{
61 json out = json::object();
62 for (const auto &[role, usage] : features)
63 out[ExtrusionEntity::role_to_string(role)] = usage.to_json();
64 return out;
65}
static std::string role_to_string(ExtrusionRole role)
Definition ExtrusionEntity.cpp:673
nlohmann::ordered_json json
Definition GCodeStatistics.cpp:27

References features_json(), and Slic3r::ExtrusionEntity::role_to_string().

Referenced by features_json().

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

◆ rounded()

double Slic3r::anonymous_namespace{GCodeStatistics.cpp}::rounded ( double value,
int decimals )
30{
31 const double scale = std::pow(10., decimals);
32 return std::round(value * scale) / scale;
33}
int scale(const int val)
Definition WipeTowerDialog.cpp:58

References rounded(), and scale().

Referenced by rounded(), and Slic3r::anonymous_namespace{GCodeStatistics.cpp}::Usage::to_json().

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

◆ weight_of()

double Slic3r::anonymous_namespace{GCodeStatistics.cpp}::weight_of ( const GCodeProcessorResult & result,
size_t filament,
double volume )
37{
38 const bool has_density = filament < result.filament_densities.size() && result.filament_densities[filament] > 0.f;
39 // mm³ at g/cm³ weigh mg.
40 return 0.001 * volume * (has_density ? result.filament_densities[filament] : DEFAULT_FILAMENT_DENSITY);
41}
constexpr float DEFAULT_FILAMENT_DENSITY
Definition GCodeProcessor.hpp:42
std::vector< float > filament_densities
Definition GCodeProcessor.hpp:368

References Slic3r::DEFAULT_FILAMENT_DENSITY, Slic3r::GCodeProcessorResult::filament_densities, and weight_of().

Referenced by weight_of().

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