diff options
Diffstat (limited to 'gerbonara/cad/kicad/base_types.py')
-rw-r--r-- | gerbonara/cad/kicad/base_types.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gerbonara/cad/kicad/base_types.py b/gerbonara/cad/kicad/base_types.py index 32717fb..1161996 100644 --- a/gerbonara/cad/kicad/base_types.py +++ b/gerbonara/cad/kicad/base_types.py @@ -97,7 +97,8 @@ class Stroke: class Dasher: def __init__(self, obj): if obj.stroke: - w, t = obj.stroke.width or 0.254, obj.stroke.type + w = obj.stroke.width if obj.stroke.width is not None else 0.254 + t = obj.stroke.type else: w = obj.width or 0 t = Atom.solid @@ -210,6 +211,20 @@ class XYCoord: else: self.x, self.y = x, y + def __iter__(self): + return iter((self.x, self.y)) + + def __getitem__(self, index): + return (self.x, self.y)[index] + + def __setitem__(self, index, value): + if index == 0: + self.x = value + elif index == 1: + self.y = value + else: + raise IndexError(f'Invalid 2D point coordinate index {index}') + def within_distance(self, x, y, dist): return math.dist((x, y), (self.x, self.y)) < dist |