summaryrefslogtreecommitdiff
path: root/gerbonara/cad
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-06 15:17:37 +0200
committerjaseg <git@jaseg.de>2023-04-10 23:57:15 +0200
commitba920604311d73fd3a9563d4fcb147d508f080cf (patch)
treeeea38f423159f56a19e395f7b595c805d290e0ec /gerbonara/cad
parent24577464ee0745e2e866dd5eb9f9d3005f891cde (diff)
downloadgerbonara-ba920604311d73fd3a9563d4fcb147d508f080cf.tar.gz
gerbonara-ba920604311d73fd3a9563d4fcb147d508f080cf.tar.bz2
gerbonara-ba920604311d73fd3a9563d4fcb147d508f080cf.zip
Copper fill WIP
Diffstat (limited to 'gerbonara/cad')
-rw-r--r--gerbonara/cad/primitives.py6
-rw-r--r--gerbonara/cad/protoboard.py16
2 files changed, 16 insertions, 6 deletions
diff --git a/gerbonara/cad/primitives.py b/gerbonara/cad/primitives.py
index 78fc238..b566d76 100644
--- a/gerbonara/cad/primitives.py
+++ b/gerbonara/cad/primitives.py
@@ -391,12 +391,18 @@ class THTPad(Pad):
@dataclass
class Hole(Positioned):
diameter: float
+ mask_copper_margin: float = 0.2
def render(self, layer_stack):
x, y, rotation = self.abs_pos
hole = Flash(x, y, ExcellonTool(self.diameter, plated=False, unit=self.unit), unit=self.unit)
layer_stack.drill_npth.objects.append(hole)
+
+ if self.mask_copper_margin > 0:
+ mask = Flash(x, y, CircleAperture(self.mask_copper_margin, unit=self.unit), polarity_dark=False, unit=self.unit)
+ layer_stack['top', 'copper'].objects.append(mask)
+ layer_stack['bottom', 'copper'].objects.append(mask)
@property
def single_sided(self):
diff --git a/gerbonara/cad/protoboard.py b/gerbonara/cad/protoboard.py
index 81b31dd..c9547aa 100644
--- a/gerbonara/cad/protoboard.py
+++ b/gerbonara/cad/protoboard.py
@@ -282,10 +282,13 @@ class EmptyProtoArea:
return w, h
def generate(self, bbox, border_text, unit=MM):
- if self.copper:
+ if self.copper_fill:
(min_x, min_y), (max_x, max_y) = bbox
- yield ObjectGroup(top_copper=[Region([(min_x, min_y), (max_x, min_y), (max_x, max_y), (min_x, max_y)],
+ group = ObjectGroup(0, 0, top_copper=[Region([(min_x, min_y), (max_x, min_y), (max_x, max_y), (min_x, max_y)],
unit=unit, polarity_dark=True)])
+ group.bounding_box = lambda *args, **kwargs: None
+ print('adding', self, bbox, group.bounding_box(), file=sys.stderr)
+ yield group
@property
def single_sided(self):
@@ -491,18 +494,19 @@ def eval_value(value, total_length=None):
def _demo():
- pattern1 = PatternProtoArea(2.54, obj=THTPad.circle(0, 0, 0.9, 1.8, paste=False))
+ #pattern1 = PatternProtoArea(2.54, obj=THTPad.circle(0, 0, 0.9, 1.8, paste=False))
pattern2 = PatternProtoArea(1.2, 2.0, obj=SMDPad.rect(0, 0, 1.0, 1.8, paste=False))
- pattern3 = PatternProtoArea(2.54, 1.27, obj=SMDPad.rect(0, 0, 2.3, 1.0, paste=False))
+ #pattern3 = PatternProtoArea(2.54, 1.27, obj=SMDPad.rect(0, 0, 2.3, 1.0, paste=False))
+ pattern3 = EmptyProtoArea(copper_fill=True)
stack = TwoSideLayout(pattern2, pattern3)
- pattern = PropLayout([pattern1, stack], 'h', [0.5, 0.5])
+ #pattern = PropLayout([pattern1, stack], 'h', [0.5, 0.5])
#pattern = PatternProtoArea(2.54, obj=ManhattanPads(2.54))
#pattern = PatternProtoArea(2.54, obj=PoweredProto())
#pattern = PatternProtoArea(2.54, obj=RFGroundProto())
#pattern = PatternProtoArea(2.54*1.5, obj=THTFlowerProto())
#pattern = PatternProtoArea(2.54, obj=THTPad.circle(0, 0, 0.9, 1.8, paste=False))
#pattern = PatternProtoArea(2.54, obj=PoweredProto())
- pb = ProtoBoard(100, 80, pattern, mounting_hole_dia=3.2, mounting_hole_offset=5)
+ pb = ProtoBoard(100, 80, stack, mounting_hole_dia=3.2, mounting_hole_offset=5)
print(pb.pretty_svg())
pb.layer_stack().save_to_directory('/tmp/testdir')