mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-20 13:33:15 +08:00
FIX: wrong wall order
Github: 4139 Signed-off-by: qing.zhang <qing.zhang@bambulab.com> Change-Id: Ibc2c433b3de5a0c5e7cd2edcd4f9e91956645e88 (cherry picked from commit d4282d26cbbfbbfacf7352c5e45c078eb3ef14f8)
This commit is contained in:
parent
773e79d9f4
commit
9845767295
@ -43,12 +43,17 @@ enum ExtrusionRole : uint8_t {
|
|||||||
|
|
||||||
// Special flags describing loop
|
// Special flags describing loop
|
||||||
enum ExtrusionLoopRole {
|
enum ExtrusionLoopRole {
|
||||||
elrDefault,
|
elrDefault = 1 << 0,
|
||||||
elrContourInternalPerimeter,
|
elrContourInternalPerimeter = 1 << 1,
|
||||||
elrSkirt,
|
elrSkirt = 1 << 2,
|
||||||
elrPerimeterHole,
|
elrPerimeterHole = 1 << 3,
|
||||||
|
elrSecondPerimeter = 1 << 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline ExtrusionLoopRole operator |(ExtrusionLoopRole a, ExtrusionLoopRole b) {
|
||||||
|
return static_cast<ExtrusionLoopRole>(static_cast<int>(a) | static_cast<int>(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool is_perimeter(ExtrusionRole role)
|
inline bool is_perimeter(ExtrusionRole role)
|
||||||
{
|
{
|
||||||
|
@ -4009,7 +4009,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||||||
|
|
||||||
// extrude all loops ccw
|
// extrude all loops ccw
|
||||||
bool was_clockwise = loop.make_counter_clockwise();
|
bool was_clockwise = loop.make_counter_clockwise();
|
||||||
bool is_hole = loop.loop_role() == elrPerimeterHole;
|
bool is_hole = loop.loop_role() & elrPerimeterHole;
|
||||||
// find the point of the loop that is closest to the current extruder position
|
// find the point of the loop that is closest to the current extruder position
|
||||||
// or randomize if requested
|
// or randomize if requested
|
||||||
Point last_pos = this->last_pos();
|
Point last_pos = this->last_pos();
|
||||||
|
@ -469,6 +469,13 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
|
|||||||
loop_role = loop.is_contour? elrDefault: elrPerimeterHole;
|
loop_role = loop.is_contour? elrDefault: elrPerimeterHole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( loop.depth == 1 ) {
|
||||||
|
if (loop_role == elrDefault)
|
||||||
|
loop_role = elrSecondPerimeter;
|
||||||
|
else
|
||||||
|
loop_role = loop_role | elrSecondPerimeter;
|
||||||
|
}
|
||||||
|
|
||||||
// detect overhanging/bridging perimeters
|
// detect overhanging/bridging perimeters
|
||||||
ExtrusionPaths paths;
|
ExtrusionPaths paths;
|
||||||
|
|
||||||
@ -1436,14 +1443,23 @@ void PerimeterGenerator::process_classic()
|
|||||||
//BBS. adjust wall generate seq
|
//BBS. adjust wall generate seq
|
||||||
else if (this->object_config->wall_sequence == WallSequence::InnerOuterInner)
|
else if (this->object_config->wall_sequence == WallSequence::InnerOuterInner)
|
||||||
if (entities.entities.size() > 1){
|
if (entities.entities.size() > 1){
|
||||||
int last_outer=0;
|
int second_wall = -1;
|
||||||
int outer = 0;
|
ExtrusionEntitiesPtr entities_reorder;
|
||||||
for (; outer < entities.entities.size(); ++outer)
|
ExtrusionEntitiesPtr entities_second_wall;
|
||||||
if (entities.entities[outer]->role() == erExternalPerimeter && outer - last_outer > 1) {
|
for (int entity_idx = 0; entity_idx < entities.entities.size(); ++entity_idx) {
|
||||||
std::swap(entities.entities[outer], entities.entities[outer - 1]);
|
ExtrusionLoop *eloop = static_cast<ExtrusionLoop *>(entities.entities[entity_idx]);
|
||||||
last_outer = outer;
|
if (eloop->loop_role() & elrSecondPerimeter) {
|
||||||
|
entities_second_wall.push_back(entities.entities[entity_idx]);
|
||||||
|
} else {
|
||||||
|
entities_reorder.push_back(entities.entities[entity_idx]);
|
||||||
|
if (entities.entities[entity_idx]->role() == erExternalPerimeter && !entities_second_wall.empty()) {
|
||||||
|
entities_reorder.insert(entities_reorder.end(), entities_second_wall.begin(), entities_second_wall.end());
|
||||||
|
entities_second_wall.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
entities.entities = std::move( entities_reorder);
|
||||||
|
}
|
||||||
// append perimeters for this slice as a collection
|
// append perimeters for this slice as a collection
|
||||||
if (! entities.empty())
|
if (! entities.empty())
|
||||||
this->loops->append(entities);
|
this->loops->append(entities);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user