ENH: Optimize and design the time-lapse wiper tower

Multiplex existing wipe tower and revert old time-lapse wipe tower code

Change-Id: Ia1cba9808647ea900f691b2c5d5887077be12d89
(cherry picked from commit 61f41df572d11b7cc738c34f2624fd123cd9a6df)
This commit is contained in:
zhimin.zeng 2022-08-15 14:41:28 +08:00 committed by Lane.Wei
parent a26c573b1b
commit f745c5fea2
21 changed files with 172 additions and 183 deletions

View file

@ -1103,8 +1103,12 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volu
}
wipe_tower_size(2) = max_height;
const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const ConfigOption* option = dconfig.option("timelapse_no_toolhead");
bool timelapse_enabled = option ? option->getBool() : false;
double depth = wipe_volume * (plate_extruders.size() - 1) / (layer_height * w);
if (depth > EPSILON) {
if (timelapse_enabled || depth > EPSILON) {
float min_wipe_tower_depth = 0.f;
auto iter = WipeTower::min_depth_per_height.begin();
while (iter != WipeTower::min_depth_per_height.end()) {
@ -1142,26 +1146,6 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volu
return wipe_tower_size;
}
double PartPlate::estimate_timelapse_wipe_tower_height(int *highest_extruder_id) const
{
double max_height = 0;
int highest_extruder = 0;
// auto m_model = wxGetApp().plater()->get_obj
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
if (!contain_instance_totally(obj_idx, 0)) continue;
if (m_model->objects[obj_idx]->is_timelapse_wipe_tower) continue;
BoundingBoxf3 bbox = m_model->objects[obj_idx]->bounding_box();
if (bbox.size().z() > max_height) {
max_height = bbox.size().z();
highest_extruder = m_model->objects[obj_idx]->config.opt_int("extruder");
}
}
if (highest_extruder_id) *highest_extruder_id = highest_extruder;
return max_height;
}
bool PartPlate::operator<(PartPlate& plate) const
{
int index = plate.get_index();
@ -1636,33 +1620,6 @@ void PartPlate::move_instances_to(PartPlate& left_plate, PartPlate& right_plate,
return;
}
//can add timelapse object
bool PartPlate::can_add_timelapse_object()
{
bool result = true;
if (obj_to_instance_set.size() == 0)
return false;
for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it)
{
int obj_id = it->first;
if (obj_id >= m_model->objects.size())
continue;
ModelObject* object = m_model->objects[obj_id];
if (object->is_timelapse_wipe_tower)
{
result = false;
break;
}
}
return result;
}
void PartPlate::generate_logo_polygon(ExPolygon &logo_polygon)
{
if (m_shape.size() == 4)