[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: Angled pads on pcb



Hi,

Don't know if this is any use to anyone else, but we wanted to put a
connector at a 30 degree angle on a PCB. Every time we loaded the file,
it was sheared in a funny way. This patch fixes it, but I don't know if
it breaks anything else.

I've posted it to the sourceforge patch list as well.

cheers, Rich.

--- pcb-1.99j/src/create.c.orig	2005-02-08 17:48:14.000000000 +0000
+++ pcb-1.99j/src/create.c	2005-02-08 17:48:41.000000000 +0000
@@ -567,22 +567,29 @@
 PadTypePtr
 CreateNewPad (ElementTypePtr Element,
 	      Position X1, Position Y1, Position X2, Position Y2,
 	      Dimension Thickness, Dimension Clearance, Dimension Mask,
 	      char *Name, char *Number, int Flags)
 {
   PadTypePtr pad = GetPadMemory (Element);
 
   /* copy values */
-  pad->Point1.X = MIN(X1, X2); /* works since either X1 == X2 or Y1 == Y2 */
-  pad->Point1.Y = MIN(Y1, Y2);
-  pad->Point2.X = MAX(X1, X2);
-  pad->Point2.Y = MAX(Y1, Y2);
+  if ((X1==X2) || (Y1==Y2)) {
+    pad->Point1.X = MIN(X1, X2); /* works since either X1 == X2 or Y1 == Y2 */
+    pad->Point1.Y = MIN(Y1, Y2);
+    pad->Point2.X = MAX(X1, X2);
+    pad->Point2.Y = MAX(Y1, Y2);
+  } else {
+    pad->Point1.X = X1; /* works since either X1 == X2 or Y1 == Y2 */
+    pad->Point1.Y = Y1;
+    pad->Point2.X = X2;
+    pad->Point2.Y = Y2;
+  }
   pad->Thickness = Thickness;
   pad->Clearance = Clearance;
   pad->Mask = Mask;
   pad->Name = MyStrdup (Name, "CreateNewPad()");
   pad->Number = MyStrdup (Number, "CreateNewPad()");
   pad->Flags = Flags & ~WARNFLAG;
   pad->ID = ID++;
   return (pad);
 }


-- 
rich walker         |  Shadow Robot Company | rw@xxxxxxxxxxxxx
technical director     251 Liverpool Road   |
need a Hand?           London  N1 1LX       | +UK 20 7700 2487
www.shadow.org.uk/products/newhand.shtml