comparison pads2gpcb/decals.c @ 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 c977d637f038
comparison
equal deleted inserted replaced
43:4a50888d09ce 44:bf1be6c97c28
224 224
225 static 225 static
226 convert_pad_to_gpcb(pinidx) 226 convert_pad_to_gpcb(pinidx)
227 { 227 {
228 struct footprint_pad *pin = pins_array + pinidx; 228 struct footprint_pad *pin = pins_array + pinidx;
229 long long_minus_short; 229 long long_minus_short, delta;
230 230
231 if (!pin->shape.valid) { 231 if (!pin->shape.valid) {
232 printf("error: no pad shape for pin #%d\n", pinidx + 1); 232 printf("error: no pad shape for pin #%d\n", pinidx + 1);
233 return(-1); 233 return(-1);
234 } 234 }
235 pin->thickness = pin->shape.short_dim; 235 pin->thickness = pin->shape.short_dim;
236 pin->clearance = CLEARANCE_SETTING; 236 pin->clearance = CLEARANCE_SETTING;
237 pin->mask = pin->thickness + SOLDERMASK_DELTA; 237 pin->mask = pin->thickness + SOLDERMASK_DELTA;
238 if (!pin->shape.elongated) { 238 pin->x2 = pin->x1;
239 pin->x2 = pin->x1; 239 pin->y2 = pin->y1;
240 pin->y2 = pin->y1; 240 if (!pin->shape.elongated)
241 return(0); 241 return(0);
242 }
243 long_minus_short = pin->shape.long_dim - pin->shape.short_dim; 242 long_minus_short = pin->shape.long_dim - pin->shape.short_dim;
243 delta = long_minus_short / 2;
244 switch (pin->shape.angle) { 244 switch (pin->shape.angle) {
245 case 0: 245 case 0:
246 pin->x2 = pin->x1 + long_minus_short; 246 pin->x1 -= delta;
247 pin->y2 = pin->y1; 247 pin->x2 += delta;
248 return(0); 248 return(0);
249 case 90: 249 case 90:
250 pin->x2 = pin->x1; 250 pin->y1 -= delta;
251 pin->y2 = pin->y1 - long_minus_short; 251 pin->y2 += delta;
252 return(0); 252 return(0);
253 } 253 }
254 return(-1); 254 return(-1);
255 } 255 }
256 256