Fix up build and clear dev output

This commit is contained in:
tamasmeszaros 2019-08-16 16:31:05 +02:00
parent 7e0199746e
commit c187a5fb69
3 changed files with 26 additions and 54 deletions

View file

@ -96,23 +96,6 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool
this->collect_extruder_statistics(prime_multi_material); this->collect_extruder_statistics(prime_multi_material);
} }
LayerTools& ToolOrdering::tools_for_layer(coordf_t print_z)
{
auto it_layer_tools = std::lower_bound(m_layer_tools.begin(), m_layer_tools.end(), LayerTools(print_z - EPSILON));
assert(it_layer_tools != m_layer_tools.end());
coordf_t dist_min = std::abs(it_layer_tools->print_z - print_z);
for (++ it_layer_tools; it_layer_tools != m_layer_tools.end(); ++it_layer_tools) {
coordf_t d = std::abs(it_layer_tools->print_z - print_z);
if (d >= dist_min)
break;
dist_min = d;
}
-- it_layer_tools;
assert(dist_min < EPSILON);
return *it_layer_tools;
}
void ToolOrdering::initialize_layers(std::vector<coordf_t> &zs) void ToolOrdering::initialize_layers(std::vector<coordf_t> &zs)
{ {
sort_remove_duplicates(zs); sort_remove_duplicates(zs);
@ -151,7 +134,7 @@ void ToolOrdering::collect_extruders(const PrintObject &object)
LayerTools &layer_tools = this->tools_for_layer(layer->print_z); LayerTools &layer_tools = this->tools_for_layer(layer->print_z);
// What extruders are required to print this object layer? // What extruders are required to print this object layer?
for (size_t region_id = 0; region_id < object.region_volumes.size(); ++ region_id) { for (size_t region_id = 0; region_id < object.region_volumes.size(); ++ region_id) {
const LayerRegion *layerm = (region_id < layer->regions().size()) ? layer->regions()[region_id] : nullptr; const LayerRegion *layerm = (region_id < layer->regions().size()) ? layer->regions()[region_id] : nullptr;
if (layerm == nullptr) if (layerm == nullptr)
continue; continue;
const PrintRegion &region = *object.print()->regions()[region_id]; const PrintRegion &region = *object.print()->regions()[region_id];
@ -320,20 +303,20 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
LayerTools lt_new(0.5f * (lt.print_z + lt_object.print_z)); LayerTools lt_new(0.5f * (lt.print_z + lt_object.print_z));
// Find the 1st layer above lt_new. // Find the 1st layer above lt_new.
for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z - EPSILON; ++ j); for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z - EPSILON; ++ j);
if (std::abs(m_layer_tools[j].print_z - lt_new.print_z) < EPSILON) { if (std::abs(m_layer_tools[j].print_z - lt_new.print_z) < EPSILON) {
m_layer_tools[j].has_wipe_tower = true; m_layer_tools[j].has_wipe_tower = true;
} else { } else {
LayerTools &lt_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new); LayerTools &lt_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);
LayerTools &lt_next = m_layer_tools[j + 1]; LayerTools &lt_next = m_layer_tools[j + 1];
assert(! m_layer_tools[j - 1].extruders.empty() && ! lt_next.extruders.empty()); assert(! m_layer_tools[j - 1].extruders.empty() && ! lt_next.extruders.empty());
// FIXME: Following assert tripped when running combine_infill.t. I decided to comment it out for now. // FIXME: Following assert tripped when running combine_infill.t. I decided to comment it out for now.
// If it is a bug, it's likely not critical, because this code is unchanged for a long time. It might // If it is a bug, it's likely not critical, because this code is unchanged for a long time. It might
// still be worth looking into it more and decide if it is a bug or an obsolete assert. // still be worth looking into it more and decide if it is a bug or an obsolete assert.
//assert(lt_prev.extruders.back() == lt_next.extruders.front()); //assert(lt_prev.extruders.back() == lt_next.extruders.front());
lt_extra.has_wipe_tower = true; lt_extra.has_wipe_tower = true;
lt_extra.extruders.push_back(lt_next.extruders.front()); lt_extra.extruders.push_back(lt_next.extruders.front());
lt_extra.wipe_tower_partitions = lt_next.wipe_tower_partitions; lt_extra.wipe_tower_partitions = lt_next.wipe_tower_partitions;
} }
} }
} }
break; break;
@ -375,7 +358,7 @@ void ToolOrdering::collect_extruder_statistics(bool prime_multi_material)
// Reorder m_all_printing_extruders in the sequence they will be primed, the last one will be m_first_printing_extruder. // Reorder m_all_printing_extruders in the sequence they will be primed, the last one will be m_first_printing_extruder.
// Then set m_first_printing_extruder to the 1st extruder primed. // Then set m_first_printing_extruder to the 1st extruder primed.
m_all_printing_extruders.erase( m_all_printing_extruders.erase(
std::remove_if(m_all_printing_extruders.begin(), m_all_printing_extruders.end(), std::remove_if(m_all_printing_extruders.begin(), m_all_printing_extruders.end(),
[ this ](const unsigned int eid) { return eid == m_first_printing_extruder; }), [ this ](const unsigned int eid) { return eid == m_first_printing_extruder; }),
m_all_printing_extruders.end()); m_all_printing_extruders.end());
m_all_printing_extruders.emplace_back(m_first_printing_extruder); m_all_printing_extruders.emplace_back(m_first_printing_extruder);
@ -623,6 +606,6 @@ const std::vector<int>* WipingExtrusions::get_extruder_overrides(const Extrusion
return &(entity_map_it->second); return &(entity_map_it->second);
} }
} // namespace Slic3r } // namespace Slic3r

View file

@ -948,8 +948,6 @@ public:
{ {
if (meshcache_valid) return meshcache; if (meshcache_valid) return meshcache;
std::cout << "merging mesh" << std::endl;
Contour3D merged; Contour3D merged;
for (auto &head : m_heads) { for (auto &head : m_heads) {
@ -2450,7 +2448,7 @@ public:
} }
} }
void merge_result() { /*m_result.merge_and_cleanup();*/ } void merge_result() { m_result.merge_and_cleanup(); }
}; };
bool SLASupportTree::generate(const std::vector<SupportPoint> &support_points, bool SLASupportTree::generate(const std::vector<SupportPoint> &support_points,

View file

@ -16,7 +16,7 @@
// For geometry algorithms with native Clipper types (no copies and conversions) // For geometry algorithms with native Clipper types (no copies and conversions)
#include <libnest2d/backends/clipper/geometries.hpp> #include <libnest2d/backends/clipper/geometries.hpp>
#define SLAPRINT_DO_BENCHMARK // #define SLAPRINT_DO_BENCHMARK
#ifdef SLAPRINT_DO_BENCHMARK #ifdef SLAPRINT_DO_BENCHMARK
#include <libnest2d/tools/benchmark.h> #include <libnest2d/tools/benchmark.h>
@ -954,20 +954,20 @@ void SLAPrint::process()
throw_if_canceled(); throw_if_canceled();
// Create the unified mesh // Create the unified mesh
// auto rc = SlicingStatus::RELOAD_SCENE; auto rc = SlicingStatus::RELOAD_SCENE;
// This is to prevent "Done." being displayed during merged_mesh() // This is to prevent "Done." being displayed during merged_mesh()
// m_report_status(*this, -1, L("Visualizing supports")); m_report_status(*this, -1, L("Visualizing supports"));
// po.m_supportdata->support_tree_ptr->merged_mesh(); po.m_supportdata->support_tree_ptr->merged_mesh();
BOOST_LOG_TRIVIAL(debug) << "Processed support point count " BOOST_LOG_TRIVIAL(debug) << "Processed support point count "
<< po.m_supportdata->support_points.size(); << po.m_supportdata->support_points.size();
// Check the mesh for later troubleshooting. // Check the mesh for later troubleshooting.
// if(po.support_mesh().empty()) if(po.support_mesh().empty())
// BOOST_LOG_TRIVIAL(warning) << "Support mesh is empty"; BOOST_LOG_TRIVIAL(warning) << "Support mesh is empty";
// m_report_status(*this, -1, L("Visualizing supports"), rc); m_report_status(*this, -1, L("Visualizing supports"), rc);
}; };
// This step generates the sla base pad // This step generates the sla base pad
@ -976,10 +976,6 @@ void SLAPrint::process()
// and before the supports had been sliced. (or the slicing has to be // and before the supports had been sliced. (or the slicing has to be
// repeated) // repeated)
std::cout << "Should only merge mesh after this" << std::endl;
po.m_supportdata->support_tree_ptr->merged_mesh();
m_report_status(*this, -1, L("Visualizing supports"), SlicingStatus::RELOAD_SCENE);
if(po.m_config.pad_enable.getBool()) if(po.m_config.pad_enable.getBool())
{ {
// Get the distilled pad configuration from the config // Get the distilled pad configuration from the config
@ -1494,10 +1490,7 @@ void SLAPrint::process()
{ {
unsigned incr = 0; unsigned incr = 0;
for (SLAPrintObject *po : m_objects) { for (SLAPrintObject *po : m_objects) {
for (SLAPrintObjectStep step : steps) {
for (SLAPrintObjectStep currentstep : steps) {
Benchmark bench;
// Cancellation checking. Each step will check for // Cancellation checking. Each step will check for
// cancellation on its own and return earlier gracefully. // cancellation on its own and return earlier gracefully.
@ -1507,17 +1500,17 @@ void SLAPrint::process()
st += incr * ostepd; st += incr * ostepd;
if (po->m_stepmask[currentstep] && po->set_started(currentstep)) { if (po->m_stepmask[step] && po->set_started(step)) {
m_report_status(*this, st, OBJ_STEP_LABELS(currentstep)); m_report_status(*this, st, OBJ_STEP_LABELS(step));
bench.start(); bench.start();
pobj_program[currentstep](*po); pobj_program[step](*po);
bench.stop(); bench.stop();
step_times[currentstep] += bench.getElapsedSec(); step_times[step] += bench.getElapsedSec();
throw_if_canceled(); throw_if_canceled();
po->set_done(currentstep); po->set_done(step);
} }
incr = OBJ_STEP_LEVELS[currentstep]; incr = OBJ_STEP_LEVELS[step];
} }
} }
}; };
@ -1525,14 +1518,12 @@ void SLAPrint::process()
apply_steps_on_objects(level1_obj_steps); apply_steps_on_objects(level1_obj_steps);
apply_steps_on_objects(level2_obj_steps); apply_steps_on_objects(level2_obj_steps);
SLAPrintStep printsteps[] = { slapsMergeSlicesAndEval, slapsRasterize };
// this would disable the rasterization step // this would disable the rasterization step
// std::fill(m_stepmask.begin(), m_stepmask.end(), false); // std::fill(m_stepmask.begin(), m_stepmask.end(), false);
double pstd = (100 - max_objstatus) / 100.0; double pstd = (100 - max_objstatus) / 100.0;
st = max_objstatus; st = max_objstatus;
for(SLAPrintStep currentstep : printsteps) { for(SLAPrintStep currentstep : print_steps) {
throw_if_canceled(); throw_if_canceled();
if (m_stepmask[currentstep] && set_started(currentstep)) { if (m_stepmask[currentstep] && set_started(currentstep)) {