mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 04:15:52 +08:00
Temporarily disable rotations for wipe tower when arranging
It is problematic due to varying interpretation of rotation in arrange and slicer's wipe tower handling fixes SPE-1787
This commit is contained in:
parent
5b9d5b55b6
commit
0c0a1af1e9
@ -225,6 +225,9 @@ void fill_rotations(const Range<It> &items,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto &itm : items) {
|
for (auto &itm : items) {
|
||||||
|
if (is_wipe_tower(itm)) // Rotating the wipe tower is currently problematic
|
||||||
|
continue;
|
||||||
|
|
||||||
// Use the minimum bounding box rotation as a starting point.
|
// Use the minimum bounding box rotation as a starting point.
|
||||||
auto minbbr = get_min_area_bounding_box_rotation(itm);
|
auto minbbr = get_min_area_bounding_box_rotation(itm);
|
||||||
std::vector<double> rotations =
|
std::vector<double> rotations =
|
||||||
|
@ -115,20 +115,14 @@ struct ArrangeableWipeTowerBase: public Arrangeable
|
|||||||
ObjectID oid;
|
ObjectID oid;
|
||||||
|
|
||||||
Polygon poly;
|
Polygon poly;
|
||||||
Point pos = Point::Zero();
|
|
||||||
double rot = 0.;
|
|
||||||
SelectionPredicate selection_pred;
|
SelectionPredicate selection_pred;
|
||||||
|
|
||||||
ArrangeableWipeTowerBase(
|
ArrangeableWipeTowerBase(
|
||||||
const ObjectID &objid,
|
const ObjectID &objid,
|
||||||
Polygon shape,
|
Polygon shape,
|
||||||
const Point &p,
|
|
||||||
double r,
|
|
||||||
SelectionPredicate selection_predicate = [] { return false; })
|
SelectionPredicate selection_predicate = [] { return false; })
|
||||||
: oid{objid},
|
: oid{objid},
|
||||||
poly{std::move(shape)},
|
poly{std::move(shape)},
|
||||||
pos{p},
|
|
||||||
rot{r},
|
|
||||||
selection_pred{std::move(selection_predicate)}
|
selection_pred{std::move(selection_predicate)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -138,15 +132,12 @@ struct ArrangeableWipeTowerBase: public Arrangeable
|
|||||||
ExPolygons full_outline() const override
|
ExPolygons full_outline() const override
|
||||||
{
|
{
|
||||||
auto cpy = poly;
|
auto cpy = poly;
|
||||||
cpy.translate(pos);
|
return {ExPolygon{std::move(cpy)}};
|
||||||
return {ExPolygon{cpy}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygon convex_outline() const override
|
Polygon convex_outline() const override
|
||||||
{
|
{
|
||||||
auto cpy = poly;
|
return poly;
|
||||||
cpy.translate(pos);
|
|
||||||
return cpy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_selected() const override
|
bool is_selected() const override
|
||||||
|
@ -65,29 +65,21 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WipeTowerGeometry
|
static Polygon get_wtpoly(const GLCanvas3D::WipeTowerInfo &wti)
|
||||||
{
|
{
|
||||||
Polygon poly;
|
|
||||||
Point pos = Point::Zero();
|
|
||||||
double rot = 0.;
|
|
||||||
};
|
|
||||||
|
|
||||||
static WipeTowerGeometry get_wtg(const GLCanvas3D::WipeTowerInfo &wti)
|
|
||||||
{
|
|
||||||
WipeTowerGeometry ret;
|
|
||||||
|
|
||||||
auto bb = scaled(wti.bounding_box());
|
auto bb = scaled(wti.bounding_box());
|
||||||
ret.poly = Polygon({
|
Polygon poly = Polygon({
|
||||||
{bb.min},
|
{bb.min},
|
||||||
{bb.max.x(), bb.min.y()},
|
{bb.max.x(), bb.min.y()},
|
||||||
{bb.max},
|
{bb.max},
|
||||||
{bb.min.x(), bb.max.y()}
|
{bb.min.x(), bb.max.y()}
|
||||||
});
|
});
|
||||||
|
|
||||||
ret.pos = scaled(wti.pos());
|
poly.rotate(wti.rotation());
|
||||||
ret.rot = wti.rotation();
|
poly.translate(scaled(wti.pos()));
|
||||||
|
|
||||||
return ret;
|
return poly;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wipe tower logic based on GLCanvas3D::WipeTowerInfo implements the Arrangeable
|
// Wipe tower logic based on GLCanvas3D::WipeTowerInfo implements the Arrangeable
|
||||||
@ -95,18 +87,24 @@ static WipeTowerGeometry get_wtg(const GLCanvas3D::WipeTowerInfo &wti)
|
|||||||
class ArrangeableWT: public arr2::ArrangeableWipeTowerBase
|
class ArrangeableWT: public arr2::ArrangeableWipeTowerBase
|
||||||
{
|
{
|
||||||
BoundingBox m_xl_bb;
|
BoundingBox m_xl_bb;
|
||||||
|
Vec2d m_orig_tr;
|
||||||
|
double m_orig_rot;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArrangeableWT(const ObjectID &oid,
|
explicit ArrangeableWT(const ObjectID &oid,
|
||||||
const WipeTowerGeometry &wtg,
|
const GLCanvas3D::WipeTowerInfo &wti,
|
||||||
std::function<bool()> sel_pred,
|
std::function<bool()> sel_pred,
|
||||||
const BoundingBox xl_bb = {})
|
const BoundingBox xl_bb = {})
|
||||||
: arr2::ArrangeableWipeTowerBase{oid, wtg.poly, wtg.pos, wtg.rot,
|
: arr2::ArrangeableWipeTowerBase{oid, get_wtpoly(wti), std::move(sel_pred)}
|
||||||
std::move(sel_pred)}, m_xl_bb{xl_bb}
|
, m_orig_tr{wti.pos()}
|
||||||
|
, m_orig_rot{wti.rotation()}
|
||||||
|
, m_xl_bb{xl_bb}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void transform(const Vec2d &transl, double rot) override
|
// Rotation is disabled for wipe tower in arrangement
|
||||||
|
void transform(const Vec2d &transl, double /*rot*/) override
|
||||||
{
|
{
|
||||||
GLCanvas3D::WipeTowerInfo::apply_wipe_tower(unscaled(pos) + transl, rot);
|
GLCanvas3D::WipeTowerInfo::apply_wipe_tower(m_orig_tr + transl, m_orig_rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void imbue_data(arr2::AnyWritable &datastore) const override
|
void imbue_data(arr2::AnyWritable &datastore) const override
|
||||||
@ -142,8 +140,7 @@ struct WTH : public arr2::WipeTowerHandler
|
|||||||
template<class Self, class Fn>
|
template<class Self, class Fn>
|
||||||
static void visit_(Self &&self, Fn &&fn)
|
static void visit_(Self &&self, Fn &&fn)
|
||||||
{
|
{
|
||||||
auto wtg = get_wtg(self.wti);
|
ArrangeableWT wta{self.oid, self.wti, self.sel_pred, self.xl_bb};
|
||||||
ArrangeableWT wta{self.oid, wtg, self.sel_pred, self.xl_bb};
|
|
||||||
fn(wta);
|
fn(wta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,12 +882,12 @@ public:
|
|||||||
|
|
||||||
void visit(std::function<void(Arrangeable &)> fn) override
|
void visit(std::function<void(Arrangeable &)> fn) override
|
||||||
{
|
{
|
||||||
MocWT wt{m_id, Polygon{}, Point::Zero(), 0., m_sel_pred};
|
MocWT wt{m_id, Polygon{}, m_sel_pred};
|
||||||
fn(wt);
|
fn(wt);
|
||||||
}
|
}
|
||||||
void visit(std::function<void(const Arrangeable &)> fn) const override
|
void visit(std::function<void(const Arrangeable &)> fn) const override
|
||||||
{
|
{
|
||||||
MocWT wt{m_id, Polygon{}, Point::Zero(), 0., m_sel_pred};
|
MocWT wt{m_id, Polygon{}, m_sel_pred};
|
||||||
fn(wt);
|
fn(wt);
|
||||||
}
|
}
|
||||||
void set_selection_predicate(std::function<bool()> pred) override
|
void set_selection_predicate(std::function<bool()> pred) override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user