Adding validation code for support parameters (elevation)

This commit is contained in:
tamasmeszaros 2019-03-18 15:31:47 +01:00
parent f249155340
commit cd2cccec5f
3 changed files with 21 additions and 2 deletions

View File

@ -1466,7 +1466,7 @@ public:
m_cfg.head_back_radius_mm,
w);
if(t <= w || (hp(Z) + nn(Z) * w) < m_result.ground_level) {
if(t <= w) {
// Let's try to optimize this angle, there might be a
// viable normal that doesn't collide with the model
@ -1509,7 +1509,7 @@ public:
// save the verified and corrected normal
m_support_nmls.row(fidx) = nn;
if(t > w && (hp(Z) + nn(Z) * w) > m_result.ground_level) {
if(t > w) {
// mark the point for needing a head.
m_iheads.emplace_back(fidx);
} else if( polar >= 3*PI/4 ) {

View File

@ -571,7 +571,24 @@ void swapXY(ExPolygon& expoly) {
for(auto& p : expoly.contour.points) std::swap(p(X), p(Y));
for(auto& h : expoly.holes) for(auto& p : h.points) std::swap(p(X), p(Y));
}
}
std::string SLAPrint::validate() const
{
for(SLAPrintObject * po : m_objects) {
sla::SupportConfig cfg = make_support_cfg(po->config());
double pinhead_width =
2 * cfg.head_front_radius_mm +
cfg.head_width_mm +
2 * cfg.head_back_radius_mm -
cfg.head_penetration_mm;
if(pinhead_width > cfg.object_elevation_mm)
return L("Elevetion is too low for object.");
}
return "";
}
std::vector<float> SLAPrint::calculate_heights(const BoundingBoxf3& bb3d,

View File

@ -240,6 +240,8 @@ public:
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
std::string validate() const override;
private:
using SLAPrinter = FilePrinter<FilePrinterFormat::SLA_PNGZIP>;
using SLAPrinterPtr = std::unique_ptr<SLAPrinter>;