mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 04:52:02 +08:00
Fix SPE-2068: Helical layer change generating travels out of bounds.
This commit is contained in:
parent
e298593a2e
commit
c3132e91c8
@ -2666,21 +2666,18 @@ std::optional<std::string> GCodeGenerator::get_helical_layer_change_gcode(
|
|||||||
|
|
||||||
const Point n_gon_start_point{this->last_pos()};
|
const Point n_gon_start_point{this->last_pos()};
|
||||||
|
|
||||||
static GCode::Impl::LayerChanges::Bed bed{
|
GCode::Impl::LayerChanges::Bed bed{
|
||||||
this->m_config.bed_shape.values,
|
this->m_config.bed_shape.values,
|
||||||
circle_radius
|
circle_radius * 2
|
||||||
};
|
};
|
||||||
if (!bed.contains_within_padding(this->point_to_gcode(n_gon_start_point))) {
|
if (!bed.contains_within_padding(this->point_to_gcode(n_gon_start_point))) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Point n_gon_centeroid{
|
const Vec2crd n_gon_vector{scaled(Vec2d{
|
||||||
n_gon_start_point
|
(bed.centroid - this->point_to_gcode(n_gon_start_point)).normalized() * circle_radius
|
||||||
+ scaled(Vec2d{
|
})};
|
||||||
(bed.centroid - unscaled(n_gon_start_point)).normalized()
|
const Point n_gon_centeroid{n_gon_start_point + n_gon_vector};
|
||||||
* circle_radius
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
const Polygon n_gon{GCode::Impl::LayerChanges::generate_regular_polygon(
|
const Polygon n_gon{GCode::Impl::LayerChanges::generate_regular_polygon(
|
||||||
n_gon_centeroid,
|
n_gon_centeroid,
|
||||||
|
@ -43,6 +43,11 @@ Polygon Bed::get_inner_offset(const std::vector<Vec2d> &shape, const double padd
|
|||||||
transform(begin(shape), end(shape), back_inserter(shape_scaled), [](const Vec2d &point) {
|
transform(begin(shape), end(shape), back_inserter(shape_scaled), [](const Vec2d &point) {
|
||||||
return scaled(point);
|
return scaled(point);
|
||||||
});
|
});
|
||||||
return shrink({Polygon{shape_scaled}}, scaled(padding)).front();
|
const Polygons inner_offset{shrink({Polygon{shape_scaled}}, scaled(padding))};
|
||||||
|
if (inner_offset.empty()) {
|
||||||
|
return Polygon{};
|
||||||
|
}
|
||||||
|
return inner_offset.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Slic3r::GCode::Impl::LayerChanges
|
} // namespace Slic3r::GCode::Impl::LayerChanges
|
||||||
|
Loading…
x
Reference in New Issue
Block a user