Introduce option to control one wall draft shield (#8562)

* Introduce option to control number of skirt walls after first layer

* Merge branch 'main' into Introduce-option-to-control-number-of-walls-on-skirt-after-first-layer

* Merge branch 'main' into Introduce-option-to-control-number-of-walls-on-skirt-after-first-layer

* One wall draft shield options refactor

* Merge remote-tracking branch 'upstream/main' into Introduce-option-to-control-number-of-walls-on-skirt-after-first-layer

* Merge branch 'main' into Introduce-option-to-control-number-of-walls-on-skirt-after-first-layer

* Renamed to single loop draft shield

* Merge branch 'main' into Introduce-option-to-control-number-of-walls-on-skirt-after-first-layer

* Merge branch 'main' into Introduce-option-to-control-number-of-walls-on-skirt-after-first-layer
This commit is contained in:
Ioannis Giannakas 2025-03-08 08:48:07 +00:00 committed by GitHub
parent 4900c546f9
commit ec213e98fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 31 additions and 7 deletions

View file

@ -3538,7 +3538,19 @@ std::string GCode::generate_skirt(const Print &print,
m_avoid_crossing_perimeters.use_external_mp();
Flow layer_skirt_flow = print.skirt_flow().with_height(float(m_skirt_done.back() - (m_skirt_done.size() == 1 ? 0. : m_skirt_done[m_skirt_done.size() - 2])));
double mm3_per_mm = layer_skirt_flow.mm3_per_mm();
for (size_t i = first_layer ? loops.first : loops.second - 1; i < loops.second; ++i) {
// Decide where to start looping:
// - If its the first layer or if we do NOT want a single-wall draft shield,
// start from loops.first (all loops).
// - Otherwise, if single_loop_draft_shield == true and draft_shield == true (and not the first layer),
// start from loops.second - 1 (just one loop).
bool single_loop_draft_shield = print.m_config.single_loop_draft_shield &&
(print.m_config.draft_shield == dsEnabled);
const size_t start_idx = (first_layer || !single_loop_draft_shield)
? loops.first
: (loops.second - 1);
// Loop over the skirt loops and extrude
for (size_t i = start_idx; i < loops.second; ++i) {
// Adjust flow according to this layer's layer height.
ExtrusionLoop loop = *dynamic_cast<const ExtrusionLoop*>(skirt.entities[i]);
for (ExtrusionPath &path : loop.paths) {
@ -3552,8 +3564,10 @@ std::string GCode::generate_skirt(const Print &print,
//FIXME using the support_speed of the 1st object printed.
gcode += this->extrude_loop(loop, "skirt", m_config.support_speed.value);
if (!first_layer)
// If we only want a single wall on non-first layers, break now
if (!first_layer && single_loop_draft_shield) {
break;
}
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point if this is the first layer (but don't in next layers).
@ -4583,8 +4597,8 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
// if spiral vase, we have to ensure that all contour are in the same orientation.
loop.make_counter_clockwise();
}
if (loop.loop_role() == elrSkirt && (this->m_layer->id() % 2 == 1))
loop.reverse();
//if (loop.loop_role() == elrSkirt && (this->m_layer->id() % 2 == 1))
// loop.reverse();
// find the point of the loop that is closest to the current extruder position
// or randomize if requested