mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-01 21:21:10 -06:00
ENH: auto-arranging allows more filaments together
Auto-arranging allows more filaments to be printed on the same plate Only HighTemp and LowTemp filaments are not allowed on the same plate. Jira: https://jira.bambooolab.com/browse/STUDIO-4682 Change-Id: I1bd4966e6aaa55a6dd9dff05f0bd94f2795a62b0 (cherry picked from commit 965040912af0555ca190702e7c7ac92e177a2922)
This commit is contained in:
parent
7b93986dfa
commit
d64031a054
7 changed files with 159 additions and 91 deletions
|
|
@ -69,13 +69,14 @@ class _Item {
|
|||
Box bb; bool valid;
|
||||
BBCache(): valid(false) {}
|
||||
} bb_cache_;
|
||||
|
||||
|
||||
int binid_{BIN_ID_UNSET}, priority_{0};
|
||||
bool fixed_{false};
|
||||
|
||||
public:
|
||||
int itemid_{ 0 };
|
||||
std::vector<int> extrude_ids;
|
||||
int filament_temp_type = -1; // -1 means unset. otherwise should be {0,1,2}
|
||||
double height{ 0 };
|
||||
double print_temp{ 0 };
|
||||
double bed_temp{ 0 };
|
||||
|
|
@ -140,7 +141,7 @@ public:
|
|||
inline _Item(TContour<RawShape>&& contour,
|
||||
THolesContainer<RawShape>&& holes):
|
||||
sh_(sl::create<RawShape>(std::move(contour), std::move(holes))) {}
|
||||
|
||||
|
||||
inline bool isFixed() const noexcept { return fixed_; }
|
||||
inline void markAsFixedInBin(int binid)
|
||||
{
|
||||
|
|
@ -150,7 +151,7 @@ public:
|
|||
|
||||
inline void binId(int idx) { binid_ = idx; }
|
||||
inline int binId() const noexcept { return binid_; }
|
||||
|
||||
|
||||
inline void priority(int p) { priority_ = p; }
|
||||
inline int priority() const noexcept { return priority_; }
|
||||
|
||||
|
|
@ -303,18 +304,18 @@ public:
|
|||
{
|
||||
rotation(rotation() + rads);
|
||||
}
|
||||
|
||||
|
||||
inline void inflation(Coord distance) BP2D_NOEXCEPT
|
||||
{
|
||||
inflation_ = distance;
|
||||
has_inflation_ = true;
|
||||
invalidateCache();
|
||||
}
|
||||
|
||||
|
||||
inline Coord inflation() const BP2D_NOEXCEPT {
|
||||
return inflation_;
|
||||
}
|
||||
|
||||
|
||||
inline void inflate(Coord distance) BP2D_NOEXCEPT
|
||||
{
|
||||
inflation(inflation() + distance);
|
||||
|
|
@ -780,7 +781,7 @@ template<class PlacementStrategy, class SelectionStrategy >
|
|||
class _Nester {
|
||||
using TSel = SelectionStrategyLike<SelectionStrategy>;
|
||||
TSel selector_;
|
||||
|
||||
|
||||
public:
|
||||
using Item = typename PlacementStrategy::Item;
|
||||
using ShapeType = typename Item::ShapeType;
|
||||
|
|
@ -805,7 +806,7 @@ private:
|
|||
StopCondition stopfn_;
|
||||
|
||||
template<class It> using TVal = remove_ref_t<typename It::value_type>;
|
||||
|
||||
|
||||
template<class It, class Out>
|
||||
using ItemIteratorOnly =
|
||||
enable_if_t<std::is_convertible<TVal<It>&, TPItem&>::value, Out>;
|
||||
|
|
@ -863,14 +864,14 @@ public:
|
|||
if(infl > 0) std::for_each(from, to, [infl](Item& item) {
|
||||
item.inflate(infl);
|
||||
});
|
||||
|
||||
|
||||
selector_.template packItems<PlacementStrategy>(
|
||||
from, to, bin_, pconfig_);
|
||||
|
||||
|
||||
if(min_obj_distance_ > 0) std::for_each(from, to, [infl](Item& item) {
|
||||
item.inflate(-infl);
|
||||
});
|
||||
|
||||
|
||||
return selector_.getResult().size();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue