Index: trunk/pcblib/parametric/common.awk =================================================================== --- trunk/pcblib/parametric/common.awk (revision 353) +++ trunk/pcblib/parametric/common.awk (revision 354) @@ -41,6 +41,8 @@ offs_x = 0 offs_y = 0 + + pi=3.141592654 } # Throw an error and exit Index: trunk/pcblib/parametric/rcy =================================================================== --- trunk/pcblib/parametric/rcy (nonexistent) +++ trunk/pcblib/parametric/rcy (revision 354) @@ -0,0 +1,17 @@ +#!/bin/sh + +#@@example rcy(300,bar+) + +#@@purpose Generate radial lead tru-hole component + +#@@desc Generate radial lead tru-hole component with 2 pins (typical use: electrolytic caps) +#@@params spacing,pol,dia + +#@@param:spacing spacing between the two pins +#@@param:pol how to mark polarity: none, sign, bar, bar+, bar- (optional; default: sign) +#@@param:dia body diameter - affects the silk circle (optional; default: spacing*2) + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/rcy.awk -v "args=$*" + Property changes on: trunk/pcblib/parametric/rcy ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/pcblib/parametric/rcy.awk =================================================================== --- trunk/pcblib/parametric/rcy.awk (nonexistent) +++ trunk/pcblib/parametric/rcy.awk (revision 354) @@ -0,0 +1,77 @@ +BEGIN { + + set_arg(P, "?pol", "sign") + proc_args(P, "spacing,pol,dia", "spacing") + + spacing = parse_dim(P["spacing"]) + dia = either(parse_dim(P["dia"]), spacing*2) + + offs_x = +spacing/2 + + element_begin("acy" P["spacing"], "R1", "acy" P["spacing"] ,0,0, spacing/2-spacing/5,-mil(20)) + + element_pin(-spacing/2, 0, 1) + element_pin(+spacing/2, 0, 2) + +# silk rectangle and pins + element_arc(0, 0, dia/2, dia/2, 0, 360) + + if (P["pol"] == "sign") { + size=mil(20) + + offs_x = spacing/2 +dia/2+size*2 + element_line(-size, 0, +size, 0) + + offs_x = spacing/2 -dia/2-size*2 + element_line(-size, 0, +size, 0) + element_line(0, -size, 0, +size) + } + else if (P["pol"] ~ "^bar") { +# determine bar side (default to -) + side=P["pol"] + sub("^bar", "", side) + if (side == "") + side = "-" + side = int(side "1") * -1 + + th = mm(1) + ystep = th/2 + r = dia/2-th/2 + xs = dia/8 + ring = DEFAULT["pin_ringdia"] + for(y = 0; y < dia/2; y+=ystep) { + x = r*r-y*y + if (x < 0) + break + x = sqrt(x) + if (x <= xs) + break + if (y > ring/2+th/2) { + element_line(side*xs, y, side*x, y, th) + if (y != 0) + element_line(side*xs, -y, side*x, -y, th) + } + else { +# keep out a rectangle around the pin + end1=spacing/2-ring + end2=spacing/2+ring + if (end1 > xs) + element_line(side*xs, y, side*end1, y, th) + if (end2 < x) + element_line(side*end2, y, side*x, y, th) + if (y != 0) { + if (end1 > xs) + element_line(side*xs, -y, side*end1, -y, th) + if (end2 < x) + element_line(side*end2, -y, side*x, -y, th) + } + } + } + + } + else if ((P["pol"] != "") && (P["pol"] != "none")) { + error("Invalid pol") + } + + element_end() +}