mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 21:55:56 +08:00
Merge branch 'master' into fs_CenterSupportForIsland
This commit is contained in:
commit
f0e78414a0
@ -546,10 +546,24 @@ WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<fl
|
||||
m_extra_loading_move = float(config.extra_loading_move);
|
||||
m_set_extruder_trimpot = config.high_current_on_filament_swap;
|
||||
}
|
||||
// Calculate where the priming lines should be - very naive test not detecting parallelograms or custom shapes
|
||||
// Calculate where the priming lines should be - very naive test not detecting parallelograms etc.
|
||||
const std::vector<Vec2d>& bed_points = config.bed_shape.values;
|
||||
BoundingBoxf bb(bed_points);
|
||||
m_bed_width = float(bb.size().x());
|
||||
m_bed_shape = (bed_points.size() == 4 ? RectangularBed : CircularBed);
|
||||
m_bed_width = float(BoundingBoxf(bed_points).size().x());
|
||||
|
||||
if (m_bed_shape == CircularBed) {
|
||||
// this may still be a custom bed, check that the points are roughly on a circle
|
||||
double r2 = std::pow(m_bed_width/2., 2.);
|
||||
double lim2 = std::pow(m_bed_width/10., 2.);
|
||||
Vec2d center = bb.center();
|
||||
for (const Vec2d& pt : bed_points)
|
||||
if (std::abs(std::pow(pt.x()-center.x(), 2.) + std::pow(pt.y()-center.y(), 2.) - r2) > lim2) {
|
||||
m_bed_shape = CustomBed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_bed_bottom_left = m_bed_shape == RectangularBed
|
||||
? Vec2f(bed_points.front().x(), bed_points.front().y())
|
||||
: Vec2f::Zero();
|
||||
@ -628,7 +642,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
|
||||
// In case of a circular bed, place it so it goes across the diameter and hope it will fit
|
||||
if (m_bed_shape == CircularBed)
|
||||
cleaning_box.translate(-m_bed_width/2 + m_bed_width * 0.03f, -m_bed_width * 0.12f);
|
||||
if (m_bed_shape == RectangularBed)
|
||||
else
|
||||
cleaning_box.translate(m_bed_bottom_left);
|
||||
|
||||
std::vector<ToolChangeResult> results;
|
||||
|
@ -277,7 +277,8 @@ private:
|
||||
// Bed properties
|
||||
enum {
|
||||
RectangularBed,
|
||||
CircularBed
|
||||
CircularBed,
|
||||
CustomBed
|
||||
} m_bed_shape;
|
||||
float m_bed_width; // width of the bed bounding box
|
||||
Vec2f m_bed_bottom_left; // bottom-left corner coordinates (for rectangular beds)
|
||||
|
Loading…
x
Reference in New Issue
Block a user