mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
ENH: use spiral lift only when it is needed
If a travel path goes through an overhang expolygons, and their distance is shorter than threshold, lift type will be set to SpiralLift. Signed-off-by: yifan.wu <yifan.wu@bambulab.com> Change-Id: I345788711755dd8611ecf385818e6052cd8abe9e
This commit is contained in:
parent
47a46010bd
commit
5d9bb61f8e
11 changed files with 199 additions and 17 deletions
|
@ -409,6 +409,48 @@ void PrintObject::ironing()
|
|||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
void PrintObject::clear_overhangs_for_lift()
|
||||
{
|
||||
if (!m_shared_object) {
|
||||
for (Layer* l : m_layers)
|
||||
l->loverhangs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
static const float g_min_overhang_percent_for_lift = 0.3f;
|
||||
|
||||
void PrintObject::detect_overhangs_for_lift()
|
||||
{
|
||||
if (this->set_started(posDetectOverhangsForLift)) {
|
||||
const float min_overlap = m_config.line_width * g_min_overhang_percent_for_lift;
|
||||
size_t num_layers = this->layer_count();
|
||||
size_t num_raft_layers = m_slicing_params.raft_layers();
|
||||
|
||||
m_print->set_status(78, L("Detect overhangs for auto-lift"));
|
||||
|
||||
this->clear_overhangs_for_lift();
|
||||
|
||||
if (m_print->config().z_hop_type != ZHopType::zhtAuto)
|
||||
return;
|
||||
|
||||
tbb::spin_mutex layer_storage_mutex;
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(num_raft_layers + 1, num_layers),
|
||||
[this, min_overlap](const tbb::blocked_range<size_t>& range)
|
||||
{
|
||||
for (size_t layer_id = range.begin(); layer_id < range.end(); ++layer_id) {
|
||||
Layer& layer = *m_layers[layer_id];
|
||||
Layer& lower_layer = *layer.lower_layer;
|
||||
|
||||
ExPolygons overhangs = diff_ex(layer.lslices, offset_ex(lower_layer.lslices, scale_(min_overlap)));
|
||||
layer.loverhangs = std::move(offset2_ex(overhangs, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width)));
|
||||
}
|
||||
});
|
||||
|
||||
this->set_done(posDetectOverhangsForLift);
|
||||
}
|
||||
}
|
||||
|
||||
void PrintObject::generate_support_material()
|
||||
{
|
||||
if (this->set_started(posSupportMaterial)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue