Copper fill WIP
This commit is contained in:
parent
0a059353d7
commit
ef2864cfb3
3 changed files with 21 additions and 6 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
5
gerbonara/tests/test_cad.py
Normal file
5
gerbonara/tests/test_cad.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
from ..utils import setup_svg
|
||||
from ..cad import primitives
|
||||
|
||||
def test_route
|
||||
Loading…
Add table
Add a link
Reference in a new issue