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

View file

@ -11,6 +11,7 @@
#include "ShortestPath.hpp"
#include "I18N.hpp"
#include <libnest2d/backends/libslic3r/geometries.hpp>
#include "TreeSupport3D.hpp"
#include <boost/log/trivial.hpp>
#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_style = m_object_config->support_style;
if (support_style == smsDefault)
support_style = smsTreeHybrid;
// Orca: use organic as default
support_style = smsOrganic;
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)
support_pattern = smpRectilinear;
m_support_params.base_fill_pattern =
support_pattern == smpLightning ? ipLightning :
support_pattern == smpHoneycomb ? ipHoneycomb :
m_support_params.support_density > 0.95 || m_support_params.with_sheath ? ipRectilinear :
ipSupportBase;
m_support_params.support_density > 0.95 || m_support_params.with_sheath ? 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)
@ -1879,9 +1881,10 @@ Polygons TreeSupport::contact_nodes_to_polygon(const std::vector<Node*>& contact
void TreeSupport::generate()
{
bool tree_support_enable = m_object_config->enable_support.value && is_tree(m_object_config->support_type.value);
if (!tree_support_enable)
if (support_style == smsOrganic) {
generate_tree_support_3D(*m_object, this->throw_on_cancel);
return;
}
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::unordered_map<double, size_t> printZ_to_lightninglayer;
std::function<void()> throw_on_cancel;
private:
/*!
* \brief Generator for model collision, avoidance and internal guide volumes