From 5c7bfb2744429a3ea311c68fb9fa269f155c5ed9 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 15 Apr 2023 22:26:38 +0200 Subject: Fix protoserve bugs in obround pads --- gerbonara/cad/primitives.py | 8 ++++---- gerbonara/cad/protoboard.py | 3 ++- gerbonara/layers.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gerbonara/cad/primitives.py b/gerbonara/cad/primitives.py index abce1a4..80373c6 100644 --- a/gerbonara/cad/primitives.py +++ b/gerbonara/cad/primitives.py @@ -10,7 +10,7 @@ from collections import defaultdict from ..utils import LengthUnit, MM, rotate_point, svg_arc, sum_bounds, bbox_intersect, Tag from ..layers import LayerStack from ..graphic_objects import Line, Arc, Flash -from ..apertures import Aperture, CircleAperture, RectangleAperture, ExcellonTool +from ..apertures import Aperture, CircleAperture, ObroundAperture, RectangleAperture, ExcellonTool from ..newstroke import Newstroke @@ -385,9 +385,9 @@ class THTPad(Pad): @classmethod def obround(kls, x, y, hole_dia, w, h, rotation=0, mask_expansion=0.0, paste_expanson=0.0, paste=True, plated=True, unit=MM): - ap_c = CircleAperture(dia, unit=unit) - ap_m = CircleAperture(dia+2*mask_expansion, unit=unit) - ap_p = CircleAperture(dia+2*paste_expansion, unit=unit) if paste else None + ap_c = ObroundAperture(w, h, unit=unit) + ap_m = ObroundAperture(w+2*mask_expansion, h+2*mask_expansion, unit=unit) + ap_p = ObroundAperture(w, h, unit=unit) if paste else None pad = SMDPad(0, 0, side='top', copper_aperture=ap_c, mask_aperture=ap_m, paste_aperture=ap_p, unit=unit) return kls(x, y, hole_dia, pad, rotation=rotation, plated=plated, unit=unit) diff --git a/gerbonara/cad/protoboard.py b/gerbonara/cad/protoboard.py index b61a0ed..3c523bc 100644 --- a/gerbonara/cad/protoboard.py +++ b/gerbonara/cad/protoboard.py @@ -497,7 +497,8 @@ 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)) + pattern1 = PatternProtoArea(2.54, 3.84, obj=THTPad.obround(0, 0, 0.9, 1.8, 2.5, 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 = EmptyProtoArea(copper_fill=True) diff --git a/gerbonara/layers.py b/gerbonara/layers.py index 10101dc..bb2d635 100644 --- a/gerbonara/layers.py +++ b/gerbonara/layers.py @@ -816,11 +816,11 @@ class LayerStack: for i, layer in enumerate(self.drill_layers): layers.append(tag('g', list(layer.instance.svg_objects(svg_unit=svg_unit, fg='white', bg='black', tag=Tag)), - id=f'g-drill-{i}', filter=f'url(#f-drill)', **stroke_attrs, **inkscape_attrs(f'drill-{i}'))) + id=f'l-drill-{i}', filter=f'url(#f-drill)', **stroke_attrs, **inkscape_attrs(f'drill-{i}'))) if self.outline: layers.append(tag('g', list(self.outline.instance.svg_objects(svg_unit=svg_unit, fg='white', bg='black', tag=Tag)), - id=f'g-outline-{i}', **stroke_attrs, **inkscape_attrs(f'outline-{i}'))) + id=f'l-mechanical-outline', **stroke_attrs, **inkscape_attrs(f'outline'))) layer_group = tag('g', layers, transform=f'translate(0 {bounds[0][1] + bounds[1][1]}) scale(1 -1)') tags = [tag('defs', filter_defs), layer_group] -- cgit