mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-08 16:19:09 +08:00
Proper fix for SPE-324
This commit is contained in:
parent
f3591d2a85
commit
d337fec8af
@ -331,20 +331,27 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) {
|
|||||||
for(auto objinst : objptr->instances) {
|
for(auto objinst : objptr->instances) {
|
||||||
if(objinst) {
|
if(objinst) {
|
||||||
Slic3r::TriangleMesh tmpmesh = rmesh;
|
Slic3r::TriangleMesh tmpmesh = rmesh;
|
||||||
// objinst->transform_mesh(&tmpmesh);
|
|
||||||
ClipperLib::PolyNode pn;
|
ClipperLib::PolyNode pn;
|
||||||
|
|
||||||
|
// TODO export the exact 2D projection
|
||||||
auto p = tmpmesh.convex_hull();
|
auto p = tmpmesh.convex_hull();
|
||||||
|
|
||||||
p.make_clockwise();
|
p.make_clockwise();
|
||||||
p.append(p.first_point());
|
p.append(p.first_point());
|
||||||
pn.Contour = Slic3rMultiPoint_to_ClipperPath( p );
|
pn.Contour = Slic3rMultiPoint_to_ClipperPath( p );
|
||||||
|
|
||||||
|
// Efficient conversion to item.
|
||||||
Item item(std::move(pn));
|
Item item(std::move(pn));
|
||||||
item.rotation(objinst->rotation);
|
|
||||||
item.translation( {
|
// Invalid geometries would throw exceptions when arranging
|
||||||
ClipperLib::cInt(objinst->offset.x/SCALING_FACTOR),
|
if(item.vertexCount() > 3) {
|
||||||
ClipperLib::cInt(objinst->offset.y/SCALING_FACTOR)
|
item.rotation(objinst->rotation);
|
||||||
});
|
item.translation( {
|
||||||
ret.emplace_back(objinst, item);
|
ClipperLib::cInt(objinst->offset.x/SCALING_FACTOR),
|
||||||
|
ClipperLib::cInt(objinst->offset.y/SCALING_FACTOR)
|
||||||
|
});
|
||||||
|
ret.emplace_back(objinst, item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -437,7 +444,8 @@ bool arrange(Model &model, coordf_t dist, const Slic3r::BoundingBoxf* bb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(it.second.vertexCount() > 3) shapes.push_back(std::ref(it.second));
|
shapes.push_back(std::ref(it.second));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Box bin;
|
Box bin;
|
||||||
@ -463,15 +471,17 @@ bool arrange(Model &model, coordf_t dist, const Slic3r::BoundingBoxf* bb,
|
|||||||
// Will use the DJD selection heuristic with the BottomLeft placement
|
// Will use the DJD selection heuristic with the BottomLeft placement
|
||||||
// strategy
|
// strategy
|
||||||
using Arranger = Arranger<NfpPlacer, DJDHeuristic>;
|
using Arranger = Arranger<NfpPlacer, DJDHeuristic>;
|
||||||
|
using PConf = Arranger::PlacementConfig;
|
||||||
|
using SConf = Arranger::SelectionConfig;
|
||||||
|
|
||||||
Arranger::PlacementConfig pcfg;
|
PConf pcfg;
|
||||||
Arranger::SelectionConfig scfg;
|
SConf scfg;
|
||||||
|
|
||||||
scfg.try_reverse_order = true;
|
scfg.try_reverse_order = true;
|
||||||
scfg.allow_parallel = true;
|
scfg.allow_parallel = true;
|
||||||
scfg.force_parallel = true;
|
scfg.force_parallel = true;
|
||||||
|
|
||||||
pcfg.alignment = Arranger::PlacementConfig::Alignment::CENTER;
|
pcfg.alignment = PConf::Alignment::CENTER;
|
||||||
|
|
||||||
// TODO cannot use rotations until multiple objects of same geometry can
|
// TODO cannot use rotations until multiple objects of same geometry can
|
||||||
// handle different rotations
|
// handle different rotations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user