mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
ENH: merge tree support layers to support layers
Will greately reduce repeated codes. Change-Id: I506a97a907b5b393fe41e13ae53e2f7c9247c4c5
This commit is contained in:
parent
b6ef31f7b9
commit
646b259972
11 changed files with 123 additions and 624 deletions
|
@ -165,17 +165,6 @@ static Polygons top_level_outer_brim_islands(const ConstPrintObjectPtrs &top_lev
|
|||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
Polygons contour_offset = offset(ex_poly.contour, brim_object_gap, ClipperLib::jtSquare);
|
||||
for (Polygon& poly : contour_offset)
|
||||
poly.douglas_peucker(scaled_resolution);
|
||||
|
||||
polygons_append(islands_object, std::move(contour_offset));
|
||||
}
|
||||
}
|
||||
|
||||
for (const PrintInstance &instance : object->instances())
|
||||
append_and_translate(islands, islands_object, instance);
|
||||
}
|
||||
|
@ -248,19 +237,6 @@ static ExPolygons top_level_outer_brim_area(const Print &print
|
|||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
if ((brim_type == BrimType::btOuterOnly || brim_type == BrimType::btOuterAndInner || brim_type == BrimType::btAutoBrim) && is_top_outer_brim)
|
||||
append(brim_area_object, diff_ex(offset(ex_poly.contour, brim_width + brim_object_gap, jtRound, scaled_resolution), offset(ex_poly.contour, brim_object_gap)));
|
||||
|
||||
if (brim_type != BrimType::btNoBrim)
|
||||
append(no_brim_area_object, offset_ex(ExPolygon(ex_poly.contour), brim_object_gap));
|
||||
|
||||
no_brim_area_object.emplace_back(ex_poly.contour);
|
||||
}
|
||||
}
|
||||
|
||||
for (const PrintInstance &instance : object->instances()) {
|
||||
append_and_translate(brim_area, brim_area_object, instance);
|
||||
append_and_translate(no_brim_area, no_brim_area_object, instance);
|
||||
|
@ -360,21 +336,6 @@ static ExPolygons top_level_outer_brim_area(const Print& print, const ConstPrint
|
|||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
if ((brim_type == BrimType::btOuterOnly || brim_type == BrimType::btOuterAndInner || brim_type == BrimType::btAutoBrim) && is_top_outer_brim)
|
||||
append(brim_area_support, diff_ex(offset(ex_poly.contour, brim_width, jtRound, SCALED_RESOLUTION), offset(ex_poly.contour, 0)));
|
||||
|
||||
if (brim_type == BrimType::btOuterOnly || brim_type == BrimType::btNoBrim)
|
||||
append(no_brim_area_support, offset_ex(ex_poly.holes, -no_brim_offset));
|
||||
|
||||
if (brim_type != BrimType::btNoBrim)
|
||||
append(no_brim_area_support, offset_ex(ex_poly.contour, 0));
|
||||
|
||||
no_brim_area_support.emplace_back(ex_poly.contour);
|
||||
}
|
||||
}
|
||||
brimToWrite.at(object->id()).sup = false;
|
||||
for (const PrintInstance& instance : object->instances()) {
|
||||
if (!brim_area_support.empty())
|
||||
|
@ -543,26 +504,6 @@ static ExPolygons inner_brim_area(const Print& print, const ConstPrintObjectPtrs
|
|||
no_brim_area_support.emplace_back(support_contour);
|
||||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
if (brim_type == BrimType::btOuterOnly || brim_type == BrimType::btOuterAndInner || brim_type == BrimType::btAutoBrim) {
|
||||
if (!top_outer_brim)
|
||||
append(brim_area_support, diff_ex(offset_ex(ex_poly.contour, brim_width + brim_offset, jtRound, SCALED_RESOLUTION), offset_ex(ex_poly.contour, brim_offset)));
|
||||
}
|
||||
if (brim_type == BrimType::btInnerOnly || brim_type == BrimType::btOuterAndInner)
|
||||
append(brim_area_support, diff_ex(offset_ex(ex_poly.holes, -brim_offset), offset_ex(ex_poly.holes, -brim_width - brim_offset)));
|
||||
if (brim_type == BrimType::btInnerOnly || brim_type == BrimType::btNoBrim)
|
||||
append(no_brim_area_support, diff_ex(offset(ex_poly.contour, no_brim_offset), ex_poly.holes));
|
||||
if (brim_type == BrimType::btOuterOnly || brim_type == BrimType::btNoBrim)
|
||||
append(no_brim_area_support, offset_ex(ex_poly.holes, -no_brim_offset));
|
||||
append(holes_support, ex_poly.holes);
|
||||
if (brim_type != BrimType::btNoBrim)
|
||||
append(no_brim_area_support, offset_ex(ex_poly.contour, 0));
|
||||
no_brim_area_support.emplace_back(ex_poly.contour);
|
||||
}
|
||||
}
|
||||
}
|
||||
brimToWrite.at(object->id()).sup = false;
|
||||
for (const PrintInstance& instance : object->instances()) {
|
||||
|
@ -988,7 +929,7 @@ static ExPolygons outer_inner_brim_area(const Print& print,
|
|||
support_material_extruder = printExtruders.front() + 1;
|
||||
}
|
||||
if (support_material_extruder == extruderNo && brimToWrite.at(object->id()).sup) {
|
||||
if (!object->support_layers().empty()) {
|
||||
if (!object->support_layers().empty() && object->support_layers().front()->support_type==stInnerNormal) {
|
||||
for (const Polygon& support_contour : object->support_layers().front()->support_fills.polygons_covered_by_spacing()) {
|
||||
// Brim will not be generated for supports
|
||||
/*
|
||||
|
@ -1002,8 +943,8 @@ static ExPolygons outer_inner_brim_area(const Print& print,
|
|||
}
|
||||
}
|
||||
// BBS
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
if (!object->support_layers().empty() && object->support_layers().front()->support_type == stInnerTree) {
|
||||
for (const ExPolygon &ex_poly : object->support_layers().front()->lslices) {
|
||||
// BBS: additional brim width will be added if adhension area is too small without brim
|
||||
float brim_width_mod = ex_poly.area() / ex_poly.contour.length() < scaled_half_min_adh_length
|
||||
&& brim_width < scaled_flow_width ? brim_width + scaled_additional_brim_width : brim_width;
|
||||
|
@ -1222,13 +1163,6 @@ static void make_inner_island_brim(const Print& print, const ConstPrintObjectPtr
|
|||
}
|
||||
}
|
||||
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
Polygon counter = ex_poly.contour;
|
||||
save_polygon_if_is_inner_island(holes_area, counter, hole_island_pair);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS: 3 generate loops, only save part of loop which inside hole
|
||||
const float brim_offset = scale_(object->config().brim_object_gap.value);
|
||||
const float brim_width = scale_(object->config().brim_width.value);
|
||||
|
@ -1371,13 +1305,6 @@ static void make_inner_island_brim(const Print& print, const ConstPrintObjectPtr
|
|||
}
|
||||
}
|
||||
|
||||
if (!object->tree_support_layers().empty()) {
|
||||
for (const ExPolygon& ex_poly : object->tree_support_layers().front()->lslices) {
|
||||
Polygon counter = ex_poly.contour;
|
||||
save_polygon_if_is_inner_island(holes_area, counter, hole_island_pair_supports);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS: 3 generate loops, only save part of loop which inside hole
|
||||
const float brim_offset = scale_(object->config().brim_object_gap.value);
|
||||
const float brim_width = floor(scale_(object->config().brim_width.value) / 2 / flow.scaled_spacing()) * 2 * flow.scaled_spacing();
|
||||
|
@ -1665,13 +1592,6 @@ void make_brim(const Print& print, PrintTryCancel try_cancel, Polygons& islands_
|
|||
ex_poly_translated.translate(instance.shift.x(), instance.shift.y());
|
||||
bbx.merge(get_extents(ex_poly_translated));
|
||||
}
|
||||
if (!object->tree_support_layers().empty())
|
||||
for (const Polygon& ex_poly : object->tree_support_layers().front()->support_fills.polygons_covered_by_spacing())
|
||||
for (const PrintInstance& instance : object->instances()) {
|
||||
auto ex_poly_translated = ex_poly;
|
||||
ex_poly_translated.translate(instance.shift.x(), instance.shift.y());
|
||||
bbx.merge(get_extents(ex_poly_translated));
|
||||
}
|
||||
if (supportBrimAreaMap.find(printObjID) != supportBrimAreaMap.end()) {
|
||||
for (const ExPolygon& ex_poly : supportBrimAreaMap.at(printObjID))
|
||||
bbx.merge(get_extents(ex_poly.contour));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue