www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2014/07/16/04:03:50

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Envelope-From: paubert AT iram DOT es
Date: Wed, 16 Jul 2014 10:02:41 +0200
From: Gabriel Paubert <paubert AT iram DOT es>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] Gerber Export Generates Abitrary Drill Tool Numbers
Message-ID: <20140716080241.GA9087@visitor2.iram.es>
References: <53C56517 DOT 2030901 AT hagertechnologies DOT com>
MIME-Version: 1.0
In-Reply-To: <53C56517.2030901@hagertechnologies.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spamina-Bogosity: Unsure
X-Spamina-Spam-Score: -0.2 (/)
X-Spamina-Spam-Report: Content analysis details: (-0.2 points)
pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60%
[score: 0.4975]
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, Jul 15, 2014 at 01:29:59PM -0400, Geoffrey Yerem - HEAT, LLC wrote:
> Hello,
> 	I'm having a small problem with the Gerber export in PCB.  When it
> generates the cnc drill file, it starts the tool numbers at an
> arbitrary count.

Not exactly an aribtrary count, it uses the same number space for Gerber
apertures and drill numbers.

I believe I submitted a patch for this and it was not included because
it was thought that it could break something. I have appended the patch
to this mail, but I don't know whether you compile from sources or use 
a version packaged in the distribution.

>  For example,
> 
> ...
> T648C0.016
> T647C0.167
> ...
> 
> 	This normally isn't a problem when I'm viewing the gerbers in
> gerbv, but my fab house is complaining that they can't handle tool
> numbers greater than 255.

So the current PCB system breaks your fab process.

> 
> 	While I imagine that they can fix things on their end, is there any
> reason to start the tool numbers so high?  Why can't they simply
> start at 001?  Is there a workaround where I can fool PCB into
> starting at a lower number, so I don't have to manually edit the
> file and risk making a mistake?

Apply the following patch and recompile:


diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 6d7c7c1..d02d35d 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -106,7 +106,8 @@ enum ApertureShape
   SQUARE,			/* Shaped like a square */
   ROUNDCLEAR,			/* clearance in negatives */
   SQUARECLEAR,
-  THERMAL			/* negative thermal relief */
+  THERMAL,			/* negative thermal relief */
+  DRILL
 };
 typedef enum ApertureShape ApertureShape;
 
@@ -174,7 +175,7 @@ deinitApertureList (ApertureList *list)
   initApertureList (list);
 }
 
-static int aperture_count;
+static int aperture_count, drill_count;
 
 static void resetApertures()
 {
@@ -187,6 +188,7 @@ static void resetApertures()
   layer_list_max = 0;
   layer_list_idx = 0;
   aperture_count = 0;
+  drill_count = 0;
 }
 
 /* Create and add a new aperture to the list */
@@ -200,7 +202,8 @@ addAperture (ApertureList *list, Coord width, ApertureShape shape)
 
   app->width = width;
   app->shape = shape;
-  app->dCode = DCODE_BASE + aperture_count++;
+  if (shape == DRILL) app->dCode = ++drill_count;
+  else app->dCode = DCODE_BASE + aperture_count++;
   app->next  = list->data;
 
   list->data = app;
@@ -694,7 +697,7 @@ gerber_set_layer (const char *name, int group, int empty)
 	{
 	  if (i == 0 || pending_drills[i].diam != pending_drills[i - 1].diam)
 	    {
-	      Aperture *ap = findAperture (curr_aptr_list, pending_drills[i].diam, ROUND);
+	      Aperture *ap = findAperture (curr_aptr_list, pending_drills[i].diam, DRILL);
 	      fprintf (f, "T%02d\r\n", ap->dCode);
 	    }
 	  pcb_fprintf (f, metric ? "X%06.0muY%06.0mu\r\n" : "X%06.0mtY%06.0mt\r\n",
@@ -762,7 +765,7 @@ gerber_set_layer (const char *name, int group, int empty)
       if (is_drill)
 	{
 	  /* We omit the ,TZ here because we are not omitting trailing zeros.  Our format is
-	     always six-digit 0.1 mil or µm resolution (i.e. 001100 = 0.11" or 1.1mm)*/
+	     always six-digit 0.1 mil or um resolution (i.e. 001100 = 0.11" or 1.1mm)*/
 	  fprintf (f, "M48\r\n");
 	  fprintf (f, metric ? "METRIC,000.000\r\n" : "INCH\r\n");
 	  for (search = aptr_list->data; search; search = search->next)
@@ -947,7 +950,8 @@ use_gc (hidGC gc, int radius)
       radius *= 2;
       if (radius != linewidth || lastcap != Round_Cap)
 	{
-	  Aperture *aptr = findAperture (curr_aptr_list, radius, ROUND);
+	  Aperture *aptr = findAperture (curr_aptr_list, radius,
+					 is_drill ? DRILL : ROUND);
 	  if (aptr == NULL)
 	    pcb_fprintf (stderr, "error: aperture for radius %$mS type ROUND is null\n", radius);
 	  else if (f && !is_drill)


> 
> 	Thanks for your help!
> 
> Geoffrey

	Regards,
	Gabriel

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019