Re: gEDA-user: Gerber magic numbers

2011-05-23 Thread Andrew Poelstra
On Sun, May 22, 2011 at 03:00:35PM -0700, Andrew Poelstra wrote:
 
 I am cleaning up the unit handling for the gerber
 exporter, using the guide at
 
 http://www.linux-cae.net/PCB/rs274xrevd_e.pdf
 
 Things are mostly straightforward, but I am lost
 as to the /10 factors in
 
 /* These are for drills */
 #define gerberDrX(pcb, x) ((long) ((x)/10))
 #define gerberDrY(pcb, y) ((long) (((pcb)-MaxHeight - (y)))/10)
 
 Why are the drill numbers divided by 10, and why are
 they output with leading zeroes?...


The reason for this seems to be that drill layers are
output in their own format in .cnc files, which use
different units than the .gbr (and do not terminate
their lines with *).

What is the format of these files?

-- 
Andrew Poelstra
Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net
Web:   http://www.wpsoftware.net/andrew/



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Gerber magic numbers

2011-05-23 Thread Colin D Bennett
On Mon, 23 May 2011 11:09:23 -0700
Andrew Poelstra as...@sfu.ca wrote:

 On Sun, May 22, 2011 at 03:00:35PM -0700, Andrew Poelstra wrote:
  
  I am cleaning up the unit handling for the gerber
  exporter, using the guide at
  
  http://www.linux-cae.net/PCB/rs274xrevd_e.pdf
  
  Things are mostly straightforward, but I am lost
  as to the /10 factors in
  
  /* These are for drills */
  #define gerberDrX(pcb, x) ((long) ((x)/10))
  #define gerberDrY(pcb, y) ((long) (((pcb)-MaxHeight - (y)))/10)
  
  Why are the drill numbers divided by 10, and why are
  they output with leading zeroes?...
 
 
 The reason for this seems to be that drill layers are
 output in their own format in .cnc files, which use
 different units than the .gbr (and do not terminate
 their lines with *).
 
 What is the format of these files?

The drill files output by pcb's gerber export are NC drill files,
commonly called Excellon format.

See:
http://www.apcircuits.com/resources/information/nc_introduction.html
http://en.wikipedia.org/wiki/Excellon_Format

Regards,
Colin


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: Gerber magic numbers

2011-05-23 Thread Colin D Bennett
On Sun, 22 May 2011 15:00:35 -0700
Andrew Poelstra as...@sfu.ca wrote:

 Why are the drill numbers divided by 10, and why are
 they output with leading zeroes?

For the Excellon (NC drill) format:
“Maximum m.n format supported is 2.4” [1].

That means that the units are 1/10 mil rather than the pcb-internal
1/100 mil unit.  That explains the 1/10 factor.

Regards,
Colin

[1] http://www.apcircuits.com/resources/information/nc_codes.html.


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: Gerber magic numbers

2011-05-22 Thread Andrew Poelstra

Hey all,


I am cleaning up the unit handling for the gerber
exporter, using the guide at

http://www.linux-cae.net/PCB/rs274xrevd_e.pdf

Things are mostly straightforward, but I am lost
as to the /10 factors in

/**/
/* Utility routines   */
/**/

/* These are for films */
#define gerberX(pcb, x) ((double) ((x)))
#define gerberY(pcb, y) ((double) (((pcb)-MaxHeight - (y
#define gerberXOffset(pcb, x) ((double) ((x)))
#define gerberYOffset(pcb, y) ((double) (-(y)))

/* These are for drills */
#define gerberDrX(pcb, x) ((long) ((x)/10))
#define gerberDrY(pcb, y) ((long) (((pcb)-MaxHeight - (y)))/10)
#define gerberDrXOffset(pcb, x) ((long) ((x)/10))
#define gerberDrYOffset(pcb, y) ((long) (-(y))/10)


Why are the drill numbers divided by 10, and why are
they output with leading zeroes? Also, these macros
are only used in gerber_set_layer, and the output code
in this seems indistinguishable from that of set_line
(both are X%dY%d\015\012).

Could someone knowledgeable about the gerber format and
how pcb outputs it help me out here?

Thanks.


PS: Can I replace the \015\012's all over gerber.c with \r\n's?

-- 
Andrew Poelstra
Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net
Web:   http://www.wpsoftware.net/andrew/



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user