mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
Restore correct ordering of concentric infill loops, preventing them from being reordered during G-code generation
This commit is contained in:
parent
25cddfe446
commit
6cab5668e3
6 changed files with 24 additions and 4 deletions
|
@ -38,6 +38,9 @@ class ExtrusionEntity
|
|||
virtual bool is_loop() const {
|
||||
return false;
|
||||
};
|
||||
virtual bool can_reverse() const {
|
||||
return true;
|
||||
};
|
||||
virtual ExtrusionEntity* clone() const = 0;
|
||||
virtual ~ExtrusionEntity() {};
|
||||
virtual void reverse() = 0;
|
||||
|
@ -92,6 +95,9 @@ class ExtrusionLoop : public ExtrusionEntity
|
|||
bool is_loop() const {
|
||||
return true;
|
||||
};
|
||||
bool can_reverse() const {
|
||||
return false;
|
||||
};
|
||||
ExtrusionLoop* clone() const;
|
||||
bool make_clockwise();
|
||||
bool make_counter_clockwise();
|
||||
|
|
|
@ -86,7 +86,7 @@ ExtrusionEntityCollection::chained_path_from(Point start_near, ExtrusionEntityCo
|
|||
Points endpoints;
|
||||
for (ExtrusionEntitiesPtr::iterator it = my_paths.begin(); it != my_paths.end(); ++it) {
|
||||
endpoints.push_back((*it)->first_point());
|
||||
if (no_reverse) {
|
||||
if (no_reverse || !(*it)->can_reverse()) {
|
||||
endpoints.push_back((*it)->first_point());
|
||||
} else {
|
||||
endpoints.push_back((*it)->last_point());
|
||||
|
@ -99,7 +99,7 @@ ExtrusionEntityCollection::chained_path_from(Point start_near, ExtrusionEntityCo
|
|||
int path_index = start_index/2;
|
||||
ExtrusionEntity* entity = my_paths.at(path_index);
|
||||
// never reverse loops, since it's pointless for chained path and callers might depend on orientation
|
||||
if (start_index % 2 && !no_reverse && !entity->is_loop()) {
|
||||
if (start_index % 2 && !no_reverse && entity->can_reverse()) {
|
||||
entity->reverse();
|
||||
}
|
||||
retval->entities.push_back(my_paths.at(path_index));
|
||||
|
|
|
@ -16,6 +16,9 @@ class ExtrusionEntityCollection : public ExtrusionEntity
|
|||
ExtrusionEntityCollection(): no_sort(false) {};
|
||||
ExtrusionEntityCollection(const ExtrusionEntityCollection &collection);
|
||||
ExtrusionEntityCollection& operator= (const ExtrusionEntityCollection &other);
|
||||
bool can_reverse() const {
|
||||
return !this->no_sort;
|
||||
};
|
||||
void swap (ExtrusionEntityCollection &c);
|
||||
void chained_path(ExtrusionEntityCollection* retval, bool no_reverse = false, std::vector<size_t>* orig_indices = NULL) const;
|
||||
void chained_path_from(Point start_near, ExtrusionEntityCollection* retval, bool no_reverse = false, std::vector<size_t>* orig_indices = NULL) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue