Skip to content

Commit

Permalink
fix: don't warn when rounding by less than 1 micro-inch (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
schumar committed Nov 20, 2021
1 parent ae41f9f commit d41ddf4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,16 @@ map<int, drillbit> ExcellonProcessor::optimize_bits() {
return a.difference(wanted_length, inputFactor).value_or(std::numeric_limits<double>::infinity()) <
b.difference(wanted_length, inputFactor).value_or(std::numeric_limits<double>::infinity());
});
if (best_available_drill->difference(wanted_length, inputFactor)) {

const auto difference = best_available_drill->difference(wanted_length, inputFactor);
if (difference) {
wanted_drill_bit.diameter = best_available_drill->diameter().asInch(inputFactor);
wanted_drill_bit.unit = "inch";
cerr << "Info: bit " << wanted_drill.first << " ("
<< old_string << ") is rounded to "
<< drill_to_string(wanted_drill_bit) << std::endl;
if (abs(*difference) > 1e-6) {
cerr << "Info: bit " << wanted_drill.first << " ("
<< old_string << ") is rounded to "
<< drill_to_string(wanted_drill_bit) << std::endl;
}
}
}
}
Expand Down

0 comments on commit d41ddf4

Please sign in to comment.