From 60db7e2719f7141c72a1dc8acea61c3ae45abcfe Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sun, 28 May 2023 12:17:31 -0400 Subject: [PATCH] Fix type error Uses duck-typing for the test instead of requiring the type be one of a few specific instances. This fixes the following error I get with kicad v7.0.4: `TypeError: float() argument must be a string or a real number, not 'VECTOR2I'` --- kibot/out_report.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kibot/out_report.py b/kibot/out_report.py index 84a0e702..c6740c68 100644 --- a/kibot/out_report.py +++ b/kibot/out_report.py @@ -49,9 +49,7 @@ def do_round(v, dig): def to_mm(iu, dig=2): """ KiCad Internal Units to millimeters """ - if isinstance(iu, pcbnew.wxPoint): - return (do_round(GS.to_mm(iu.x), dig), do_round(GS.to_mm(iu.y), dig)) - if isinstance(iu, pcbnew.wxSize): + if hasattr(iu, 'x'): return (do_round(GS.to_mm(iu.x), dig), do_round(GS.to_mm(iu.y), dig)) return do_round(GS.to_mm(iu), dig)