From 549a33d386a19b976248f3a357135f3b9f579cdc Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 26 Apr 2023 22:48:08 +0200 Subject: Finish spiky proto layout by electroniceel --- gerbonara/cad/protoboard.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'gerbonara/cad') diff --git a/gerbonara/cad/protoboard.py b/gerbonara/cad/protoboard.py index 9c3fbd7..f08fb32 100644 --- a/gerbonara/cad/protoboard.py +++ b/gerbonara/cad/protoboard.py @@ -477,14 +477,34 @@ class SpikyProto(ObjectGroup): res = importlib.resources.files(package_data) self.fp_center = kfp.Footprint.load(res.joinpath('center-pad-spikes.kicad_mod').read_text(encoding='utf-8')) - self.objects.append(kfp.FootprintInstance(1.27, 1.27, self.fp_center, unit=MM)) + self.corner_pad = kfp.FootprintInstance(1.27, 1.27, self.fp_center, unit=MM) + + self.pad = kfp.Footprint.load(res.joinpath('tht-0.8.kicad_mod').read_text(encoding='utf-8')) + self.center_pad = kfp.FootprintInstance(0, 0, self.pad, unit=MM) self.fp_between = kfp.Footprint.load(res.joinpath('pad-between-spiked.kicad_mod').read_text(encoding='utf-8')) - self.objects.append(kfp.FootprintInstance(1.27, 0, self.fp_between, unit=MM)) - self.objects.append(kfp.FootprintInstance(0, 1.27, self.fp_between, rotation=math.pi/2, unit=MM)) + self.right_pad = kfp.FootprintInstance(1.27, 0, self.fp_between, unit=MM) + self.top_pad = kfp.FootprintInstance(0, 1.27, self.fp_between, rotation=math.pi/2, unit=MM) + + @property + def objects(self): + return [x for x in (self.center_pad, self.corner_pad, self.right_pad, self.top_pad) if x is not None] + + @objects.setter + def objects(self, value): + pass + + def inst(self, x, y, border_x, border_y): + inst = copy(self) + + if border_x: + inst.corner_pad = inst.right_pad = None + + if border_y: + inst.corner_pad = inst.top_pad = None + + return inst - self.pad = kfp.Footprint.load(res.joinpath('tht-0.8.kicad_mod').read_text(encoding='utf-8')) - self.objects.append(kfp.FootprintInstance(0, 0, self.pad, unit=MM)) def convert_to_mm(value, unit): unitl = unit.lower() -- cgit