Simplifying individual slices in base_plate
This commit is contained in:
parent
c3e1be7531
commit
1501b2003e
2 changed files with 19 additions and 5 deletions
|
@ -427,6 +427,7 @@ ExPolygons concave_hull(const ExPolygons& polys, double max_dist_mm = 50,
|
||||||
return r;
|
return r;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This is unavoidable...
|
||||||
punion = unify(punion);
|
punion = unify(punion);
|
||||||
|
|
||||||
return punion;
|
return punion;
|
||||||
|
@ -448,10 +449,17 @@ void base_plate(const TriangleMesh &mesh, ExPolygons &output, float h,
|
||||||
slicer.slice(heights, &out, thrfn);
|
slicer.slice(heights, &out, thrfn);
|
||||||
|
|
||||||
size_t count = 0; for(auto& o : out) count += o.size();
|
size_t count = 0; for(auto& o : out) count += o.size();
|
||||||
|
|
||||||
|
// Now we have to unify all slice layers which can be an expensive operation
|
||||||
|
// so we will try to simplify the polygons
|
||||||
ExPolygons tmp; tmp.reserve(count);
|
ExPolygons tmp; tmp.reserve(count);
|
||||||
for(auto& o : out) for(auto& e : o) tmp.emplace_back(std::move(e));
|
for(ExPolygons& o : out) for(ExPolygon& e : o) {
|
||||||
|
auto&& exss = e.simplify(0.1/SCALING_FACTOR);
|
||||||
|
for(ExPolygon& ep : exss) tmp.emplace_back(std::move(ep));
|
||||||
|
}
|
||||||
|
|
||||||
ExPolygons utmp = unify(tmp);
|
ExPolygons utmp = unify(tmp);
|
||||||
|
|
||||||
for(auto& o : utmp) {
|
for(auto& o : utmp) {
|
||||||
auto&& smp = o.simplify(0.1/SCALING_FACTOR);
|
auto&& smp = o.simplify(0.1/SCALING_FACTOR);
|
||||||
output.insert(output.end(), smp.begin(), smp.end());
|
output.insert(output.end(), smp.begin(), smp.end());
|
||||||
|
|
|
@ -363,7 +363,11 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConf
|
||||||
const_cast<PrintObjectStatus&>(*it_print_object_status).status = PrintObjectStatus::Reused;
|
const_cast<PrintObjectStatus&>(*it_print_object_status).status = PrintObjectStatus::Reused;
|
||||||
} else {
|
} else {
|
||||||
auto print_object = new SLAPrintObject(this, &model_object);
|
auto print_object = new SLAPrintObject(this, &model_object);
|
||||||
|
|
||||||
|
// FIXME: this invalidates the transformed mesh in SLAPrintObject
|
||||||
|
// which is expensive to calculate (especially the raw_mesh() call)
|
||||||
print_object->set_trafo(sla_trafo(model_object));
|
print_object->set_trafo(sla_trafo(model_object));
|
||||||
|
|
||||||
print_object->set_instances(new_instances);
|
print_object->set_instances(new_instances);
|
||||||
print_object->config_apply(config, true);
|
print_object->config_apply(config, true);
|
||||||
print_objects_new.emplace_back(print_object);
|
print_objects_new.emplace_back(print_object);
|
||||||
|
@ -621,7 +625,7 @@ void SLAPrint::process()
|
||||||
// repeated)
|
// repeated)
|
||||||
|
|
||||||
if(!po.m_supportdata || !po.m_supportdata->support_tree_ptr) {
|
if(!po.m_supportdata || !po.m_supportdata->support_tree_ptr) {
|
||||||
BOOST_LOG_TRIVIAL(warning) << "Uninitialized support data at "
|
BOOST_LOG_TRIVIAL(error) << "Uninitialized support data at "
|
||||||
<< "pad creation.";
|
<< "pad creation.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -644,9 +648,11 @@ void SLAPrint::process()
|
||||||
// This call can get pretty time consuming
|
// This call can get pretty time consuming
|
||||||
auto thrfn = [this](){ throw_if_canceled(); };
|
auto thrfn = [this](){ throw_if_canceled(); };
|
||||||
|
|
||||||
if(elevation < pad_h)
|
if(elevation < pad_h) {
|
||||||
|
// we have to count with the model geometry for the base plate
|
||||||
sla::base_plate(trmesh, bp, float(pad_h), float(lh),
|
sla::base_plate(trmesh, bp, float(pad_h), float(lh),
|
||||||
thrfn);
|
thrfn);
|
||||||
|
}
|
||||||
|
|
||||||
pcfg.throw_on_cancel = thrfn;
|
pcfg.throw_on_cancel = thrfn;
|
||||||
po.m_supportdata->support_tree_ptr->add_pad(bp, pcfg);
|
po.m_supportdata->support_tree_ptr->add_pad(bp, pcfg);
|
||||||
|
@ -940,7 +946,7 @@ void SLAPrint::process()
|
||||||
};
|
};
|
||||||
|
|
||||||
// this would disable the rasterization step
|
// this would disable the rasterization step
|
||||||
// m_stepmask[slapsRasterize] = false;
|
// m_stepmask[slapsRasterize] = false;
|
||||||
|
|
||||||
double pstd = (100 - max_objstatus) / 100.0;
|
double pstd = (100 - max_objstatus) / 100.0;
|
||||||
st = max_objstatus;
|
st = max_objstatus;
|
||||||
|
|
Loading…
Reference in a new issue