mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Add test obj and address for support under ground level if no elevation
This commit is contained in:
parent
23a7e77a81
commit
c4d50ea639
6 changed files with 2535 additions and 18 deletions
|
|
@ -308,6 +308,8 @@ public:
|
|||
template<class...Args> long add_pillar(long headid, Args&&... args)
|
||||
{
|
||||
std::lock_guard<Mutex> lk(m_mutex);
|
||||
if (m_pillars.capacity() < m_heads.size())
|
||||
m_pillars.reserve(m_heads.size() * 2);
|
||||
|
||||
assert(headid >= 0 && headid < m_head_indices.size());
|
||||
Head &head = m_heads[m_head_indices[size_t(headid)]];
|
||||
|
|
@ -357,6 +359,8 @@ public:
|
|||
template<class...Args> long add_pillar(Args&&...args)
|
||||
{
|
||||
std::lock_guard<Mutex> lk(m_mutex);
|
||||
if (m_pillars.capacity() < m_heads.size())
|
||||
m_pillars.reserve(m_heads.size() * 2);
|
||||
m_pillars.emplace_back(std::forward<Args>(args)...);
|
||||
Pillar& pillar = m_pillars.back();
|
||||
pillar.id = long(m_pillars.size() - 1);
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ bool SupportTreeBuildsteps::interconnect(const Pillar &pillar,
|
|||
bool SupportTreeBuildsteps::connect_to_nearpillar(const Head &head,
|
||||
long nearpillar_id)
|
||||
{
|
||||
auto nearpillar = [this, nearpillar_id]() {
|
||||
auto nearpillar = [this, nearpillar_id]() -> const Pillar& {
|
||||
return m_builder.pillar(nearpillar_id);
|
||||
};
|
||||
|
||||
|
|
@ -543,9 +543,8 @@ bool SupportTreeBuildsteps::search_pillar_and_connect(const Head &head)
|
|||
nearest_id = ne.second;
|
||||
|
||||
if(nearest_id >= 0) {
|
||||
auto nearpillarID = unsigned(nearest_id);
|
||||
if(nearpillarID < m_builder.pillarcount()) {
|
||||
if(!connect_to_nearpillar(head, nearpillarID)) {
|
||||
if(size_t(nearest_id) < m_builder.pillarcount()) {
|
||||
if(!connect_to_nearpillar(head, nearest_id)) {
|
||||
nearest_id = ID_UNSET; // continue searching
|
||||
spindex.remove(ne); // without the current pillar
|
||||
}
|
||||
|
|
@ -1361,22 +1360,21 @@ void SupportTreeBuildsteps::routing_headless()
|
|||
|
||||
// This is only for checking
|
||||
double idist = bridge_mesh_intersect(sph, dir, R, true);
|
||||
double dist = ray_mesh_intersect(sj, dir);
|
||||
if (std::isinf(dist))
|
||||
dist = sph(Z) - m_mesh.ground_level()
|
||||
+ m_mesh.ground_level_offset();
|
||||
double realdist = ray_mesh_intersect(sj, dir);
|
||||
double dist = realdist;
|
||||
|
||||
if(std::isnan(idist) || idist < 2*R ||
|
||||
std::isnan(dist) || dist < 2*R)
|
||||
{
|
||||
if (std::isinf(dist)) dist = sph(Z) - m_builder.ground_level;
|
||||
|
||||
if(std::isnan(idist) || idist < 2*R || std::isnan(dist) || dist < 2*R) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "Can not find route for headless"
|
||||
<< " support stick at: "
|
||||
<< sj.transpose();
|
||||
continue;
|
||||
}
|
||||
|
||||
Vec3d ej = sj + (dist + HWIDTH_MM)* dir;
|
||||
m_builder.add_compact_bridge(sp, ej, n, R, !std::isinf(dist));
|
||||
bool use_endball = !std::isinf(realdist);
|
||||
Vec3d ej = sj + (dist + HWIDTH_MM) * dir;
|
||||
m_builder.add_compact_bridge(sp, ej, n, R, use_endball);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue