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 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(real center_x,
56 x1 = center_x - (width - height) / 2;
58 x2 = center_x + (width - height) / 2;
62 y1 = center_y - (height - width) / 2;
64 y2 = center_y + (height - width) / 2;
67 real mask = thickness + clearance / 2;
70 printf (" %6d %6d %6d %6d",
75 printf (" %6d %6d %6d",
76 mm2mils100(thickness),
77 mm2mils100(clearance),
79 printf (" \"%s\" \"%s\" \"square\"]\n",
83 public void pin_mm(real x, real y, real drill, real copper,
87 real thickness = drill + copper * 2;
88 real mask = thickness + clearance / 2;
93 printf(" %6d %6d %6d %6d",
94 mm2mils100(thickness),
95 mm2mils100(clearance),
98 printf (" \"%s\" \"%s\"",
104 public void line (real x1, real y1, real x2, real y2)
106 printf (" ElementLine[");
107 printf (" %6d %6d %6d %6d",
115 public void rect (real x, real y, real w, real h)