mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
Merge remote-tracking branch 'remote/master' into SoftFever
This commit is contained in:
commit
4fd174175c
298 changed files with 13879 additions and 6228 deletions
|
@ -86,6 +86,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Transfor
|
|||
|
||||
PrintObject::~PrintObject()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": this=%1%, m_shared_object %2%")%this%m_shared_object;
|
||||
if (m_shared_regions && -- m_shared_regions->m_ref_cnt == 0) delete m_shared_regions;
|
||||
clear_layers();
|
||||
clear_support_layers();
|
||||
|
@ -419,11 +420,17 @@ void PrintObject::generate_support_material()
|
|||
m_print->throw_if_canceled();
|
||||
} else {
|
||||
// BBS: pop a warning if objects have significant amount of overhangs but support material is not enabled
|
||||
if (this->is_support_necessary()) {
|
||||
SupportNecessaryType sntype = this->is_support_necessary();
|
||||
if (sntype != NoNeedSupp) {
|
||||
m_print->set_status(50, L("Checking support necessity"));
|
||||
|
||||
std::string warning_message = format(L("It seems object %s needs support to print. Please enable support generation."), this->model_object()->name);
|
||||
this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning_message, PrintStateBase::SlicingNeedSupportOn);
|
||||
if (sntype == SharpTail) {
|
||||
std::string warning_message = format(L("It seems object %s has completely floating regions. Please re-orient the object or enable support generation."),
|
||||
this->model_object()->name);
|
||||
this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning_message, PrintStateBase::SlicingNeedSupportOn);
|
||||
} else {
|
||||
std::string warning_message = format(L("It seems object %s has large overhangs. Please enable support generation."), this->model_object()->name);
|
||||
this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning_message, PrintStateBase::SlicingNeedSupportOn);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -529,9 +536,11 @@ std::pair<FillAdaptive::OctreePtr, FillAdaptive::OctreePtr> PrintObject::prepare
|
|||
|
||||
void PrintObject::clear_layers()
|
||||
{
|
||||
for (Layer *l : m_layers)
|
||||
delete l;
|
||||
m_layers.clear();
|
||||
if (!m_shared_object) {
|
||||
for (Layer *l : m_layers)
|
||||
delete l;
|
||||
m_layers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Layer* PrintObject::add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
|
||||
|
@ -567,9 +576,11 @@ SupportLayer* PrintObject::get_support_layer_at_printz(coordf_t print_z, coordf_
|
|||
|
||||
void PrintObject::clear_tree_support_layers()
|
||||
{
|
||||
for (TreeSupportLayer* l : m_tree_support_layers)
|
||||
delete l;
|
||||
m_tree_support_layers.clear();
|
||||
if (!m_shared_object) {
|
||||
for (TreeSupportLayer* l : m_tree_support_layers)
|
||||
delete l;
|
||||
m_tree_support_layers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<TreeSupportData> PrintObject::alloc_tree_support_preview_cache()
|
||||
|
@ -596,9 +607,11 @@ TreeSupportLayer* PrintObject::add_tree_support_layer(int id, coordf_t height, c
|
|||
|
||||
void PrintObject::clear_support_layers()
|
||||
{
|
||||
for (Layer *l : m_support_layers)
|
||||
delete l;
|
||||
m_support_layers.clear();
|
||||
if (!m_shared_object) {
|
||||
for (Layer *l : m_support_layers)
|
||||
delete l;
|
||||
m_support_layers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
SupportLayer* PrintObject::add_support_layer(int id, int interface_id, coordf_t height, coordf_t print_z)
|
||||
|
@ -2448,7 +2461,7 @@ template void PrintObject::remove_bridges_from_contacts<Polygons>(
|
|||
float max_bridge_length, bool break_bridge);
|
||||
|
||||
|
||||
bool PrintObject::is_support_necessary()
|
||||
SupportNecessaryType PrintObject::is_support_necessary()
|
||||
{
|
||||
static const double super_overhang_area_threshold = SQ(scale_(5.0));
|
||||
|
||||
|
@ -2471,7 +2484,7 @@ bool PrintObject::is_support_necessary()
|
|||
for (const ExPolygon& expoly : layerm->raw_slices) {
|
||||
// detect sharp tail
|
||||
if (intersection_ex({ expoly }, lower_layer_offseted).empty())
|
||||
return true;
|
||||
return SharpTail;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2503,18 +2516,19 @@ bool PrintObject::is_support_necessary()
|
|||
double super_overhang_area = 0.0;
|
||||
for (Polygon& poly : super_overhang_polys) {
|
||||
bool is_ccw = poly.is_counter_clockwise();
|
||||
double area_ = poly.area();
|
||||
if (is_ccw) {
|
||||
if (super_overhang_area > super_overhang_area_threshold)
|
||||
return true;
|
||||
super_overhang_area = poly.area();
|
||||
if (area_ > super_overhang_area_threshold)
|
||||
return LargeOverhang;
|
||||
super_overhang_area += area_;
|
||||
}
|
||||
else {
|
||||
super_overhang_area -= poly.area();
|
||||
super_overhang_area -= area_;
|
||||
}
|
||||
}
|
||||
|
||||
if (super_overhang_area > super_overhang_area_threshold)
|
||||
return true;
|
||||
//if (super_overhang_area > super_overhang_area_threshold)
|
||||
// return LargeOverhang;
|
||||
|
||||
// 3. check overhang distance
|
||||
const double distance_threshold_scaled = extrusion_width_scaled * 2;
|
||||
|
@ -2529,10 +2543,10 @@ bool PrintObject::is_support_necessary()
|
|||
}),
|
||||
exceed_overhang.end());
|
||||
if (!exceed_overhang.empty())
|
||||
return true;
|
||||
return LargeOverhang;
|
||||
}
|
||||
|
||||
return false;
|
||||
return NoNeedSupp;
|
||||
}
|
||||
|
||||
static void project_triangles_to_slabs(ConstLayerPtrsAdaptor layers, const indexed_triangle_set &custom_facets, const Transform3f &tr, bool seam, std::vector<Polygons> &out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue