Index: parametric_lht/acy.awk =================================================================== --- parametric_lht/acy.awk (nonexistent) +++ parametric_lht/acy.awk (revision 27179) @@ -0,0 +1,158 @@ +function wave(type, repeat, step,x,y) +{ + step = len/repeat + for(x = sx1; x < sx2; x += step) { + if (type == 1) { + subc_arc("top-silk", x+step/2, 0, step/2, 0, -180) + } + else if (type == 2) { + y = dia + subc_line("top-silk", x, 0, x+step/4, -y) + subc_line("top-silk", x+step/4, -y, x+3*step/4, y) + subc_line("top-silk", x+3*step/4, y, x+step, 0) + + } + } +} + +BEGIN { + base_unit_mm = 0 + + help_auto() + set_arg(P, "?type", "block") + proc_args(P, "spacing,type,pol,dia", "spacing") + + spacing = parse_dim(P["spacing"]) + dia = either(parse_dim(P["dia"]), spacing/6) + +# oops, dia is a radius rather + dia=dia/2 + + offs_x = +spacing/2 + + subc_begin("acy" P["spacing"], "R1_lht", spacing/2-spacing/5, -mil(20), 0) + + proto_s = subc_proto_create_pin_square() + proto_r = subc_proto_create_pin_round() + + subc_pstk(proto_s, -spacing/2, 0, 0, 1) + subc_pstk(proto_r, +spacing/2, 0, 0, 2) + + dimension(-spacing/2, 0, +spacing/2, 0, dia*4, "spacing") + +# silk pins + if (P["type"] != "line") { + subc_line("top-silk", -spacing/2, 0, -spacing/4, 0) + subc_line("top-silk", +spacing/4, 0, +spacing/2, 0) + } + +# silk symbol + sx1 = -spacing/4 + sx2 = +spacing/4 + len = sx2-sx1 + if (P["type"] == "block") { + subc_rectangle("top-silk", sx1, -dia, sx2, +dia) + } + else if (P["type"] == "zigzag") { + wave(2, 3) + } + else if (P["type"] == "coil") { + wave(1, 4) + } + else if (P["type"] == "endcap") { + cl1 = len/9 + cl2 = len/8 + y1 = dia*1.2 + y2 = dia + rarc = dia/5 + subc_line("top-silk", sx1+cl2, y2, sx2-cl2, y2) + subc_line("top-silk", sx1+cl2, y2, sx1+cl1, y1) + subc_line("top-silk", sx2-cl2, y2, sx2-cl1, y1) + + subc_line("top-silk", sx1+cl2, -y2, sx2-cl2, -y2) + subc_line("top-silk", sx1+cl2, -y2, sx1+cl1, -y1) + subc_line("top-silk", sx2-cl2, -y2, sx2-cl1, -y1) + + element_rectangle(sx1, y1, sx1+cl1, -y1, "right,NE,SE", rarc) + element_rectangle(sx2-cl1, y1, sx2, -y1, "left,NW,SW", rarc) + } + else if (P["type"] ~ "^core") { + wave(1, 4) + nlines = P["type"] + sub("^core", "", nlines) + if (nlines == "") + nlines = 1 + + cdist = 3 * DEFAULT["line_thickness"] + y = -len/8 + for(nlines = int(nlines); nlines > 0; nlines--) { + y-=cdist + subc_line("top-silk", sx1, y, sx2, y) + } + } + else if (P["type"] == "line") { + subc_line("top-silk", -spacing/2, 0, +spacing/2, 0) + } + else if (P["type"] == "standing") { + r = dia*2 + if (r < DEFAULT["pin_ringdia"]/2*1.2) + r = DEFAULT["pin_ringdia"]/2*1.2 + subc_arc("top-silk", -spacing/2, 0, r, 0, 360) + subc_line("top-silk", -spacing/2, 0, +spacing/2, 0) + } + else { + error("Invalid type") + } + + dimension(sx2, -dia, sx2, dia, spacing/2, "dia") + +# silk wiper + if (P["wiper"] == "thermistor") { + x = len/3 + subc_line("top-silk", -4*x/4, dia*2, -2*x/4, dia*2) + subc_line("top-silk", -2*x/4, dia*2, +2*x/4, -dia*2) + } + else if (P["wiper"] == "aarrow") { + x = len/3 + element_arrow(-2*x/4, dia*2, +2*x/4, -dia*2-mil(30)) + } + else if (P["wiper"] == "parrow") { + element_arrow(0, -dia*2-mil(30), 0, -dia) + } + else if (P["wiper"] == "looparrow") { + y = -dia*2-mil(30) + x = sx2+len/8 + element_arrow(0, y, 0, -dia) + subc_line("top-silk", 0, y, x, y) + subc_line("top-silk", x, y, x, 0) + } + else if ((P["wiper"] != "none") && (P["wiper"] != "")) { + error("Invalid wiper") + } + +# silk sign + if (P["pol"] == "sign") { + size=mil(10) + + offs_y = size*2.2 + offs_x = DEFAULT["pin_ringdia"]/2+size*1.1 + subc_line("top-silk", -size, 0, +size, 0) + + offs_x = spacing - (DEFAULT["pin_ringdia"]/2+size*1.1) + subc_line("top-silk", -size, 0, +size, 0) + subc_line("top-silk", 0, -size, 0, +size) + } + else if (P["pol"] == "bar") { + offs=DEFAULT["line_thickness"] + element_rectangle(-spacing/4-offs, -dia, -spacing/4+offs, +dia, DEFAULT["line_thickness"]*4) + } + else if (P["pol"] == "dot") { + r=2*DEFAULT["line_thickness"]/3 + subc_arc("top-silk", -spacing/4-r*3, -dia/2, r, 0, 360) + } + else if ((P["pol"] != "") && (P["pol"] != "none")) { + error("Invalid pol") + } + + subc_end() +} Index: parametric_lht/acy_lht =================================================================== --- parametric_lht/acy_lht (nonexistent) +++ parametric_lht/acy_lht (revision 27179) @@ -0,0 +1,56 @@ +#!/bin/sh + +#@@example acy(300) + +#@@purpose Generate axial lead through-hole component + +#@@desc Generate axial lead through-hole component with 2 pins (typical use: resistor) +#@@params spacing,type,pol,dia + +#@@param:spacing spacing between the two pins +#@@dim:spacing + +#@@param:type silk symbol type +#@@enum:type:block eu-style block resistor symbol +#@@enum:type:endcap block resistor with caps on the ends +#@@enum:type:zigzag us-style zigzag resistor symbol +#@@enum:type:line a single line (e.g. for jumper wires) +#@@enum:type:standing vertically aligned, body standing on pin 1, pin 2 bent back +#@@enum:type:coil wavy coil symbol +#@@enum:type:core wavy coil symbol with a parallel line +#@@enum:type:core2 wavy coil symbol with two parallel lines +#@@optional:type +#@@default:type block +#@@preview_args:type 300 + +#@@param:pol how to mark polarity +#@@enum:pol:none no marking +#@@enum:pol:sign + and - signs; pin 1 is + +#@@enum:pol:bar bar next to pin 1 +#@@enum:pol:dot dot next to pin 1 +#@@optional:pol +#@@default:pol none +#@@preview_args:pol 300 + +#@@param:dia body diameter - affects silk size +#@@dim:dia +#@@optional:dia +#@@default:dia spacing/6 + + +#@@param:wiper silk symbol wiper type +#@@enum:wiper:none no wiper +#@@enum:wiper:parrow perpendicular arrow, pointing inwards +#@@enum:wiper:aarrow angled arrow, pointing outwards +#@@enum:wiper:looparrow arrow starting at pin 2 looping back to point inwards on the body +#@@enum:wiper:thermistor wiper of a thermistor symbol +#@@optional:wiper +#@@default:wiper none +#@@preview_args:wiper 400 + +#@@thumbsize 2 + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/acy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" + Property changes on: parametric_lht/acy_lht ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property