Fix Bridge flow calibration text with first layer height of 0.3 for a 0.4 nozzle

supermerill/SuperSlicer#1462
This commit is contained in:
supermerill 2021-10-06 13:45:04 +02:00
parent 6b0326e77c
commit f3a11c3684

View File

@ -143,6 +143,21 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool
model.objects[objs_idx[i]]->config.set_key_value("no_perimeter_unsupported_algo", new ConfigOptionEnum<NoPerimeterUnsupportedAlgo>(npuaBridges));
model.objects[objs_idx[i]]->config.set_key_value("top_fill_pattern", new ConfigOptionEnum<InfillPattern>(ipSmooth));
}
/// if first ayer height is excatly at the wrong value, the text isn't drawed. Fix that by switching the first layer height just a little bit.
double first_layer_height = print_config->get_computed_value("first_layer_height", 0);
double layer_height = nozzle_diameter * 0.5;
if (layer_height > 0.01 && (int(first_layer_height * 100) % int(layer_height * 100)) == int(layer_height * 50)) {
double z_step = printer_config->option<ConfigOptionFloat>("z_step")->value;
if (z_step == 0)
z_step = 0.1;
double max_height = printer_config->option<ConfigOptionFloats>("max_layer_height")->values[0];
if (max_height > first_layer_height + z_step)
for (size_t i = 0; i < nb_items; i++)
model.objects[objs_idx[i]]->config.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(first_layer_height + z_step, false));
else
for (size_t i = 0; i < nb_items; i++)
model.objects[objs_idx[i]]->config.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(first_layer_height - z_step, false));
}
//update plater
GLCanvas3D::set_warning_freeze(false);