Fix adaptive barrel refinement and ambiguous decimal-comma inputs

- adaptive: barrel links could attach to coarse leaves (up to 1 mm),
  making the whole leaf equipotential and deleting the local spreading
  resistance - via-field results read up to ~13% low. Barrel attachment
  cells are now pinned into the keep-fine set before the quadtree is
  built; the guard ring grades around them.
- skin/dialog: the decimal-comma rewrite turned '1,500' into 1.5, a
  silent 1000x error in frequency, test current or cell size. Ambiguous
  comma patterns (thousands separators, multiple commas, mixed with a
  dot) now raise with a message; a real decimal comma ('1,5') still
  parses.
- dialog: Selection.adaptive default now matches the documented
  on-by-default; the adaptive accuracy claim is aligned to the measured
  0.03% quoted in README and config.
This commit is contained in:
2026-07-17 13:23:55 +07:00
parent 8bc3c50872
commit f59ada94e0
3 changed files with 34 additions and 9 deletions
+8 -5
View File
@@ -38,7 +38,7 @@ class Selection:
include_tracks: bool = True
vias_capped: bool = True
cap_max_drill_mm: float = 0.5
adaptive: bool = False
adaptive: bool = True
class _Dialog(QDialog):
@@ -81,7 +81,7 @@ class _Dialog(QDialog):
self.adaptive_check = QCheckBox(
"adaptive cells (coarsen plane interiors; faster on large "
"boards, corrected to ≲0.1 % of the uniform grid)")
"boards, corrected to ≲0.03 % of the uniform grid)")
self.adaptive_check.setChecked(config.ADAPTIVE_CELLS)
form.addRow("Grid:", self.adaptive_check)
@@ -187,10 +187,13 @@ class _Dialog(QDialog):
raise ValueError("Check at least one layer.")
def number(edit: QLineEdit, name: str) -> float:
text = edit.text().strip()
try:
return float(edit.text().strip().replace(",", "."))
except ValueError:
raise ValueError(f"{name}: '{edit.text()}' is not a number.")
return float(skin.normalize_decimal(text))
except ValueError as exc:
if "separator" in str(exc):
raise ValueError(f"{name}: {exc}")
raise ValueError(f"{name}: '{text}' is not a number.")
current = number(self.current_edit, "Test current")
if current <= 0: