diff options
author | jaseg <git@jaseg.de> | 2024-07-07 14:36:41 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2024-07-07 14:36:41 +0200 |
commit | 4c3815b25a23f8df2d6bfdab83962367150bd285 (patch) | |
tree | 57383893ca6775a8f473e0b7746a647a7b6b7bc7 | |
parent | ef3b5d5e1c242d98a03b9527862d0216a5188796 (diff) | |
download | gerbonara-4c3815b25a23f8df2d6bfdab83962367150bd285.tar.gz gerbonara-4c3815b25a23f8df2d6bfdab83962367150bd285.tar.bz2 gerbonara-4c3815b25a23f8df2d6bfdab83962367150bd285.zip |
Fix THT flower proto area
-rw-r--r-- | gerbonara/cad/primitives.py | 1 | ||||
-rw-r--r-- | gerbonara/cad/protoboard.py | 34 | ||||
-rw-r--r-- | gerbonara/cad/protoserve.py | 3 |
3 files changed, 30 insertions, 8 deletions
diff --git a/gerbonara/cad/primitives.py b/gerbonara/cad/primitives.py index 591999c..a5c5209 100644 --- a/gerbonara/cad/primitives.py +++ b/gerbonara/cad/primitives.py @@ -127,7 +127,6 @@ class Board: layer_stack['mechanical', 'outline'].objects.extend(self.outline) layer_stack['top', 'silk'].objects.extend(self.extra_silk_top) layer_stack['bottom', 'silk'].objects.extend(self.extra_silk_bottom) - print('layer stack is', repr(layer_stack['top', 'copper'].objects)[:1000]) return layer_stack diff --git a/gerbonara/cad/protoboard.py b/gerbonara/cad/protoboard.py index 0a5bbbe..cc1ab9e 100644 --- a/gerbonara/cad/protoboard.py +++ b/gerbonara/cad/protoboard.py @@ -271,10 +271,12 @@ class PatternProtoArea: for i in range(n_x): for j in range(n_y): - if isinstance(self.obj, PadStack): - obj = self.obj.grid_variant(i, j, i == n_x-1, j == n_y-1) - if obj is None: - continue + obj = self.obj + if isinstance(obj, PadStack): + if hasattr(obj, 'grid_variant'): + obj = obj.grid_variant(i, j, i == n_x-1, j == n_y-1) + if obj is None: + continue px = self.unit(off_x + x, unit) + (i + 0.5) * self.pitch_x py = self.unit(off_y + y, unit) + (j + 0.5) * self.pitch_y @@ -324,6 +326,10 @@ class ManhattanPads(PadStack): gap: float = 0.2 @property + def single_sided(self): + return True + + @property def apertures(self): w = self.w h = self.h or w @@ -361,6 +367,10 @@ class RFGroundProto(PadStack): suppress_via: bool = False @property + def single_sided(self): + return False + + @property def apertures(self): unit = self.unit pitch = self.pitch @@ -406,12 +416,20 @@ class THTFlowerProto(PadStack): pitch: float = 2.54 drill: float = 0.9 diameter: float = 2.0 + clearance: float = 0.5 + + @property + def single_sided(self): + return False @property def apertures(self): - p = self.pitch / 2 + p = self.diameter / 2 + pad_dist_diag = math.sqrt(2) * (self.pitch - p) - self.drill + pad_dist_ortho = 2*self.pitch - self.diameter - self.drill + pad_dia = self.drill + max(0, min(pad_dist_diag, pad_dist_ortho) - self.clearance) - pad = THTPad.circle(self.drill, self.diameter, paste=False, unit=self.unit) + pad = THTPad.circle(self.drill, pad_dia, paste=False, unit=self.unit) for ox, oy in ((-p, 0), (p, 0), (0, -p), (0, p)): for stack_ap in pad.apertures: @@ -452,6 +470,10 @@ class PoweredProto(Graphics): Yajima Manufacturing Corporation website: http://www.yajima-works.co.jp/index.html """ + @property + def single_sided(self): + return False + def __init__(self, pitch=None, drill=None, clearance=None, power_pad_dia=None, via_size=None, trace_width=None, unit=MM): super().__init__(0, 0) self.unit = unit diff --git a/gerbonara/cad/protoserve.py b/gerbonara/cad/protoserve.py index cc5aae2..3271af1 100644 --- a/gerbonara/cad/protoserve.py +++ b/gerbonara/cad/protoserve.py @@ -107,7 +107,8 @@ def deserialize(obj, unit): pitch = mil(float(obj.get('pitch', 2.54))) hole_dia = mil(float(obj['hole_dia'])) pattern_dia = mil(float(obj['pattern_dia'])) - return pb.PatternProtoArea(2*pitch, 2*pitch, pb.THTFlowerProto(pitch, hole_dia, pattern_dia, unit=unit), unit=unit) + clearance = mil(float(obj['clearance'])) + return pb.PatternProtoArea(pitch, pitch, pb.THTFlowerProto(pitch, hole_dia, pattern_dia, clearance, unit=unit), unit=unit) case 'spiky': return pb.PatternProtoArea(2.54, 2.54, pb.SpikyProto(), unit=unit) |