2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 /* process clearance requirement */
21 public real process_clearance = 0.6;
23 public int mm2mils100(real mm) = floor (mm / 25.4 * 1000 * 100 + 0.5);
25 public void element_start(string name) {
26 printf ("# author: Keith Packard\n");
27 printf ("# email: keithp@keithp.com\n");
28 printf ("# dist-license: GPL 2\n");
29 printf ("# use-license: unlimited\n");
30 printf ("Element [\"\" \"%s\" \"\" \"\" 0 0 0 0 0 100 \"\"]\n",
36 public void element_end() {
40 public void pad_mm_clear(real center_x,
57 x1 = center_x - (width - height) / 2;
59 x2 = center_x + (width - height) / 2;
63 y1 = center_y - (height - width) / 2;
65 y2 = center_y + (height - width) / 2;
68 real mask = thickness + clearance / 2;
71 printf (" %6d %6d %6d %6d",
76 printf (" %6d %6d %6d",
77 mm2mils100(thickness),
78 mm2mils100(clearance),
80 printf (" \"%s\" \"%s\" \"square\"]\n",
84 public void pad_mm(real center_x,
91 pad_mm_clear(center_x,
100 public void pin_mm_clear(real x, real y, real drill, real copper, real clearance,
104 real thickness = drill + copper * 2;
105 real mask = thickness + clearance / 2;
110 printf(" %6d %6d %6d %6d",
111 mm2mils100(thickness),
112 mm2mils100(clearance),
115 printf (" \"%s\" \"%s\"",
121 public void pin_mm(real x, real y, real drill, real copper,
125 pin_mm_clear(x, y, drill, copper, process_clearance,
129 public void line (real x1, real y1, real x2, real y2)
131 printf (" ElementLine[");
132 printf (" %6d %6d %6d %6d",
140 public void rect (real x, real y, real w, real h)