mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-31 06:42:07 +00:00
Merge branch 'main' into feat/plugin-pages
This commit is contained in:
@@ -32,15 +32,13 @@ static void append_and_translate(ExPolygons &dst, const ExPolygons &src, const P
|
|||||||
for (; dst_idx < dst.size(); ++dst_idx)
|
for (; dst_idx < dst.size(); ++dst_idx)
|
||||||
dst[dst_idx].translate(instance_shift);
|
dst[dst_idx].translate(instance_shift);
|
||||||
}
|
}
|
||||||
// BBS: generate brim area by objs
|
// Orca: Translate the brim area into print coordinates and store it per instance.
|
||||||
static void append_and_translate(ExPolygons& dst, const ExPolygons& src,
|
static void append_and_translate(const ExPolygons& src, const PrintInstance& instance,
|
||||||
const PrintInstance& instance, size_t instance_idx, std::map<ObjectInstanceID, ExPolygons>& brimAreaMap) {
|
size_t instance_idx, std::map<ObjectInstanceID, ExPolygons>& brimAreaMap) {
|
||||||
ExPolygons srcShifted = src;
|
ExPolygons srcShifted = src;
|
||||||
Point instance_shift = instance.shift_without_plate_offset();
|
Point instance_shift = instance.shift_without_plate_offset();
|
||||||
for (size_t src_idx = 0; src_idx < srcShifted.size(); ++src_idx)
|
for (ExPolygon& expoly : srcShifted)
|
||||||
srcShifted[src_idx].translate(instance_shift);
|
expoly.translate(instance_shift);
|
||||||
srcShifted = diff_ex(srcShifted, dst);
|
|
||||||
//expolygons_append(dst, temp2);
|
|
||||||
expolygons_append(brimAreaMap[{ instance.print_object->id(), instance_idx }], std::move(srcShifted));
|
expolygons_append(brimAreaMap[{ instance.print_object->id(), instance_idx }], std::move(srcShifted));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,7 +570,7 @@ static ExPolygons outer_inner_brim_area(const Print& print,
|
|||||||
for (size_t instance_idx = 0; instance_idx < object->instances().size(); ++instance_idx) {
|
for (size_t instance_idx = 0; instance_idx < object->instances().size(); ++instance_idx) {
|
||||||
const PrintInstance& instance = object->instances()[instance_idx];
|
const PrintInstance& instance = object->instances()[instance_idx];
|
||||||
if (!brim_area_object.empty())
|
if (!brim_area_object.empty())
|
||||||
append_and_translate(brim_area, brim_area_object, instance, instance_idx, brimAreaMap);
|
append_and_translate(brim_area_object, instance, instance_idx, brimAreaMap);
|
||||||
append_and_translate(no_brim_area, no_brim_area_object, instance);
|
append_and_translate(no_brim_area, no_brim_area_object, instance);
|
||||||
append_and_translate(holes, holes_object, instance);
|
append_and_translate(holes, holes_object, instance);
|
||||||
append_and_translate(objectIslands, objectIsland, instance);
|
append_and_translate(objectIslands, objectIsland, instance);
|
||||||
@@ -875,6 +873,14 @@ void make_brim(const Print& print, PrintTryCancel try_cancel, Polygons& islands_
|
|||||||
ExPolygons islands_area_ex = outer_inner_brim_area(print,
|
ExPolygons islands_area_ex = outer_inner_brim_area(print,
|
||||||
float(flow.scaled_spacing()), brimAreaMap, objPrintVec, printExtruders);
|
float(flow.scaled_spacing()), brimAreaMap, objPrintVec, printExtruders);
|
||||||
|
|
||||||
|
if (!print.config().combine_brims) {
|
||||||
|
ExPolygons claimed_area;
|
||||||
|
for (auto& [_, areas] : brimAreaMap) {
|
||||||
|
areas = diff_ex(areas, claimed_area);
|
||||||
|
expolygons_append(claimed_area, areas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BBS: Find boundingbox of the first layer
|
// BBS: Find boundingbox of the first layer
|
||||||
for (const ObjectID printObjID : print.print_object_ids()) {
|
for (const ObjectID printObjID : print.print_object_ids()) {
|
||||||
BoundingBox bbx;
|
BoundingBox bbx;
|
||||||
|
|||||||
@@ -153,6 +153,24 @@ TEST_CASE("Object brims are generated per instance", "[SkirtBrim]")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Uncombined neighboring brims precede their respective objects", "[SkirtBrim]")
|
||||||
|
{
|
||||||
|
Print print;
|
||||||
|
Model model;
|
||||||
|
place_two_cubes_apart(0, {
|
||||||
|
{ "skirt_loops", 0 },
|
||||||
|
{ "brim_type", "outer_only" },
|
||||||
|
{ "brim_width", 5 },
|
||||||
|
{ "combine_brims", 0 },
|
||||||
|
}, print, model);
|
||||||
|
print.process();
|
||||||
|
|
||||||
|
REQUIRE(print.skirt_brim_groups().size() == 1);
|
||||||
|
REQUIRE(print.skirt_brim_groups().front().brims.size() == 2);
|
||||||
|
CHECK(role_sequence(gcode(print), { "brim", "perimeter" }) ==
|
||||||
|
std::vector<std::string>{ "brim", "perimeter", "brim", "perimeter" });
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("Combine brims merges neighboring object instances", "[SkirtBrim]")
|
TEST_CASE("Combine brims merges neighboring object instances", "[SkirtBrim]")
|
||||||
{
|
{
|
||||||
Print print;
|
Print print;
|
||||||
|
|||||||
Reference in New Issue
Block a user