Update PrintObject::_generate_support_material() to match BBS

This commit is contained in:
Noisyfox 2024-09-30 13:45:29 +08:00
parent 97d1745e5a
commit ff265745c6
3 changed files with 20 additions and 20 deletions

View file

@ -11,7 +11,6 @@
#include "Support/SupportMaterial.hpp" #include "Support/SupportMaterial.hpp"
#include "Support/SupportSpotsGenerator.hpp" #include "Support/SupportSpotsGenerator.hpp"
#include "Support/TreeSupport.hpp" #include "Support/TreeSupport.hpp"
#include "Support/TreeSupport3D.hpp"
#include "Surface.hpp" #include "Surface.hpp"
#include "Slicing.hpp" #include "Slicing.hpp"
#include "Tesselate.hpp" #include "Tesselate.hpp"
@ -3521,18 +3520,14 @@ void PrintObject::combine_infill()
void PrintObject::_generate_support_material() void PrintObject::_generate_support_material()
{ {
PrintObjectSupportMaterial support_material(this, m_slicing_params); if (is_tree(m_config.support_type.value)) {
support_material.generate(*this); TreeSupport tree_support(*this, m_slicing_params);
tree_support.throw_on_cancel = [this]() { this->throw_if_canceled(); };
if (this->config().enable_support.value && is_tree(this->config().support_type.value)) { tree_support.generate();
if (this->config().support_style.value == smsOrganic || }
// Orca: use organic as default else {
this->config().support_style.value == smsDefault) { PrintObjectSupportMaterial support_material(this, m_slicing_params);
generate_tree_support_3D(*this, std::function<void()>([this]() { this->throw_if_canceled(); })); support_material.generate(*this);
} else {
TreeSupport tree_support(*this, m_slicing_params);
tree_support.generate();
}
} }
} }

View file

@ -11,6 +11,7 @@
#include "ShortestPath.hpp" #include "ShortestPath.hpp"
#include "I18N.hpp" #include "I18N.hpp"
#include <libnest2d/backends/libslic3r/geometries.hpp> #include <libnest2d/backends/libslic3r/geometries.hpp>
#include "TreeSupport3D.hpp"
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <tbb/blocked_range.h> #include <tbb/blocked_range.h>
@ -672,14 +673,15 @@ TreeSupport::TreeSupport(PrintObject& object, const SlicingParameters &slicing_p
support_type = m_object_config->support_type; support_type = m_object_config->support_type;
support_style = m_object_config->support_style; support_style = m_object_config->support_style;
if (support_style == smsDefault) if (support_style == smsDefault)
support_style = smsTreeHybrid; // Orca: use organic as default
support_style = smsOrganic;
SupportMaterialPattern support_pattern = m_object_config->support_base_pattern; SupportMaterialPattern support_pattern = m_object_config->support_base_pattern;
if (support_style == smsTreeHybrid && support_pattern == smpDefault) support_pattern = smpRectilinear; if (support_style == smsTreeHybrid && support_pattern == smpDefault)
m_support_params.base_fill_pattern = support_pattern = smpRectilinear;
m_support_params.base_fill_pattern =
support_pattern == smpLightning ? ipLightning : support_pattern == smpLightning ? ipLightning :
support_pattern == smpHoneycomb ? ipHoneycomb : support_pattern == smpHoneycomb ? ipHoneycomb :
m_support_params.support_density > 0.95 || m_support_params.with_sheath ? ipRectilinear : m_support_params.support_density > 0.95 || m_support_params.with_sheath ? ipRectilinear : ipSupportBase;
ipSupportBase;
m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase); m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
if (m_object_config->support_interface_pattern == smipGrid) if (m_object_config->support_interface_pattern == smipGrid)
@ -1879,9 +1881,10 @@ Polygons TreeSupport::contact_nodes_to_polygon(const std::vector<Node*>& contact
void TreeSupport::generate() void TreeSupport::generate()
{ {
bool tree_support_enable = m_object_config->enable_support.value && is_tree(m_object_config->support_type.value); if (support_style == smsOrganic) {
if (!tree_support_enable) generate_tree_support_3D(*m_object, this->throw_on_cancel);
return; return;
}
std::vector<std::vector<Node*>> contact_nodes(m_object->layers().size()); std::vector<std::vector<Node*>> contact_nodes(m_object->layers().size());

View file

@ -401,6 +401,8 @@ public:
std::unique_ptr<FillLightning::Generator> generator; std::unique_ptr<FillLightning::Generator> generator;
std::unordered_map<double, size_t> printZ_to_lightninglayer; std::unordered_map<double, size_t> printZ_to_lightninglayer;
std::function<void()> throw_on_cancel;
private: private:
/*! /*!
* \brief Generator for model collision, avoidance and internal guide volumes * \brief Generator for model collision, avoidance and internal guide volumes