FIX: skip gcode path conflict check for adaptive layer height
adaptive layer height won't work with conflict checker because m_fake_wipe_tower's path is generated using fixed layer height. Jira: STUDIO-4442 Change-Id: I964a69af2fa0be8224ffc11e4c86f8ccf6dbf152 (cherry picked from commit e8c915f9e0b8c8f6cb549259b20d6d850a06d7d3)
This commit is contained in:
parent
c00f944308
commit
c5db5551bf
|
@ -91,34 +91,34 @@ inline Grids line_rasterization(const Line &line, int64_t xdist = RasteXDistance
|
||||||
|
|
||||||
void LinesBucketQueue::emplace_back_bucket(ExtrusionLayers &&els, const void *objPtr, Point offset)
|
void LinesBucketQueue::emplace_back_bucket(ExtrusionLayers &&els, const void *objPtr, Point offset)
|
||||||
{
|
{
|
||||||
auto oldSize = _buckets.capacity();
|
auto oldSize = line_buckets.capacity();
|
||||||
_buckets.emplace_back(std::move(els), objPtr, offset);
|
line_buckets.emplace_back(std::move(els), objPtr, offset);
|
||||||
_pq.push(&_buckets.back());
|
line_bucket_ptr_queue.push(&line_buckets.back());
|
||||||
auto newSize = _buckets.capacity();
|
auto newSize = line_buckets.capacity();
|
||||||
if (oldSize != newSize) { // pointers change
|
if (oldSize != newSize) { // pointers change
|
||||||
decltype(_pq) newQueue;
|
decltype(line_bucket_ptr_queue) newQueue;
|
||||||
for (LinesBucket &bucket : _buckets) { newQueue.push(&bucket); }
|
for (LinesBucket &bucket : line_buckets) { newQueue.push(&bucket); }
|
||||||
std::swap(_pq, newQueue);
|
std::swap(line_bucket_ptr_queue, newQueue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove lowest and get the current bottom z
|
// remove lowest and get the current bottom z
|
||||||
float LinesBucketQueue::getCurrBottomZ()
|
float LinesBucketQueue::getCurrBottomZ()
|
||||||
{
|
{
|
||||||
auto lowest = _pq.top();
|
auto lowest = line_bucket_ptr_queue.top();
|
||||||
_pq.pop();
|
line_bucket_ptr_queue.pop();
|
||||||
float layerBottomZ = lowest->curBottomZ();
|
float layerBottomZ = lowest->curBottomZ();
|
||||||
std::vector<LinesBucket *> lowests;
|
std::vector<LinesBucket *> lowests;
|
||||||
lowests.push_back(lowest);
|
lowests.push_back(lowest);
|
||||||
|
|
||||||
while (_pq.empty() == false && std::abs(_pq.top()->curBottomZ() - lowest->curBottomZ()) < EPSILON) {
|
while (line_bucket_ptr_queue.empty() == false && std::abs(line_bucket_ptr_queue.top()->curBottomZ() - lowest->curBottomZ()) < EPSILON) {
|
||||||
lowests.push_back(_pq.top());
|
lowests.push_back(line_bucket_ptr_queue.top());
|
||||||
_pq.pop();
|
line_bucket_ptr_queue.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LinesBucket *bp : lowests) {
|
for (LinesBucket *bp : lowests) {
|
||||||
bp->raise();
|
bp->raise();
|
||||||
if (bp->valid()) { _pq.push(bp); }
|
if (bp->valid()) { line_bucket_ptr_queue.push(bp); }
|
||||||
}
|
}
|
||||||
return layerBottomZ;
|
return layerBottomZ;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ float LinesBucketQueue::getCurrBottomZ()
|
||||||
LineWithIDs LinesBucketQueue::getCurLines() const
|
LineWithIDs LinesBucketQueue::getCurLines() const
|
||||||
{
|
{
|
||||||
LineWithIDs lines;
|
LineWithIDs lines;
|
||||||
for (const LinesBucket &bucket : _buckets) {
|
for (const LinesBucket &bucket : line_buckets) {
|
||||||
if (bucket.valid()) {
|
if (bucket.valid()) {
|
||||||
LineWithIDs tmpLines = bucket.curLines();
|
LineWithIDs tmpLines = bucket.curLines();
|
||||||
lines.insert(lines.end(), tmpLines.begin(), tmpLines.end());
|
lines.insert(lines.end(), tmpLines.begin(), tmpLines.end());
|
||||||
|
|
|
@ -109,12 +109,12 @@ struct LinesBucketPtrComp
|
||||||
class LinesBucketQueue
|
class LinesBucketQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<LinesBucket> _buckets;
|
std::vector<LinesBucket> line_buckets;
|
||||||
std::priority_queue<LinesBucket *, std::vector<LinesBucket *>, LinesBucketPtrComp> _pq;
|
std::priority_queue<LinesBucket *, std::vector<LinesBucket *>, LinesBucketPtrComp> line_bucket_ptr_queue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void emplace_back_bucket(ExtrusionLayers &&els, const void *objPtr, Point offset);
|
void emplace_back_bucket(ExtrusionLayers &&els, const void *objPtr, Point offset);
|
||||||
bool valid() const { return _pq.empty() == false; }
|
bool valid() const { return line_bucket_ptr_queue.empty() == false; }
|
||||||
float getCurrBottomZ();
|
float getCurrBottomZ();
|
||||||
LineWithIDs getCurLines() const;
|
LineWithIDs getCurLines() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1797,7 +1797,15 @@ void Print::process(bool use_cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
if(!m_no_check)
|
bool has_adaptive_layer_height = false;
|
||||||
|
for (PrintObject* obj : m_objects) {
|
||||||
|
if (obj->model_object()->layer_height_profile.empty() == false) {
|
||||||
|
has_adaptive_layer_height = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO adaptive layer height won't work with conflict checker because m_fake_wipe_tower's path is generated using fixed layer height
|
||||||
|
if(!m_no_check && !has_adaptive_layer_height)
|
||||||
{
|
{
|
||||||
using Clock = std::chrono::high_resolution_clock;
|
using Clock = std::chrono::high_resolution_clock;
|
||||||
auto startTime = Clock::now();
|
auto startTime = Clock::now();
|
||||||
|
|
|
@ -565,8 +565,6 @@ struct FakeWipeTower
|
||||||
|
|
||||||
std::vector<ExtrusionPaths> getFakeExtrusionPathsFromWipeTower() const
|
std::vector<ExtrusionPaths> getFakeExtrusionPathsFromWipeTower() const
|
||||||
{
|
{
|
||||||
float h = height;
|
|
||||||
float lh = layer_height;
|
|
||||||
int d = scale_(depth);
|
int d = scale_(depth);
|
||||||
int w = scale_(width);
|
int w = scale_(width);
|
||||||
int bd = scale_(brim_width);
|
int bd = scale_(brim_width);
|
||||||
|
@ -574,13 +572,13 @@ struct FakeWipeTower
|
||||||
Point maxCorner = {minCorner.x() + w, minCorner.y() + d};
|
Point maxCorner = {minCorner.x() + w, minCorner.y() + d};
|
||||||
|
|
||||||
std::vector<ExtrusionPaths> paths;
|
std::vector<ExtrusionPaths> paths;
|
||||||
for (float hh = 0.f; hh < h; hh += lh) {
|
for (float h = 0.f; h < height; h += layer_height) {
|
||||||
ExtrusionPath path(ExtrusionRole::erWipeTower, 0.0, 0.0, lh);
|
ExtrusionPath path(ExtrusionRole::erWipeTower, 0.0, 0.0, layer_height);
|
||||||
path.polyline = {minCorner, {maxCorner.x(), minCorner.y()}, maxCorner, {minCorner.x(), maxCorner.y()}, minCorner};
|
path.polyline = {minCorner, {maxCorner.x(), minCorner.y()}, maxCorner, {minCorner.x(), maxCorner.y()}, minCorner};
|
||||||
paths.push_back({path});
|
paths.push_back({path});
|
||||||
|
|
||||||
if (hh == 0.f) { // add brim
|
if (h == 0.f) { // add brim
|
||||||
ExtrusionPath fakeBrim(ExtrusionRole::erBrim, 0.0, 0.0, lh);
|
ExtrusionPath fakeBrim(ExtrusionRole::erBrim, 0.0, 0.0, layer_height);
|
||||||
Point wtbminCorner = {minCorner - Point{bd, bd}};
|
Point wtbminCorner = {minCorner - Point{bd, bd}};
|
||||||
Point wtbmaxCorner = {maxCorner + Point{bd, bd}};
|
Point wtbmaxCorner = {maxCorner + Point{bd, bd}};
|
||||||
fakeBrim.polyline = {wtbminCorner, {wtbmaxCorner.x(), wtbminCorner.y()}, wtbmaxCorner, {wtbminCorner.x(), wtbmaxCorner.y()}, wtbminCorner};
|
fakeBrim.polyline = {wtbminCorner, {wtbmaxCorner.x(), wtbminCorner.y()}, wtbmaxCorner, {wtbminCorner.x(), wtbmaxCorner.y()}, wtbminCorner};
|
||||||
|
|
Loading…
Reference in New Issue