OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GCode::ObjectByExtruder::Island Struct Reference

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

Collaboration diagram for Slic3r::GCode::ObjectByExtruder::Island:

Classes

struct  Region

Public Member Functions

const std::vector< Region > & by_region_per_copy (std::vector< Region > &by_region_per_copy_cache, unsigned int copy, unsigned int extruder, bool wiping_entities=false) const

Public Attributes

std::vector< Region > by_region

Detailed Description

Member Function Documentation

◆ by_region_per_copy()

const std::vector< GCode::ObjectByExtruder::Island::Region > & Slic3r::GCode::ObjectByExtruder::Island::by_region_per_copy ( std::vector< Region > & by_region_per_copy_cache,
unsigned int copy,
unsigned int extruder,
bool wiping_entities = false ) const
11522{
11523 bool has_overrides = false;
11524 for (const auto& reg : by_region)
11525 if (! reg.infills_overrides.empty() || ! reg.perimeters_overrides.empty()) {
11526 has_overrides = true;
11527 break;
11528 }
11529
11530 // Data is cleared, but the memory is not.
11531 by_region_per_copy_cache.clear();
11532
11533 if (! has_overrides)
11534 // Simple case. No need to copy the regions.
11535 return wiping_entities ? by_region_per_copy_cache : this->by_region;
11536
11537 // Complex case. Some of the extrusions of some object instances are to be printed first - those are the wiping extrusions.
11538 // Some of the extrusions of some object instances are printed later - those are the clean print extrusions.
11539 // Filter out the extrusions based on the infill_overrides / perimeter_overrides:
11540
11541 for (const auto& reg : by_region) {
11542 by_region_per_copy_cache.emplace_back(); // creates a region in the newly created Island
11543
11544 // Now we are going to iterate through perimeters and infills and pick ones that are supposed to be printed
11545 // References are used so that we don't have to repeat the same code
11546 for (int iter = 0; iter < 2; ++iter) {
11547 const std::vector<const ExtrusionEntity*>& entities = (iter ? reg.infills : reg.perimeters);
11548 std::vector<const ExtrusionEntity*>& target_eec = (iter ? by_region_per_copy_cache.back().infills : by_region_per_copy_cache.back().perimeters);
11549 const std::vector<const WipingExtrusions::ExtruderPerCopy*>& overrides = (iter ? reg.infills_overrides : reg.perimeters_overrides);
11550
11551 // Now the most important thing - which extrusion should we print.
11552 // See function ToolOrdering::get_extruder_overrides for details about the negative numbers hack.
11553 if (wiping_entities) {
11554 // Apply overrides for this region.
11555 for (unsigned int i = 0; i < overrides.size(); ++ i) {
11556 const WipingExtrusions::ExtruderPerCopy *this_override = overrides[i];
11557 // This copy (aka object instance) should be printed with this extruder, which overrides the default one.
11558 if (this_override != nullptr && (*this_override)[copy] == int(extruder))
11559 target_eec.emplace_back(entities[i]);
11560 }
11561 } else {
11562 // Apply normal extrusions (non-overrides) for this region.
11563 unsigned int i = 0;
11564 for (; i < overrides.size(); ++ i) {
11565 const WipingExtrusions::ExtruderPerCopy *this_override = overrides[i];
11566 // This copy (aka object instance) should be printed with this extruder, which shall be equal to the default one.
11567 if (this_override == nullptr || (*this_override)[copy] == -int(extruder)-1)
11568 target_eec.emplace_back(entities[i]);
11569 }
11570 for (; i < entities.size(); ++ i)
11571 target_eec.emplace_back(entities[i]);
11572 }
11573 }
11574 }
11575 return by_region_per_copy_cache;
11576}
boost::container::small_vector< int32_t, 3 > ExtruderPerCopy
Definition ToolOrdering.hpp:49
std::vector< Region > by_region
Definition GCode.hpp:626

References by_region.

Member Data Documentation

◆ by_region

std::vector<Region> Slic3r::GCode::ObjectByExtruder::Island::by_region

Referenced by by_region_per_copy().


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