Updated to 1.9.5, and optimize calibration and device

This commit is contained in:
QIDI TECH
2024-09-16 16:07:29 +08:00
parent fa251e0a9a
commit d842832b25
90 changed files with 2753 additions and 998 deletions

View File

@@ -1068,13 +1068,20 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
// Custom layering is not allowed for tree supports as of now.
for (size_t print_object_idx = 0; print_object_idx < m_objects.size(); ++ print_object_idx)
if (const PrintObject &print_object = *m_objects[print_object_idx];
print_object.has_support_material() && is_tree(print_object.config().support_type.value) && print_object.config().support_style.value == smsTreeOrganic &&
//1.9.5
for (size_t print_object_idx = 0; print_object_idx < m_objects.size(); ++print_object_idx) {
PrintObject &print_object = *m_objects[print_object_idx];
print_object.has_variable_layer_heights = false;
if (print_object.has_support_material() && is_tree(print_object.config().support_type.value) &&
print_object.model_object()->has_custom_layering()) {
if (const std::vector<coordf_t> &layers = layer_height_profile(print_object_idx); ! layers.empty())
if (! check_object_layers_fixed(print_object.slicing_parameters(), layers))
return { L("Variable layer height is not supported with Organic supports.") };
if (const std::vector<coordf_t> &layers = layer_height_profile(print_object_idx); !layers.empty())
if (!check_object_layers_fixed(print_object.slicing_parameters(), layers)) {
print_object.has_variable_layer_heights = true;
BOOST_LOG_TRIVIAL(warning) << "print_object: " << print_object.model_object()->name
<< " has_variable_layer_heights: " << print_object.has_variable_layer_heights;
if (print_object.config().support_style.value == smsTreeOrganic) return {L("Variable layer height is not supported with Organic supports.")};
}
}
}
if (this->has_wipe_tower() && ! m_objects.empty()) {
@@ -1556,11 +1563,16 @@ std::map<ObjectID, unsigned int> getObjectExtruderMap(const Print& print) {
}
// Slicing process, running at a background thread.
void Print::process(long long *time_cost_with_cache, bool use_cache)
//1.9.5
void Print::process(std::unordered_map<std::string, long long>* slice_time, bool use_cache)
{
long long start_time = 0, end_time = 0;
if (time_cost_with_cache)
*time_cost_with_cache = 0;
if (slice_time) {
(*slice_time)[TIME_USING_CACHE] = 0;
(*slice_time)[TIME_MAKE_PERIMETERS] = 0;
(*slice_time)[TIME_INFILL] = 0;
(*slice_time)[TIME_GENERATE_SUPPORT] = 0;
}
name_tbb_thread_pool_threads_set_locale();
@@ -1667,7 +1679,12 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": total object counts %1% in current print, need to slice %2%")%m_objects.size()%need_slicing_objects.size();
BOOST_LOG_TRIVIAL(info) << "Starting the slicing process." << log_memory_info();
if (!use_cache) {
for (PrintObject *obj : m_objects) {
//1.9.5
if (slice_time) {
start_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
}
for (PrintObject* obj : m_objects) {
if (need_slicing_objects.count(obj) != 0) {
obj->make_perimeters();
}
@@ -1678,6 +1695,13 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
obj->set_done(posPerimeters);
}
}
//1.9.5
if (slice_time) {
end_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
(*slice_time)[TIME_MAKE_PERIMETERS] = (*slice_time)[TIME_MAKE_PERIMETERS] + end_time - start_time;
start_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
}
for (PrintObject *obj : m_objects) {
if (need_slicing_objects.count(obj) != 0) {
obj->infill();
@@ -1689,6 +1713,12 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
obj->set_done(posInfill);
}
}
//1.9.5
if (slice_time) {
end_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
(*slice_time)[TIME_INFILL] = (*slice_time)[TIME_INFILL] + end_time - start_time;
}
for (PrintObject *obj : m_objects) {
if (need_slicing_objects.count(obj) != 0) {
obj->ironing();
@@ -1698,6 +1728,10 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
obj->set_done(posIroning);
}
}
//1.9.5
if (slice_time) {
start_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
}
tbb::parallel_for(tbb::blocked_range<int>(0, int(m_objects.size())),
[this, need_slicing_objects](const tbb::blocked_range<int>& range) {
@@ -1713,6 +1747,11 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
}
}
);
//1.9.5
if (slice_time) {
end_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
(*slice_time)[TIME_GENERATE_SUPPORT] = (*slice_time)[TIME_GENERATE_SUPPORT] + end_time - start_time;
}
for (PrintObject* obj : m_objects) {
if (need_slicing_objects.count(obj) != 0) {
@@ -1775,9 +1814,10 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
}
if (this->set_started(psSkirtBrim)) {
this->set_status(70, L("Generating skirt & brim"));
if (time_cost_with_cache)
start_time = (long long)Slic3r::Utils::get_current_time_utc();
//1.9.5
if (slice_time) {
start_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
}
m_skirt.clear();
m_skirt_convex_hull.clear();
@@ -1863,10 +1903,10 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
this->finalize_first_layer_convex_hull();
this->set_done(psSkirtBrim);
if (time_cost_with_cache) {
end_time = (long long)Slic3r::Utils::get_current_time_utc();
*time_cost_with_cache = *time_cost_with_cache + end_time - start_time;
//1.9.5
if (slice_time) {
end_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
(*slice_time)[TIME_USING_CACHE] = (*slice_time)[TIME_USING_CACHE] + end_time - start_time;
}
}
//QDS