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

gEDA-user: PCB: possible thermal fix



- All thermal "fingers" use DRC min-overlap rather than depending on
rounded line caps. Previously overlap was half of finger width. - Thermal "fingers" observe DRC minimum line width.
- Additional fingers added (previous thermal pattern was 'x', added '+'
for final shape of '*')


Comments? The last change isn't really necessary, though it might be nice to allow for a variety of thermal styles, including "solid".

--
10 40 80 C0 00 FF FF FF FF C0 00 00 00 00 10 AA AA 03 00 00 00 08 00
--- src/draw.c.orig	Sun Feb 13 19:26:24 2005
+++ src/draw.c	Tue Feb 15 14:36:09 2005
@@ -1193,7 +1193,7 @@
 static void
 ThermPin (LayerTypePtr layer, PinTypePtr Pin)
 {
-  BDimension half = (Pin->Thickness + Pin->Clearance) / 2;
+  BDimension half = ((Pin->Thickness + Pin->Clearance) / 2) + Settings.Shrink;
   BDimension finger;
 
   if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, Pin))
@@ -1206,28 +1206,38 @@
   else
     XSetForeground (Dpy, Output.fgGC, layer->Color);
 
-  finger = (Pin->Thickness - Pin->DrillingHole) * PCB->ThermScale;
+  finger = MAX(Settings.minWid,
+	(Pin->Thickness - Pin->DrillingHole) * PCB->ThermScale);
   XSetLineAttributes (Dpy, Output.fgGC,
 		      TEST_FLAG (THINDRAWFLAG, PCB) ? 1 : TO_SCREEN (finger),
-		      LineSolid, CapRound, JoinRound);
+		      LineSolid, CapButt, JoinMiter);
+  /* X */
   if (TEST_FLAG (SQUAREFLAG, Pin))
     {
 
       XDrawCLine (Dpy, DrawingWindow, Output.fgGC,
-		  Pin->X - half, Pin->Y - half, Pin->X + half, Pin->Y + half);
+		  Pin->X - half, Pin->Y - half,
+		  Pin->X + half, Pin->Y + half);
       XDrawCLine (Dpy, DrawingWindow, Output.fgGC,
-		  Pin->X - half, Pin->Y + half, Pin->X + half, Pin->Y - half);
+		  Pin->X - half, Pin->Y + half,
+		  Pin->X + half, Pin->Y - half);
     }
   else
     {
       BDimension halfs = (half * M_SQRT1_2 + 1);
 
       XDrawCLine (Dpy, DrawingWindow, Output.fgGC,
-		  Pin->X - halfs, Pin->Y - halfs, Pin->X + halfs,
-		  Pin->Y + halfs);
-      XDrawCLine (Dpy, DrawingWindow, Output.fgGC, Pin->X - halfs,
-		  Pin->Y + halfs, Pin->X + halfs, Pin->Y - halfs);
+		  Pin->X - halfs, Pin->Y - halfs,
+		  Pin->X + halfs, Pin->Y + halfs);
+      XDrawCLine (Dpy, DrawingWindow, Output.fgGC,
+		  Pin->X - halfs, Pin->Y + halfs,
+		  Pin->X + halfs, Pin->Y - halfs);
     }
+    /* + */
+  XDrawCLine (Dpy, DrawingWindow, Output.fgGC,
+              Pin->X, Pin->Y - half, Pin->X, Pin->Y + half);
+  XDrawCLine (Dpy, DrawingWindow, Output.fgGC,
+              Pin->X - half, Pin->Y, Pin->X + half, Pin->Y);
 }
 
 /* ---------------------------------------------------------------------------
--- src/dev_rs274x.c.orig	Sun Feb 13 21:40:57 2005
+++ src/dev_rs274x.c	Tue Feb 15 14:35:43 2005
@@ -127,6 +127,7 @@
 static void GBX_Postamble (void);
 static void GBX_Invert (int);
 static void GBX_PrintLine (LineTypePtr, Boolean);
+static void GBX_PrintLineAp (LineTypePtr, Boolean, ApertureShape);
 static void GBX_PrintArc (ArcTypePtr, Boolean);
 static void GBX_PrintPolygon (PolygonTypePtr);
 static void GBX_PrintText (TextTypePtr);
@@ -315,6 +316,8 @@
 static void
 GBX_Init (PrintInitTypePtr Flags)
 {
+  int finger;
+
   initApertures (&GBX_Apertures);
   /* gather all aperture macros */
   ALLLINE_LOOP (PCB->Data);
@@ -351,8 +354,8 @@
 	  /* check for thermal cross being used */
 	  if (TEST_FLAG (ALLTHERMFLAGS, pin))
 	    {
-	      int finger = (pin->Thickness - pin->DrillingHole) * PCB->ThermScale;
-	      findApertureCode (&GBX_Apertures, finger, 0, 0, ROUND);
+	      finger = MAX(Settings.minWid, (pin->Thickness - pin->DrillingHole) * PCB->ThermScale);
+	      findApertureCode (&GBX_Apertures, finger, 0, 0, SQUARE);
 	      findApertureCode (&GBX_Apertures, pin->Thickness,
 				pin->Thickness + pin->Clearance, finger,
 				THERMAL);
@@ -419,8 +422,8 @@
       /* check for thermal cross being used */
       if (TEST_FLAG (ALLTHERMFLAGS, via))
 	{
-	  int finger = (via->Thickness - via->DrillingHole) * PCB->ThermScale;
-	  findApertureCode (&GBX_Apertures, finger, 0, 0, ROUND);
+	  finger = MAX(Settings.minWid, (via->Thickness - via->DrillingHole) * PCB->ThermScale);
+	  findApertureCode (&GBX_Apertures, finger, 0, 0, SQUARE);
 	  findApertureCode (&GBX_Apertures, via->Thickness,
 			    via->Thickness + via->Clearance, finger, THERMAL);
 	}
@@ -646,6 +649,12 @@
 static void
 GBX_PrintLine (LineTypePtr Line, Boolean Clear)
 {
+  GBX_PrintLineAp(Line, Clear, ROUND);
+}
+
+static void
+GBX_PrintLineAp (LineTypePtr Line, Boolean Clear, ApertureShape shape)
+{
   Boolean m = False;
   int size;
 
@@ -655,7 +664,7 @@
 
   if (size == 0)
     return;
-  setAperture (&GBX_Apertures, size, 0, 0, ROUND);
+  setAperture (&GBX_Apertures, size, 0, 0, shape);
   if (Line->Point1.X != lastX)
     {
       m = True;
@@ -1017,6 +1026,7 @@
 GBX_PrintPinOrVia (PinTypePtr Ptr, int mode)
 {
   int size;
+  int finger;
 
   switch (mode)
     {
@@ -1035,8 +1045,10 @@
 	return;
       /* negative plane mode */
       if (TEST_FLAG (USETHERMALFLAG, Ptr))
-	setAperture (&GBX_Apertures, Ptr->Thickness,
-		     size, (Ptr->Thickness - Ptr->DrillingHole) * PCB->ThermScale, THERMAL);
+	{
+	  finger = MAX(Settings.minWid, (Ptr->Thickness - Ptr->DrillingHole) * PCB->ThermScale);
+	  setAperture (&GBX_Apertures, Ptr->Thickness, size, finger, THERMAL);
+        }
       else
 	setAperture (&GBX_Apertures, Ptr->Thickness, size,
 		     0, TEST_FLAG (SQUAREFLAG,
@@ -1068,20 +1080,37 @@
   if (mode == 0 && TEST_FLAG (USETHERMALFLAG, Ptr))
     {
       LineType line;
-      int size2 = (size + Ptr->Clearance) / 2;
-      int finger = (Ptr->Thickness - Ptr->DrillingHole) * PCB->ThermScale;
+      int size2;
+
+      finger = MAX(Settings.minWid, (Ptr->Thickness - Ptr->DrillingHole) * PCB->ThermScale);
+      size2 = (((size + Ptr->Clearance) / 2) - (finger / 2)) + Settings.Shrink;
+
+      line.Thickness = finger;
+
+      line.Point1.X = Ptr->X;
+      line.Point1.Y = Ptr->Y - size2;
+      line.Point2.X = Ptr->X;
+      line.Point2.Y = Ptr->Y + size2;
+      GBX_PrintLineAp (&line, False, SQUARE);
+
+      line.Point1.X = Ptr->X - size2;
+      line.Point1.Y = Ptr->Y;
+      line.Point2.X = Ptr->X + size2;
+      line.Point2.Y = Ptr->Y;
+      GBX_PrintLineAp (&line, False, SQUARE);
 
       if (!TEST_FLAG (SQUAREFLAG, Ptr))
-	size2 = (7 * size2) / 10;
+	size2 = (size2 * M_SQRT1_2 + 1);
+      else
+	size2 += (finger / 2);
       line.Point1.X = Ptr->X - size2;
       line.Point1.Y = Ptr->Y - size2;
       line.Point2.X = Ptr->X + size2;
       line.Point2.Y = Ptr->Y + size2;
-      line.Thickness = finger;
-      GBX_PrintLine (&line, False);
+      GBX_PrintLineAp (&line, False, SQUARE);
       line.Point1.Y += 2 * size2;
       line.Point2.Y -= 2 * size2;
-      GBX_PrintLine (&line, False);
+      GBX_PrintLineAp (&line, False, SQUARE);
     }
 }
 
--- src/dev_ps.c.orig	Mon Feb 14 04:25:57 2005
+++ src/dev_ps.c	Tue Feb 15 14:43:36 2005
@@ -952,17 +952,27 @@
     {
       if (TEST_FLAG (USETHERMALFLAG, Ptr))
 	{
-	  int size2 = (size + Ptr->Clearance) / 2;
-	  int finger = (Ptr->Thickness - Ptr->DrillingHole) * PCB->ThermScale;
+	  int size2 = ((size + Ptr->Clearance) / 2) + Settings.Shrink;
+	  int finger = MIN(Settings.minWid, (Ptr->Thickness - Ptr->DrillingHole) * PCB->ThermScale);
+
+	  fprintf (PS_Flags.FP, "0 setlinecap\n");
+
+	  fprintf (PS_Flags.FP, "%d %d %d %d %d L\n",
+		   Ptr->X, Ptr->Y - size2,
+		   Ptr->X, Ptr->Y + size2, finger);
+	  fprintf (PS_Flags.FP, "%d %d %d %d %d L\n",
+		   Ptr->X - size2, Ptr->Y,
+		   Ptr->X + size2, Ptr->Y, finger);
 
 	  if (!TEST_FLAG (SQUAREFLAG, Ptr))
-	    size2 = (7 * size2) / 10;
+	    size2 = (size2 * M_SQRT1_2 + 1);
 	  fprintf (PS_Flags.FP, "%d %d %d %d %d L\n",
 		   Ptr->X - size2, Ptr->Y - size2,
 		   Ptr->X + size2, Ptr->Y + size2, finger);
 	  fprintf (PS_Flags.FP, "%d %d %d %d %d L\n",
 		   Ptr->X - size2, Ptr->Y + size2,
 		   Ptr->X + size2, Ptr->Y - size2, finger);
+	  fprintf (PS_Flags.FP, "1 setlinecap\n");
 	  CLEAR_FLAG (USETHERMALFLAG, Ptr);
 	}
       fprintf (PS_Flags.FP, "%d %d %d %d %s\n",