summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-06 15:17:37 +0200
committerjaseg <git@jaseg.de>2023-04-06 15:17:37 +0200
commitef2864cfb329683b1c7cdc7f3a991b7aa94cacbe (patch)
treea28817a93e3eebaea780c72fe33e0359c305927e
parent0a059353d707df91f71bdb6be976546089e01488 (diff)
downloadgerbonara-ef2864cfb329683b1c7cdc7f3a991b7aa94cacbe.tar.gz
gerbonara-ef2864cfb329683b1c7cdc7f3a991b7aa94cacbe.tar.bz2
gerbonara-ef2864cfb329683b1c7cdc7f3a991b7aa94cacbe.zip
Copper fill WIP
-rw-r--r--gerbonara/cad/primitives.py6
-rw-r--r--gerbonara/cad/protoboard.py16
-rw-r--r--gerbonara/tests/test_cad.py5
3 files changed, 21 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')
diff --git a/gerbonara/tests/test_cad.py b/gerbonara/tests/test_cad.py
new file mode 100644
index 0000000..4d11304
--- /dev/null
+++ b/gerbonara/tests/test_cad.py
@@ -0,0 +1,5 @@
+
+from ..utils import setup_svg
+from ..cad import primitives
+
+def test_route