Skip to content

Commit

Permalink
Object skirt refactoring and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vovodroid committed Aug 18, 2024
1 parent e73638a commit e9475dc
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2341,34 +2341,32 @@ void Print::_make_skirt()
append(m_skirt_convex_hull, std::move(poly.points));

// BBS
const int n_object_skirts = 1;
const double object_skirt_distance = scale_(1.0);
for (auto obj_cvx_hull : object_convex_hulls) {
PrintObject* object = obj_cvx_hull.first;
for (int i = 0; i < n_object_skirts; i++) {
distance += float(scale_(spacing));
Polygon loop;
{
// BBS. skirt_distance is defined as the gap between skirt and outer most brim, so no need to add max_brim_width
Polygons loops = offset(obj_cvx_hull.second, object_skirt_distance, ClipperLib::jtRound, float(scale_(0.1)));
Geometry::simplify_polygons(loops, scale_(0.05), &loops);
if (loops.empty())
break;
loop = loops.front();
}

// Extrude the skirt loop.
ExtrusionLoop eloop(elrSkirt);
eloop.paths.emplace_back(ExtrusionPath(
ExtrusionPath(
erSkirt,
(float)mm3_per_mm, // this will be overridden at G-code export time
flow.width(),
(float)initial_layer_print_height // this will be overridden at G-code export time
)));
eloop.paths.back().polyline = loop.split_at_first_point();
object->m_skirt.append(std::move(eloop));
object->m_skirt.clear();
distance += float(scale_(spacing));
Polygon loop;
{
// BBS. skirt_distance is defined as the gap between skirt and outer most brim, so no need to add max_brim_width
Polygons loops = offset(obj_cvx_hull.second, object_skirt_distance, ClipperLib::jtRound, float(scale_(0.1)));
Geometry::simplify_polygons(loops, scale_(0.05), &loops);
if (loops.empty())
break;
loop = loops.front();
}

// Extrude the skirt loop.
ExtrusionLoop eloop(elrSkirt);
eloop.paths.emplace_back(ExtrusionPath(
ExtrusionPath(
erSkirt,
(float)mm3_per_mm, // this will be overridden at G-code export time
flow.width(),
(float)initial_layer_print_height // this will be overridden at G-code export time
)));
eloop.paths.back().polyline = loop.split_at_first_point();
object->m_skirt.append(std::move(eloop));
}
}

Expand Down

0 comments on commit e9475dc

Please sign in to comment.