height level mismatches seems to be fixed.

This commit is contained in:
tamasmeszaros 2018-11-20 16:12:04 +01:00
parent 7482b619b5
commit d27e22c2c3
8 changed files with 106 additions and 58 deletions

View file

@ -23,6 +23,13 @@ struct PoolConfig {
double min_wall_height_mm = 5;
double max_merge_distance_mm = 50;
double edge_radius_mm = 1;
inline PoolConfig() {}
inline PoolConfig(double wt, double wh, double md, double er):
min_wall_thickness_mm(wt),
min_wall_height_mm(wh),
max_merge_distance_mm(md),
edge_radius_mm(er) {}
};
/// Calculate the pool for the mesh for SLA printing
@ -31,6 +38,15 @@ void create_base_pool(const ExPolygons& base_plate,
const PoolConfig& = PoolConfig()
);
/// TODO: Currently the base plate of the pool will have half the height of the
/// whole pool. So the carved out space has also half the height. This is not
/// a particularly elegant solution, the thickness should be exactly
/// min_wall_thickness and it should be corrected in the future. This method
/// will return the correct value for further processing.
inline double get_pad_elevation(const PoolConfig& cfg) {
return cfg.min_wall_height_mm / 2.0;
}
}
}

View file

@ -512,7 +512,7 @@ struct Pad {
double ground_level,
const PoolConfig& pcfg) :
cfg(pcfg),
zlevel(ground_level + cfg.min_wall_height_mm/2)
zlevel(ground_level + sla::get_pad_elevation(pcfg))
{
ExPolygons basep;
base_plate(object_support_mesh, basep,
@ -1634,7 +1634,7 @@ SlicedSupports SLASupportTree::slice(float layerh, float init_layerh) const
const auto modelh = float(stree.full_height());
auto gndlvl = float(this->m_impl->ground_level);
const Pad& pad = m_impl->pad();
if(!pad.empty()) gndlvl -= float(pad.cfg.min_wall_height_mm/2);
if(!pad.empty()) gndlvl -= float(get_pad_elevation(pad.cfg));
std::vector<float> heights = {gndlvl};
heights.reserve(size_t(modelh/layerh) + 1);
@ -1673,20 +1673,12 @@ const TriangleMesh &SLASupportTree::get_pad() const
return m_impl->pad().tmesh;
}
double SLASupportTree::get_elevation() const
{
double ph = m_impl->pad().empty()? 0 :
m_impl->pad().cfg.min_wall_height_mm/2.0;
return m_elevation + ph;
}
SLASupportTree::SLASupportTree(const PointSet &points,
const EigenMesh3D& emesh,
const SupportConfig &cfg,
const Controller &ctl):
m_impl(new Impl()), m_ctl(ctl)
{
m_elevation = cfg.object_elevation_mm;
m_impl->ground_level = emesh.ground_level - cfg.object_elevation_mm;
generate(points, emesh, cfg, ctl);
}

View file

@ -118,9 +118,6 @@ class SLASupportTree {
std::unique_ptr<Impl> m_impl;
Controller m_ctl;
// the only value from config that is also needed after construction
double m_elevation = 0;
Impl& get() { return *m_impl; }
const Impl& get() const { return *m_impl; }