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

gEDA-user: Gerber magic numbers

Hey all,

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


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?


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