Next auto color change improvements

This commit is contained in:
YuSanka 2021-03-19 11:11:46 +01:00
parent 995512f280
commit 4602f40813
3 changed files with 17 additions and 8 deletions

View file

@ -2022,6 +2022,9 @@ void Control::auto_color_change()
Layer* layer = object->get_layer(i);
double cur_area = area(layer->lslices);
if (cur_area > prev_area)
break;
if (prev_area - cur_area > delta_area) {
int tick = get_tick_from_value(layer->print_z);
if (tick >= 0 && !m_ticks.has_tick(tick)) {
@ -2035,6 +2038,10 @@ void Control::auto_color_change()
extruder = 1;
}
}
// allow max 3 auto color changes
if (m_ticks.ticks.size() == 3)
break;
}
prev_area = cur_area;

View file

@ -645,23 +645,24 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
// Suggest the auto color change, if model looks like sign
if (m_layers_slider->IsNewPrint())
{
NotificationManager* notif_mngr = wxGetApp().plater()->get_notification_manager();
const Print& print = wxGetApp().plater()->fff_print();
double delta_area = scale_(scale_(25)); // equal to 25 mm2
//bool is_possible_auto_color_change = false;
for (auto object : print.objects()) {
// bottom layer have to be a biggest, so control relation between bottom lazer and object size
const ExPolygons& bottom = object->get_layer(0)->lslices;
double bottom_area = area(bottom);
if (bottom_area < double(object->size().x()) * double(object->size().y()))
continue;
// if it's sign, than object have not to be a too height
double height = object->height();
coord_t longer_side = std::max(object->size().x(), object->size().y());
if (height / longer_side > 0.3)
continue;
const ExPolygons& bottom = object->get_layer(0)->lslices;
//if (bottom.size() > 1 || !bottom[0].holes.empty())
// continue;
double bottom_area = area(bottom);
// at least 30% of object's height have to be a solid
int i;
for (i = 1; i < int(0.3 * object->layers().size()); i++)
if (area(object->get_layer(1)->lslices) != bottom_area)
@ -671,6 +672,7 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
double top_area = area(object->get_layer(int(object->layers().size()) - 1)->lslices);
if( bottom_area - top_area > delta_area) {
NotificationManager* notif_mngr = wxGetApp().plater()->get_notification_manager();
notif_mngr->push_notification(
NotificationType::SignDetected, NotificationManager::NotificationLevel::RegularNotification,
_u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n",

View file

@ -1443,7 +1443,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Fuzzy skin (experimental)"));
Option option = optgroup->get_option("fuzzy_skin");
option.opt.width = 30;
// option.opt.width = 30;
optgroup->append_single_option_line(option);
optgroup->append_single_option_line(optgroup->get_option("fuzzy_skin_thickness"));
optgroup->append_single_option_line(optgroup->get_option("fuzzy_skin_point_dist"));