OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::PlateData Struct Reference

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

Collaboration diagram for Slic3r::PlateData:

Public Types

using LayerFilaments = std::unordered_map<std::vector<unsigned int>, std::vector<std::pair<int, int>>, GCodeProcessorResult::FilamentSequenceHash>

Public Member Functions

 PlateData (int plate_id, std::set< std::pair< int, int > > &obj_to_inst_list, bool lock_state)
 PlateData ()
 ~PlateData ()
void parse_filament_info (GCodeProcessorResult *result)
std::string get_gcode_prediction_str ()
std::string get_gcode_weight_str ()

Public Attributes

int plate_index
std::vector< std::pair< int, int > > objects_and_instances
std::map< int, std::pair< int, int > > obj_inst_map
std::string printer_model_id
std::string nozzle_diameters
std::string nozzle_volume_types
std::string gcode_file
std::string gcode_file_md5
std::string statistics
std::string thumbnail_file
std::string no_light_thumbnail_file
ThumbnailData plate_thumbnail
std::string top_file
std::string pick_file
std::string pattern_bbox_file
std::string gcode_prediction
std::string gcode_weight
std::string first_layer_time
std::string plate_name
std::vector< FilamentInfo > slice_filaments_info
std::vector< PlateMixedFilamentInfo > mixed_filaments_info
std::vector< size_t > skipped_objects
DynamicPrintConfig config
bool is_support_used {false}
bool is_sliced_valid = false
bool toolpath_outside {false}
bool is_label_object_enabled {false}
int timelapse_warning_code = 0
std::vector< int > filament_maps
LayerFilaments layer_filaments
std::vector< unsigned int > filament_change_sequence
std::vector< unsigned int > nozzle_change_sequence
std::vector< int > optimal_assignment
std::vector< MultiNozzleUtils::NozzleInfo > nozzles_info
std::optional< MultiNozzleUtils::LayeredNozzleGroupResult > nozzle_group_result
std::vector< int > limit_filament_maps
std::vector< GCodeProcessorResult::SliceWarning > warnings
bool locked

Detailed Description

Member Typedef Documentation

◆ LayerFilaments

using Slic3r::PlateData::LayerFilaments = std::unordered_map<std::vector<unsigned int>, std::vector<std::pair<int, int>>, GCodeProcessorResult::FilamentSequenceHash>

Constructor & Destructor Documentation

◆ PlateData() [1/2]

Slic3r::PlateData::PlateData ( int plate_id,
std::set< std::pair< int, int > > & obj_to_inst_list,
bool lock_state )
inline
79 : plate_index(plate_id), locked(lock_state)
80 {
82 for (std::set<std::pair<int, int>>::iterator it = obj_to_inst_list.begin(); it != obj_to_inst_list.end(); ++it)
83 objects_and_instances.emplace_back(it->first, it->second);
84 }
bool locked
Definition bbs_3mf.hpp:158
std::vector< std::pair< int, int > > objects_and_instances
Definition bbs_3mf.hpp:97
int plate_index
Definition bbs_3mf.hpp:96

References locked, objects_and_instances, and plate_index.

◆ PlateData() [2/2]

Slic3r::PlateData::PlateData ( )
inline
85 : plate_index(-1), locked(false)
86 {
88 }

References locked, objects_and_instances, and plate_index.

◆ ~PlateData()

Slic3r::PlateData::~PlateData ( )
inline
90 {
92 }

References objects_and_instances.

Member Function Documentation

◆ get_gcode_prediction_str()

std::string Slic3r::PlateData::get_gcode_prediction_str ( )
inline
151 {
152 return gcode_prediction;
153 }
std::string gcode_prediction
Definition bbs_3mf.hpp:114

References gcode_prediction.

Referenced by Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive().

Here is the caller graph for this function:

◆ get_gcode_weight_str()

std::string Slic3r::PlateData::get_gcode_weight_str ( )
inline
155 {
156 return gcode_weight;
157 }
std::string gcode_weight
Definition bbs_3mf.hpp:115

References gcode_weight.

Referenced by Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive().

Here is the caller graph for this function:

◆ parse_filament_info()

void Slic3r::PlateData::parse_filament_info ( GCodeProcessorResult * result)
730{
731 if (!result) return;
732
733 PrintEstimatedStatistics &ps = result->print_statistics;
734 std::vector<float> m_filament_diameters = result->filament_diameters;
735 std::vector<float> m_filament_densities = result->filament_densities;
736 auto get_used_filament_from_volume = [m_filament_diameters, m_filament_densities](double volume, int extruder_id) {
737 double koef = 0.001;
738 double section_area = PI * sqr(0.5 * m_filament_diameters[extruder_id]);
739 std::pair<double, double> ret = {section_area < EPSILON ? 0 : (koef * volume / section_area), volume * m_filament_densities[extruder_id] * 0.001};
740 return ret;
741 };
742
743 for (auto it = ps.total_volumes_per_extruder.begin(); it != ps.total_volumes_per_extruder.end(); it++) {
744 double volume = it->second;
745 auto [used_filament_m, used_filament_g] = get_used_filament_from_volume(volume, it->first);
746
747 FilamentInfo info;
748 info.id = it->first;
749 info.used_g = used_filament_g;
750 info.used_m = used_filament_m;
751
752 // Stamp each filament's logical-nozzle assignment onto the saved 3mf so the device/monitor can
753 // reconstruct it. This block runs for every print: reorder_extruders_for_minimum_flush_volume
754 // runs unconditionally and stores a (non-null) 1-nozzle result even for a single-extruder print,
755 // so result->nozzle_group_result is non-null here for single-nozzle printers too. The stamped
756 // nozzle_diameter is the grouping result's rounded matching-key value; the 3mf writer decides the
757 // final saved diameter (see has_multi_nozzle_extruder). group_id and volume_type are unaffected.
758 if (result && result->nozzle_group_result) {
759 auto nozzles_for_filament = result->nozzle_group_result->get_nozzles_for_filament(it->first);
760 if (!nozzles_for_filament.empty()) {
761 info.group_id.reserve(nozzles_for_filament.size());
762 std::set<double> diameters;
763 std::set<NozzleVolumeType> volume_types;
764 for (const auto& nozzle : nozzles_for_filament) {
765 info.group_id.emplace_back(nozzle.group_id);
766 diameters.insert(string_to_double_decimal_point(nozzle.diameter));
767 volume_types.insert(nozzle.volume_type);
768 }
769 std::sort(info.group_id.begin(), info.group_id.end());
770 info.group_id.erase(std::unique(info.group_id.begin(), info.group_id.end()), info.group_id.end());
771 if (!diameters.empty())
772 info.nozzle_diameter = *diameters.begin();
773 if (volume_types.size() > 1)
774 info.nozzle_volume_type = get_nozzle_volume_type_string(nvtHybrid);
775 else if (!volume_types.empty())
776 info.nozzle_volume_type = get_nozzle_volume_type_string(*volume_types.begin());
777 }
778 }
779
780 auto model_volume_it = ps.model_volumes_per_extruder.find(it->first);
781 auto support_volume_it = ps.support_volumes_per_extruder.find(it->first);
782 info.used_for_object = model_volume_it != ps.model_volumes_per_extruder.end() && model_volume_it->second > EPSILON;
783 info.used_for_support = support_volume_it != ps.support_volumes_per_extruder.end() && support_volume_it->second > EPSILON;
784 slice_filaments_info.push_back(info);
785 }
786
787 // Carry the layer-aware grouping result into the plate so the 3mf writer can emit the <nozzle> tags
788 // and the enable_filament_dynamic_map flag. Only a LayeredNozzleGroupResult (the slicer output) is
789 // stored; a device-side StaticNozzleGroupResult loaded from a 3mf is not re-serialized here.
790 auto layered_group_result = std::dynamic_pointer_cast<MultiNozzleUtils::LayeredNozzleGroupResult>(result->nozzle_group_result);
791 if (layered_group_result)
792 nozzle_group_result = *layered_group_result;
793
794 /* only for test
795 GCodeProcessorResult::SliceWarning sw;
796 sw.msg = BED_TEMP_TOO_HIGH_THAN_FILAMENT;
797 sw.level = 1;
798 result->warnings.push_back(sw);
799 */
800 warnings = result->warnings;
801}
#define EPSILON
Definition ColorUtils.cpp:64
static constexpr double PI
Definition libslic3r.h:81
@ nvtHybrid
Definition PrintConfig.hpp:621
constexpr T sqr(T x)
Definition libslic3r.h:301
double string_to_double_decimal_point(const std::string_view str, size_t *pos)
Definition LocalesUtils.cpp:86
std::string get_nozzle_volume_type_string(NozzleVolumeType nozzle_volume_type)
Definition PrintConfig.cpp:860
std::optional< MultiNozzleUtils::LayeredNozzleGroupResult > nozzle_group_result
Definition bbs_3mf.hpp:140
std::vector< FilamentInfo > slice_filaments_info
Definition bbs_3mf.hpp:118
std::vector< GCodeProcessorResult::SliceWarning > warnings
Definition bbs_3mf.hpp:149

References EPSILON, Slic3r::GCodeProcessorResult::filament_densities, Slic3r::GCodeProcessorResult::filament_diameters, Slic3r::get_nozzle_volume_type_string(), Slic3r::PrintEstimatedStatistics::model_volumes_per_extruder, Slic3r::GCodeProcessorResult::nozzle_group_result, nozzle_group_result, Slic3r::nvtHybrid, PI, Slic3r::GCodeProcessorResult::print_statistics, slice_filaments_info, Slic3r::sqr(), Slic3r::string_to_double_decimal_point(), Slic3r::PrintEstimatedStatistics::support_volumes_per_extruder, Slic3r::PrintEstimatedStatistics::total_volumes_per_extruder, Slic3r::GCodeProcessorResult::warnings, and warnings.

Referenced by Slic3r::GUI::PartPlateList::store_to_3mf_structure().

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

Member Data Documentation

◆ config

◆ filament_change_sequence

◆ filament_maps

◆ first_layer_time

◆ gcode_file

◆ gcode_file_md5

std::string Slic3r::PlateData::gcode_file_md5

◆ gcode_prediction

◆ gcode_weight

◆ is_label_object_enabled

◆ is_sliced_valid

◆ is_support_used

◆ layer_filaments

◆ limit_filament_maps

◆ locked

◆ mixed_filaments_info

◆ no_light_thumbnail_file

◆ nozzle_change_sequence

◆ nozzle_diameters

std::string Slic3r::PlateData::nozzle_diameters

◆ nozzle_group_result

◆ nozzle_volume_types

std::string Slic3r::PlateData::nozzle_volume_types

◆ nozzles_info

std::vector<MultiNozzleUtils::NozzleInfo> Slic3r::PlateData::nozzles_info

◆ obj_inst_map

std::map<int, std::pair<int, int> > Slic3r::PlateData::obj_inst_map

◆ objects_and_instances

◆ optimal_assignment

◆ pattern_bbox_file

◆ pick_file

◆ plate_index

◆ plate_name

◆ plate_thumbnail

◆ printer_model_id

◆ skipped_objects

◆ slice_filaments_info

◆ statistics

std::string Slic3r::PlateData::statistics

◆ thumbnail_file

◆ timelapse_warning_code

int Slic3r::PlateData::timelapse_warning_code = 0

◆ toolpath_outside

◆ top_file

◆ warnings


The documentation for this struct was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Format/bbs_3mf.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Format/bbs_3mf.cpp