changeset 44:bf1be6c97c28

pads2gpcb: fixed conversion of elongated pads
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sat, 30 Jan 2016 05:48:04 +0000
parents 4a50888d09ce
children 3bdb1b5ff3d0
files pads2gpcb/decals.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/pads2gpcb/decals.c	Sat Jan 30 05:39:52 2016 +0000
+++ b/pads2gpcb/decals.c	Sat Jan 30 05:48:04 2016 +0000
@@ -226,7 +226,7 @@
 convert_pad_to_gpcb(pinidx)
 {
 	struct footprint_pad *pin = pins_array + pinidx;
-	long long_minus_short;
+	long long_minus_short, delta;
 
 	if (!pin->shape.valid) {
 		printf("error: no pad shape for pin #%d\n", pinidx + 1);
@@ -235,20 +235,20 @@
 	pin->thickness = pin->shape.short_dim;
 	pin->clearance = CLEARANCE_SETTING;
 	pin->mask = pin->thickness + SOLDERMASK_DELTA;
-	if (!pin->shape.elongated) {
-		pin->x2 = pin->x1;
-		pin->y2 = pin->y1;
+	pin->x2 = pin->x1;
+	pin->y2 = pin->y1;
+	if (!pin->shape.elongated)
 		return(0);
-	}
 	long_minus_short = pin->shape.long_dim - pin->shape.short_dim;
+	delta = long_minus_short / 2;
 	switch (pin->shape.angle) {
 	case 0:
-		pin->x2 = pin->x1 + long_minus_short;
-		pin->y2 = pin->y1;
+		pin->x1 -= delta;
+		pin->x2 += delta;
 		return(0);
 	case 90:
-		pin->x2 = pin->x1;
-		pin->y2 = pin->y1 - long_minus_short;
+		pin->y1 -= delta;
+		pin->y2 += delta;
 		return(0);
 	}
 	return(-1);