Index: parametric_lht/so =================================================================== --- parametric_lht/so (revision 27205) +++ parametric_lht/so (nonexistent) @@ -1,40 +0,0 @@ -#!/bin/sh - -#@@example so(14) - -#@@purpose Generate SO and SO-like packages. - -#@@desc Generate SO packages with variable number of pins and -#@@desc row spacing -#@@params n, row_spacing, pad_spacing - -#@@param:n number of pins - -#@@param:row_spacing spacing between the two rows of pads: distance between the end of the first and last pins -#@@dim:row_spacing -#@@optional:row_spacing -#@@default:row_spacing 250 mil - - -#@@param:pad_spacing spacing between the centerline of two pads -#@@dim:pad_spacing -#@@optional:pad_spacing -#@@default:pad_spacing 50 mil - - -#@@param:ext_bloat how much longer the pad should extend outwards from the end-point of the pin -#@@dim:ext_bloat -#@@optional:ext_bloat -#@@default:ext_bloat 10 mil - -#@@param:int_bloat how much longer the pad should extend inwards from the end-point of the pin -#@@dim:int_bloat -#@@optional:int_bloat -#@@default:int_bloat 55 mil - -#@@include common_subc.awk - -#@@over@ignore::pin_ - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/so ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/plcc =================================================================== --- parametric_lht/plcc (revision 27205) +++ parametric_lht/plcc (nonexistent) @@ -1,29 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP - -#@@example plcc(20) - -#@@purpose Generate PLCC packages -#@@desc Generate square PLCC packages - a simplified frontend to qf() - -#@@desc only the number of pins is really needed for a square PLCC footprint! -#@@desc NOTE: some of the qf() parameters can be also used; PLCC32 is non-square, and can not be properly generated using this generator. - -#@@params pins,size,pitch,cpad_size - -#@@param:pins total number of pins (leads); must be divisible by 4 - -#@@param:size a single integer N or NxN or NxNxH; outmost dimensions (width or height of the package, leads included) in mil -#@@optional:size -#@@default:size calculated from total number of pins and pitch - -#@@param:pitch lead pitch (distance between the centerline of two adjacent leads), in mil; must be 50 for now -#@@optional:pitch -#@@default:pitch 50mil - -#@@param:cpad_size width (and height) of the central pad, in mil -#@@optional:cpad_size -#@@default:cpad_size empty, there's no central pad - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/plcc.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/plcc ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/qsop =================================================================== --- parametric_lht/qsop (revision 27205) +++ parametric_lht/qsop (nonexistent) @@ -1,34 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), QSOP - -#@@example qsop(14) - -#@@purpose Generate QSOP packages. - -#@@desc Generate QSOP packages with variable number of pins and -#@@desc row spacing - -#@@include so -#@@include common_subc.awk - -#@@over@default:pad_spacing 25 mil -#@@over@default:row_spacing 213 mil -#@@over@default:int_vloat 22 mil -#@@over@default:ext_bloat 23 mil -#@@over@default:pad_thickness 16 mil - - -defaults=' -?pad_spacing=25mil, -?row_spacing=213mil, -?int_bloat=22mil, -?ext_bloat=23mil, -?rarc=25, -?silk_ext_x=18, -?silk_ext_y=22, -?pad_thickness=16mil -' - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/qsop ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/screw =================================================================== --- parametric_lht/screw (revision 27205) +++ parametric_lht/screw (nonexistent) @@ -1,35 +0,0 @@ -#!/bin/sh - -#@@example screw(3.2mm, 6mm, circle:hex) - -#@@purpose Generic screw. - -#@@desc Generate a "single pin" screw with optional head shapes -#@@params hole,head,shape,ring - -#@@param:hole hole diameter or name of a standard screw (e.g. M3) -#@@dim:hole - - -#@@param:head head outmost diameter (or optional head name for a standard screw: pan, button, cheese, flat-washer, internal-lock-washer) -#@@dim:head - -#@@param:ring copper ring outer diameter -#@@dim:ring -#@@optional:ring -#@@default:ring 80% of head diameter - - -#@@param:shape shape of the head drawn on silkmark; multiple values can be listed separated with colons, e.g. "shape=circle:hex" -#@@enum:shape:circle circle -#@@enum:shape:hex hexagon with straight line edges, size is from corner to corner -#@@enum:shape:tx "torx": hexagon with arced edges -#@@enum:shape:xzn "triple square" -#@@enum:shape:ph philips slot (cross) - useful together with circle -#@@enum:shape:slot a single straight line slot - useful together with circle -#@@default:shape circle -#@@preview_args:shape 3mm,6mm - -#@@include common_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/screw.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" -v "genfull=$0" Property changes on: parametric_lht/screw ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/alf.awk =================================================================== --- parametric_lht/alf.awk (revision 27205) +++ parametric_lht/alf.awk (nonexistent) @@ -1,71 +0,0 @@ -BEGIN { - base_unit_mm = 0 - - help_auto() - set_arg(P, "?aspect", 6) - set_arg(P, "?type", "normal") - - proc_args(P, "spacing,type,dia,aspect", "spacing") - - spacing = parse_dim(P["spacing"]) - dia = either(parse_dim(P["dia"]), spacing/6) - aspect = P["aspect"] - - offs_x = +spacing/2 - - subc_begin("acy" P["spacing"], "D1", 2.2*spacing/3-offs_x,-mil(50)) - - 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") - -# pins - subc_line("top-silk", -spacing/2, 0, -spacing/aspect, 0) - subc_line("top-silk", +spacing/aspect, 0, +spacing/2, 0) - -# triangle - subc_line("top-silk", +spacing/aspect, -dia, +spacing/aspect, +dia) - subc_line("top-silk", +spacing/aspect, -dia, -spacing/aspect, 0) - subc_line("top-silk", +spacing/aspect, +dia, -spacing/aspect, 0) - - dimension(+spacing/aspect, -dia, +spacing/aspect, dia, "@" spacing*1.2 ";0", "dia") - - -# front cross line with decoration - r = dia*0.3 - if (P["type"] == "normal") { - subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) - } - else if (P["type"] == "zener") { - subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) - subc_line("top-silk", -spacing/aspect, +dia, -spacing/aspect-r, +dia) - subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect+r, -dia) - } - else if (P["type"] == "tunnel") { - subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) - subc_line("top-silk", -spacing/aspect, +dia, -spacing/aspect+r, +dia) - subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect+r, -dia) - } - else if (P["type"] == "varactor") { - subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) - subc_line("top-silk", -spacing/aspect-r, -dia, -spacing/aspect-r, +dia) - } - else if (P["type"] == "schottky") { - cx = -spacing/aspect + r - cy = -(dia-r) - subc_line("top-silk", -spacing/aspect, -(dia-r), -spacing/aspect, +dia-r) - subc_arc("top-silk", cx, cy, r, 0, -180) - cx = -spacing/aspect - r - cy = +(dia-r) - subc_arc("top-silk", cx, cy, r, 0, +180) - } - else if ((P["type"] != "") && (P["type"] != "none")) { - error("Invalid type") - } - - subc_end() -} Index: parametric_lht/ssop =================================================================== --- parametric_lht/ssop (revision 27205) +++ parametric_lht/ssop (nonexistent) @@ -1,33 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP - -#@@example ssop(14) - -#@@purpose Generate SSOP packages. - -#@@desc Generate SSOP packages with variable number of pins and -#@@desc row spacing - -#@@include so -#@@include common_subc.awk - -#@@over@default:pad_spacing 0.65 mm -#@@over@default:row_spacing 7.8 mm -#@@over@default:int_bloat 0.5 mm -#@@over@default:ext_bloat 0.13 mm -#@@over@default:pad_thickness 0.45 mm - -defaults=' -?pad_spacing=0.65mm, -?row_spacing=7.8mm, -?int_bloat=0.5mm, -?ext_bloat=0.13mm, -?rarc=25, -?silk_ext_x=18, -?silk_ext_y=22, -?pad_thickness=0.45mm -' - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/ssop ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/qfn =================================================================== --- parametric_lht/qfn (revision 27205) +++ parametric_lht/qfn (nonexistent) @@ -1,24 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP - -#@@example qfn(16,3x3,0.5) - -#@@purpose Generate QFN packages -#@@desc Generate QFN packages - a simplified frontend to qf() - -#@@desc look up 3..4 data in the datasheet and get a regular QFN footprint! -#@@desc Should work for QFN, TQFN, etc. -#@@desc NOTE: some of the qf() parameters can be also used. - -#@@params pins,size,pitch,cpad_size - -#@@param:pins total number of pins (leads); must be divisible by 4 -#@@param:size a single integer N or NxN or NxNxH; the pad spacing dimension (outer dimension, lead-to-lead) in mm -#@@param:pitch lead pitch (distance between the centerline of two adjacent leads), in mm; must be one of 0.4, 0.5, 0.65 - -#@@param:cpad_size width (and height) of the central pad, in mm -#@@optional:cpad_size -#@@default:cpad_size empty, there's no central pad - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/qfn.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/qfn ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/common_subc.awk =================================================================== --- parametric_lht/common_subc.awk (revision 27205) +++ parametric_lht/common_subc.awk (nonexistent) @@ -1,1021 +0,0 @@ -#@@param:pin_ringdia pin's copper ring (annulus) outer diameter (in mil by default, mm suffix can be used) -#@@optional:pin_ringdia -#@@dim:pin_ringdia - -#@@param:pin_clearance pin's copper clearance diameter (in mil by default, mm suffix can be used) -#@@optional:pin_clearance -#@@dim:pin_clearance - -#@@param:pin_mask pin's solder mask diameter (in mil by default, mm suffix can be used) -#@@optional:pin_mask -#@@dim:pin_mask - -#@@param:pin_drill copper pin's drill diameter (in mil by default, mm suffix can be used) -#@@optional:pin_drill -#@@dim:pin_drill - -#@@param:pad_thickness width of pads (in mil by default, mm suffix can be used) -#@@optional:pad_thickness -#@@dim:pad_thickness - -#@@param:pad_clearance copper clearance around the pad (in mil by default, mm suffix can be used) -#@@optional:pad_clearance -#@@dim:pad_clearance - -#@@param:pad_mask pin's solder mask (in mil by default, mm suffix can be used) -#@@optional:pad_mask -#@@dim:pad_mask - -#@@param:pad_paste pad's paste line thickness (in mil by default, mm suffix can be used) -#@@optional:pad_paste -#@@dim:pad_paste - -#@@param:line_thickness silk line thickness (in mil by default, mm suffix can be used) -#@@optional:line_thickness -#@@dim:line_thickness - -BEGIN { - q="\"" - - DEFAULT["pin_ringdia"] = mil(80) - DEFAULT["pin_ringdia", "dim"] = 1 - - DEFAULT["pin_clearance"] = mil(50) - DEFAULT["pin_clearance", "dim"] = 1 - - DEFAULT["pin_mask"] = mil(86) - DEFAULT["pin_mask", "dim"] = 1 - - DEFAULT["pin_drill"] = mm(1) - DEFAULT["pin_drill", "dim"] = 1 - - DEFAULT["line_thickness"] = mil(10) - DEFAULT["line_thickness", "dim"] = 1 - - DEFAULT["pad_thickness"] = mil(20) - DEFAULT["pad_thickness", "dim"] = 1 - DEFAULT["pad_clearance"] = mil(10) - DEFAULT["pad_clearance", "dim"] = 1 - DEFAULT["pad_mask"] = mil(30) - DEFAULT["pad_mask", "dim"] = 1 - DEFAULT["pad_paste"] = "" # use copper size - DEFAULT["pad_paste", "dim"] = 1 - - DEFAULT["pin_flags"] = "__auto" - - s_default=1 - s_weak=2 - s_explicit=3 - - offs_x = 0 - offs_y = 0 - objid = 1 - proto_next_id = 0 - - pi=3.141592654 - - NL = "\n" -} - -# Throw an error and exit -function error(msg) -{ - print "Error: " msg > "/dev/stderr" - exit 1 -} - -# return a if it is not empty, else return b -function either(a, b) -{ - return a != "" ? a : b -} - -# strip leading/trailing whitespaces -function strip(s) -{ - sub("^[ \t\r\n]*", "", s) - sub("[ \t\r\n]*$", "", s) - return s -} - -function lht_str(s) -{ - if (s ~ "[^A-Za-z0-9 _-]") { - gsub("}", "\\}", s) - return "{" s "}" - } - return s -} - -function unit(coord) -{ - if (coord == "") - coord = 0 - if (base_unit_mm) - return coord "mm" - return coord "mil" -} - -function subc_text(layer, x, y, str, scale, rot, flags, attributes ,s) -{ - - s = s " ha:text." ++objid "{" NL - s = s " scale = " either(scale, 100) NL - if (attributes != "") - s = s " ha:attributes {" attributes "}" NL - s = s " x = " unit(x) NL - s = s " y = " unit(y) NL - s = s " rot = " either(rot, 0) NL - s = s " string = %a.parent.refdes%" NL - s = s " fid = 0" NL - s = s " ha:flags {" flags "}" NL - s = s " }" NL - - LAYER[layer] = LAYER[layer] NL s -} - -function subc_line(layer, x1, y1, x2, y2, thick, clr, flags, attributes ,s) -{ - s = s " ha:line." ++objid " {" NL - s = s " x1 = " unit(x1) NL - s = s " y1 = " unit(y1) NL - s = s " x2 = " unit(x2) NL - s = s " y2 = " unit(y2) NL - s = s " thickness = " unit(either(thick, DEFAULT["line_thickness"])) NL - s = s " clearance = " unit(either(clr, 0)) NL - if (attributes != "") - s = s " ha:attributes {" attributes "}" NL - s = s " ha:flags {" flags "}" NL - s = s " }" NL - - LAYER[layer] = LAYER[layer] NL s -} - -function subc_arc(layer, cx, cy, r, a_start, a_delta, thick, clr, flags, attributes ,s) -{ - s = s " ha:arc." ++objid " {" NL - s = s " x = " unit(cx) NL - s = s " y = " unit(cy) NL - s = s " astart = " a_start NL - s = s " adelta = " a_delta NL - s = s " thickness = " unit(either(thick, DEFAULT["line_thickness"])) NL - s = s " clearance = " unit(either(clr, 0)) NL - s = s " width = " unit(r) NL - s = s " height = " unit(r) NL - if (attributes != "") - s = s " ha:attributes {" attributes "}" NL - s = s " ha:flags {" flags "}" NL - s = s " }" NL - - LAYER[layer] = LAYER[layer] NL s -} - -function subc_rect(layer, x1, y1, x2, y2, clearance, flags, attributes ,s) -{ - w = w/2 - h = h/2 - s = s " ha:polygon." ++objid " {" NL - s = s " clearance=" unit(clearance) NL - s = s " li:geometry {" NL - s = s " ta:contour {" NL - s = s " { " unit(x1) "; " unit(y1) " }" NL - s = s " { " unit(x2) "; " unit(y1) " }" NL - s = s " { " unit(x2) "; " unit(y2) " }" NL - s = s " { " unit(x1) "; " unit(y2) " }" NL - s = s " }" NL - s = s " }" NL - s = s " ha:attributes {" attributes "}" NL - s = s " ha:flags {" flags "}" NL - s = s " }" NL - - LAYER[layer] = LAYER[layer] NL s -} - -# start generating a subcircuit -function subc_begin(footprint, refdes, refdes_x, refdes_y, refdes_dir) -{ - print "li:pcb-rnd-subcircuit-v6 {" - print " ha:subc." ++objid "{" - print " ha:attributes {" - print " footprint = " lht_str(footprint) - if (refdes != "") - print " refdes = " lht_str(refdes) - print " }" - - - subc_text("top-silk", refdes_x, refdes_y, "%a.parent.refdes%", 100, text_dir, "dyntext = 1;floater=1;") - LAYER_TYPE["subc-aux"] = "top-misc-virtual" - subc_line("subc-aux", -offs_x, -offs_y, -offs_x + mm(1), -offs_y, mm(0.1), 0, "", "subc-role = x"); - subc_line("subc-aux", -offs_x, -offs_y, -offs_x, -offs_y + mm(1), mm(0.1), 0, "", "subc-role = y"); - subc_line("subc-aux", -offs_x, -offs_y, -offs_x, -offs_y, mm(0.1), 0, "", "subc-role = origin"); -} - -# generate subcircuit footers -function subc_end( layer,n,v,L,lt) -{ - print " ha:data {" - print " li:padstack_prototypes {" - for(n = 0; n < proto_next_id; n++) { - if (PROTO_COMMENT[n] != "") - print PROTO_COMMENT[n] - print " ha:ps_proto_v6." n " {" - print PROTO[n] - print " }" - } - print " }" - -# global objects (padstack refs) - print " li:objects {" - print globals - print " }" - -# layers and layer objects - print " li:layers {" - for(layer in LAYER) { - lt = either(LAYER_TYPE[layer], layer) - v = split(lt, L, "-") - print " ha:" layer " {" - print " lid = 0" - print " ha:type {" - for(n = 1; n <= v; n++) - print " " L[n] " = 1" - print " }" - print " li:objects {" - print LAYER[layer] - print " }" - print " ha:combining {" - print " }" - print " }" - } - print " }" - print " }" - print " }" - print "}" -} - -function subc_proto_alloc() -{ - return proto_next_id++ -} - -function subc_pstk_add_hole(proto, dia, plated, htop, hbottom ,s) -{ - s = s " hdia = " unit(dia) NL - s = s " hplated = " int(plated) NL - s = s " htop = " int(htop) NL - s = s " hbottom = " int(hbottom) NL - PROTO[proto] = PROTO[proto] s - PROTO_HOLE[proto] = dia -} - -function subc_pstk_no_hole(proto ,s) -{ - s = s " hdia = 0; hplated = 0; htop = 0; hbottom = 0" NL - PROTO[proto] = PROTO[proto] s -} - -function subc_pstk_shape_layer(layer ,s,L,v,n) -{ - v = split(layer, L, "-") - s = s " ha:layer_mask {" NL - for(n = 1; n <= v; n++) - s = s " " L[n] " = 1" NL - s = s " }" NL - s = s " ha:combining {" NL - if (layer ~ "mask") - s = s " sub = 1" NL - if ((layer ~ "mask") || (layer ~ "paste")) - s = s " auto = 1" NL - s = s " }" NL - return s -} - -function subc_pstk_add_shape_circ(proto, layer, x, y, dia ,s) -{ - s = s " ha:ps_shape_v4 {" NL - s = s " clearance = 0" NL - s = s " ha:ps_circ {" NL - s = s " x = " unit(x) NL - s = s " y = " unit(y) NL - s = s " dia = " unit(dia) NL - s = s " }" NL - s = s subc_pstk_shape_layer(layer) - s = s " }" NL - PROTO[proto] = PROTO[proto] s -} - -function subc_pstk_add_shape_square(proto, layer, x, y, sx, sy ,s) -{ - sx = sx / 2 - sy = sy / 2 - s = s " ha:ps_shape_v4 {" NL - s = s " clearance = 0" NL - s = s " li:ps_poly {" NL - s = s " " unit(x - sx) ";" unit(y - sy) "; " unit(x + sx) ";" unit(y - sy) ";" NL - s = s " " unit(x + sx) ";" unit(y + sy) "; " unit(x - sx) ";" unit(y + sy) ";" NL - s = s " }" NL - s = s subc_pstk_shape_layer(layer) - s = s " }" NL - PROTO[proto] = PROTO[proto] s -} - -function subc_pstk_add_shape_square_corners(proto, layer, x1, y1, x2, y2 ,s) -{ - sx = sx / 2 - sy = sy / 2 - s = s " ha:ps_shape_v4 {" NL - s = s " clearance = 0" NL - s = s " li:ps_poly {" NL - s = s " " unit(x1) ";" unit(y1) "; " unit(x2) ";" unit(y1) ";" NL - s = s " " unit(x2) ";" unit(y2) "; " unit(x1) ";" unit(y2) ";" NL - s = s " }" NL - s = s subc_pstk_shape_layer(layer) - s = s " }" NL - PROTO[proto] = PROTO[proto] s -} - -function subc_pstk_add_shape_line(proto, layer, x1, y1, x2, y2, thick ,s) -{ - s = s " ha:ps_shape_v4 {" NL - s = s " clearance = 0" NL - s = s " ha:ps_line {" NL - s = s " x1=" unit(x1) "; y1=" unit(y1) "; x2=" unit(x2) "; y2=" unit(y2) ";" NL - s = s " thickness=" unit(thick) "; square=0" NL - s = s " }" NL - s = s subc_pstk_shape_layer(layer) - s = s " }" NL - PROTO[proto] = PROTO[proto] s -} - -function subc_proto_create_pin_round(drill_dia, ring_dia, mask_dia ,proto) -{ - proto = subc_proto_alloc() - subc_pstk_add_hole(proto, either(drill_dia, DEFAULT["pin_drill"]), 1) - - PROTO_COMMENT[proto] = "# Round plated through hole " unit(ring_dia) "/" unit(drill_dia) - PROTO[proto] = PROTO[proto] " li:shape {" NL - - ring_dia = either(ring_dia, DEFAULT["pin_ringdia"]) - subc_pstk_add_shape_circ(proto, "top-copper", x, y, ring_dia) - subc_pstk_add_shape_circ(proto, "intern-copper", x, y, ring_dia) - subc_pstk_add_shape_circ(proto, "bottom-copper", x, y, ring_dia) - - mask_dia = either(mask_dia, DEFAULT["pin_mask"]) - subc_pstk_add_shape_circ(proto, "top-mask", x, y, mask_dia) - subc_pstk_add_shape_circ(proto, "bottom-mask", x, y, mask_dia) - - PROTO[proto] = PROTO[proto] " }" NL - return proto -} - -function subc_proto_create_pin_square(drill_dia, ring_span, mask_span ,proto) -{ - proto = subc_proto_alloc() - subc_pstk_add_hole(proto, either(drill_dia, DEFAULT["pin_drill"]), 1) - - PROTO_COMMENT[proto] = "# Square plated through hole " unit(ring_dia) "/" unit(drill_dia) - PROTO[proto] = PROTO[proto] " li:shape {" NL - - ring_span = either(ring_span, DEFAULT["pin_ringdia"]) - subc_pstk_add_shape_square(proto, "top-copper", x, y, ring_span, ring_span) - subc_pstk_add_shape_square(proto, "intern-copper", x, y, ring_span, ring_span) - subc_pstk_add_shape_square(proto, "bottom-copper", x, y, ring_span, ring_span) - - mask_span = either(mask, DEFAULT["pin_mask"]) - subc_pstk_add_shape_square(proto, "top-mask", x, y, mask_span, mask_span) - subc_pstk_add_shape_square(proto, "bottom-mask", x, y, mask_span, mask_span) - PROTO[proto] = PROTO[proto] " }" NL - - return proto -} - -function pad_paste(copper, absval, offsval, ratio) -{ - if (absval != "") - return absval - if (offsval != 0) - return copper+offsval - if (ratio != 0) - return copper*ratio - if (DEFAULT["pad_paste"] != "") - return DEFAULT["pad_paste"] - return copper -} - -function pad_paste_offs(offsval) -{ - return either(offsval, (DEFAULT["pad_paste"]) - DEFAULT["pad_thickness"]) -} - -function subc_proto_create_pad_sqline(x1, x2, thick, mask, paste ,proto,m,p) -{ - proto = subc_proto_alloc() - - thick = either(thick, DEFAULT["pad_thickness"]) - - subc_pstk_no_hole(proto) - - PROTO_COMMENT[proto] = "# Square smd pad " x2-x1 " * " thick - PROTO[proto] = PROTO[proto] " li:shape {" NL - - subc_pstk_add_shape_square_corners(proto, "top-copper", x1-thick/2, -thick/2, x2+thick/2, thick/2) - - m = (either(mask, DEFAULT["pad_mask"]) - thick) / 2 - subc_pstk_add_shape_square_corners(proto, "top-mask", x1-thick/2-m, -thick/2-m, x2+thick/2+m, thick/2+m) - - p = (pad_paste(thick, paste)-thick)/2 - subc_pstk_add_shape_square_corners(proto, "top-paste", x1-thick/2-p, -thick/2-p, x2+thick/2+p, thick/2+p) - - PROTO[proto] = PROTO[proto] " }" NL - - return proto -} - -function subc_proto_create_pad_line(x1, x2, thick, mask, paste ,proto,m,p) -{ - proto = subc_proto_alloc() - - thick = either(thick, parse_dim(DEFAULT["pad_thickness"])) - - subc_pstk_no_hole(proto) - - PROTO_COMMENT[proto] = "# Square smd pad " x2-x1 " * " thick - PROTO[proto] = PROTO[proto] " li:shape {" NL - - subc_pstk_add_shape_line(proto, "top-copper", x1, 0, x2, 0, thick) - subc_pstk_add_shape_line(proto, "top-mask", x1, 0, x2, 0, either(mask, DEFAULT["pad_mask"])) - subc_pstk_add_shape_line(proto, "top-paste", x1, 0, x2, 0, pad_paste(thick, paste)) - - PROTO[proto] = PROTO[proto] " }" NL - - return proto -} - -function subc_proto_create_pad_rect(w, h, mask_offs, paste_offs ,proto,m,p) -{ - proto = subc_proto_alloc() - - subc_pstk_no_hole(proto) - - PROTO_COMMENT[proto] = "# Square smd pad " w " * " h - PROTO[proto] = PROTO[proto] " li:shape {" NL - - w = w/2 - h = h/2 - - subc_pstk_add_shape_square_corners(proto, "top-copper", -w, -h, +w, +h) - - if (mask_offs != "none") { - m = (either(mask_offs, (DEFAULT["pad_mask"]) - DEFAULT["pad_thickness"]) / 2) - subc_pstk_add_shape_square_corners(proto, "top-mask", -w-m, -h-m, +w+m, +h+m) - } - - if (paste_offs != "none") { - p = pad_paste_offs(paste_offs) / 2 - subc_pstk_add_shape_square_corners(proto, "top-paste", -w-p, -h-p, +w+p, +h+p) - } - - PROTO[proto] = PROTO[proto] " }" NL - - return proto -} - - -function subc_proto_create_pad_circle(dia, mask_dia, paste_dia ,proto) -{ - proto = subc_proto_alloc() - subc_pstk_no_hole(proto) - - dia = either(dia, DEFAULT["pad_dia"]) - - PROTO_COMMENT[proto] = "# Circular smd pad " unit(dia) - PROTO[proto] = PROTO[proto] " li:shape {" NL - - subc_pstk_add_shape_circ(proto, "top-copper", 0, 0, dia) - - mask_dia = either(mask_dia, DEFAULT["pad_mask_dia"]) - subc_pstk_add_shape_circ(proto, "top-mask", 0, 0, mask_dia) - - paste_dia = either(mask_dia, DEFAULT["pad_paste_dia"]) - subc_pstk_add_shape_circ(proto, "top-mask", 0, 0, paste_dia) - - PROTO[proto] = PROTO[proto] " }" NL - return proto -} - -# generate a padstack reference -function subc_pstk(proto, x, y, rot, termid, name, clearance, s) -{ - if (termid == "") - termid = ++pin_number - - s = s " ha:padstack_ref." ++objid " {" NL - s = s " proto = " proto NL - s = s " x = " unit(x) NL - s = s " y = " unit(y) NL - s = s " rot = " rot+0 NL - s = s " smirror = 0; xmirror = 0" NL - s = s " clearance = " unit(either(clearance, (PROTO_HOLE[proto] > 0 ? DEFAULT["pin_clearance"] : DEFAULT["pad_clearance"]))/2) NL - s = s " ha:attributes {" NL - s = s " term = " termid NL - if (name != "") - s = s " name = 1" NL - s = s " }" NL - s = s " li:thermal { }" NL - s = s " ha:flags { clearline = 1; }" NL - s = s " }" NL - - globals = globals NL s -} - -# draw element pad -function subc_pad(x1, y1, x2, y2, thickness, number, flags, clearance, mask, name) -{ - print " Pad[", x1, y1, x2, y2, int(either(thickness, DEFAULT["pad_thickness"])), - int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), - q name q, q number q, q flags q "]" -} - -# draw element pad - no thickness, but exact corner coordinates given -function subc_pad_rectangle(x1, y1, x2, y2, number, flags, clearance, mask, name, th,dx,dy,cx,cy) -{ - if (x2 < x1) { - th = x2 - x2 = x1 - x1 = th - } - if (y2 < y1) { - th = y2 - y2 = y1 - y1 = th - } - - dx = x2-x1 - dy = y2-y1 - - if (dx >= dy) { - th = dy - cy = (y1+y2)/2 - - print " Pad[", x1+th/2, cy, x2-th/2, cy, th, - int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), - q name q, q number q, q flags q "]" - } - else { - th = dx - cx = (x1+x2)/2 - - print " Pad[", cx, y1+th/2, cx, y2-th/2, th, - int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), - q name q, q number q, q flags q "]" - } -} - -# draw element pad circle -function subc_pad_circle(x1, y1, radius, number, clearance, mask, name) -{ - print " Pad[", x1, y1, x1, y1, int(either(radius, DEFAULT["pad_thickness"])), - int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), - q name q, q number q, q "" q "]" -} - -function subc_arrow(layer, x1, y1, x2, y2, asize, thickness ,vx,vy,nx,ny,len,xb,yb) -{ - subc_line(layer, x1, y1, x2,y2, thickness) - - if (asize == 0) - asize = mil(20) - - vx = x2-x1 - vy = y2-y1 - len = sqrt(vx*vx+vy*vy) - if (len != 0) { - vx /= len - vy /= len - nx = vy - ny = -vx - xb = x2 - vx*asize - yb = y2 - vy*asize -# subc_line(layer, x2, y2, xb + 1000, yb + 1000) - subc_line(layer, x2, y2, xb + nx*asize/2, yb + ny*asize/2) - subc_line(layer, x2, y2, xb - nx*asize/2, yb - ny*asize/2) - subc_line(layer, xb - nx*asize/2, yb - ny*asize/2, xb + nx*asize/2, yb + ny*asize/2) - } -} - -# draw a rectangle of silk lines -# omit sides as requested in omit -# if r is non-zero, round corners - omit applies as NW, NW, SW, SE -# if omit includes "arc", corners are "rounded" with lines -function subc_rectangle(layer, x1, y1, x2, y2, omit, r, thickness ,tmp,r1,r2) -{ -# order coords for round corners - if (x1 > x2) { - tmp = x1 - x1 = x2 - x2 = tmp - } - if (y1 > y2) { - tmp = y1 - y1 = y2 - y2 = tmp - } - - if (!(omit ~ "left")) { - r1 = (omit ~ "NW") ? 0 : r - r2 = (omit ~ "SW") ? 0 : r - subc_line(layer, x1, y1+r1, x1, y2-r2, thickness) - } - if (!(omit ~ "top")) { - r1 = (omit ~ "NW") ? 0 : r - r2 = (omit ~ "NE") ? 0 : r - subc_line(layer, x1+r1, y1, x2-r2, y1, thickness) - } - if (!(omit ~ "bottom")) { - r1 = (omit ~ "SE") ? 0 : r - r2 = (omit ~ "SW") ? 0 : r - subc_line(layer, x2-r1, y2, x1+r2, y2, thickness) - } - if (!(omit ~ "right")) { - r1 = (omit ~ "SE") ? 0 : r - r2 = (omit ~ "NE") ? 0 : r - subc_line(layer, x2, y2-r1, x2, y1+r2, thickness) - } - - if (r > 0) { - if (omit ~ "arc") { - if (!(omit ~ "NW")) - subc_line(layer, x1, y1+r, x1+r, y1) - if (!(omit ~ "SW")) - subc_line(layer, x1, y2-r, x1+r, y2) - if (!(omit ~ "NE")) - subc_line(layer, x2, y1+r, x2-r, y1) - if (!(omit ~ "SE")) - subc_line(layer, x2, y2-r, x2-r, y2) - } - else { - if (!(omit ~ "NW")) - subc_arc(layer, x1+r, y1+r, r, 270, 90) - if (!(omit ~ "SW")) - subc_arc(layer, x1+r, y2-r, r, 0, 90) - if (!(omit ~ "NE")) - subc_arc(layer, x2-r, y1+r, r, 180, 90) - if (!(omit ~ "SE")) - subc_arc(layer, x2-r, y2-r, r, 90, 90) - } - } -} - -# draw a rectangle corners of silk lines, wx and wy long in x and y directions -# omit sides as requested in omit: NW, NW, SW, SE -# corners are always sharp -function subc_rectangle_corners(layer, x1, y1, x2, y2, wx, wy, omit, thickness ,tmp) -{ - if (!(omit ~ "NW")) { - subc_line(layer, x1, y1, x1+wx, y1, thickness) - subc_line(layer, x1, y1, x1, y1+wy, thickness) - } - if (!(omit ~ "NE")) { - subc_line(layer, x2-wx, y1, x2, y1, thickness) - subc_line(layer, x2, y1, x2, y1+wy, thickness) - } - if (!(omit ~ "SW")) { - subc_line(layer, x1, y2, x1+wx, y2, thickness) - subc_line(layer, x1, y2-wy, x1, y2, thickness) - } - if (!(omit ~ "SE")) { - subc_line(layer, x2-wx, y2, x2, y2, thickness) - subc_line(layer, x2, y2-wy, x2, y2, thickness) - } -} - -# convert coord given in mils to footprint units -function mil(coord) -{ - if (base_unit_mm) - return coord / 39.3701 - else - return coord -} - -# reverse mil(): converts footprint units back to mil -function rev_mil(coord) -{ - if (base_unit_mm) - return coord * 39.3701 - else - return coord -} - - -# convert coord given in mm to footprint units -function mm(coord) -{ - if (base_unit_mm) - return coord - else - return coord * 39.3701 -} - -# reverse mm(): converts footprint units back to mm -function rev_mm(coord) -{ - if (base_unit_mm) - return coord - else - return coord / 39.3701 -} - - -function set_arg_(OUT, key, value, strength) -{ - if (OUT[key, "strength"] > strength) - return - - OUT[key] = value - OUT[key, "strength"] = strength -} - -# set parameter key=value with optioal strength (s_* consts) in array OUT[] -# set only if current strength is stronger than the original value -# if key starts with a "?", use s_weak -# if key is in DEFAULT[], use DEFAULT[] instead of OUT[] -function set_arg(OUT, key, value ,strength) -{ - if (strength == "") - strength = s_explicit - if (key ~ "^[?]") { - sub("^[?]", "", key) - strength = s_weak - } - - if (key in DEFAULT) { - if (DEFAULT[key, "dim"]) - value = parse_dim_(value, 0) - set_arg_(DEFAULT, key, value, strength) - } - else - set_arg_(OUT, key, value, strength) -} - -# Process a generator argument list from arg_names. Save the result in -# array OUT. If mandatory is specified, check whether all mandatory -# parameters are specified -# Both arg_names and mandatory are comma separated list of argument names -function proc_args(OUT, arg_names, mandatory, N,A,M,v,n,key,val,pos) -{ - gsub(" ", "", arg_names) - gsub(" ", "", mandatory) - split(arg_names, N, ",") - v = split(args, A, ",") - -# fill in all named and positional arguments - pos = 1 - for(n = 1; n <= v; n++) { - A[n] = strip(A[n]) - if (A[n] == "") - continue - if (A[n] ~ "=") { -# named - key=A[n] - val=A[n] - sub("=.*", "", key) - sub("^[^=]*=", "", val) - set_arg(OUT, key, val, s_explicit) - } - else { -# positional - if (N[pos] == "") { - error("too many positional arguments at " A[n]) - } - while((N[pos] in OUT) && (N[pos, "strength"] == s_explicit)) pos++ - set_arg(OUT, N[pos], A[n], s_explicit) - pos++ - } - } - -# check whether all mandatory arguments are specified - v = split(mandatory, M, ",") - for(n = 1; n <= v; n++) { - if (!(M[n] in OUT)) { - error("missing argument " M[n] " (or positional " n ")") - exit 1 - } - } -} - -function parse_dim_(h, fallback_mil) -{ - if (h == "") - return "" - if (h ~ "mm$") { - sub("mm", "", h) - return mm(h) - } - if (h ~ "um$") { - sub("um", "", h) - return mm(h)/1000 - } - if (h ~ "nm$") { - sub("nm", "", h) - return mm(h)/1000000 - } - if (h ~ "cm$") { - sub("cm", "", h) - return mm(h)*10 - } - if (h ~ "m$") { - sub("m", "", h) - return mm(h)*1000 - } - if (h ~ "km$") { - sub("km", "", h) - return mm(h)*1000000 - } - - if (h ~ "in$") { - sub("in", "", h) - return mil(h)*1000 - } - if (h ~ "dmil$") { - sub("dmil", "", h) - return mil(h)/10 - } - if (h ~ "cmil$") { - sub("cmil", "", h) - return mil(h)/100 - } - if (h ~ "mil$") { - sub("mil", "", h) - return mil(h) - } - if (fallback_mil) - return mil(h) - else - return h -} - -# Assume h is a dimension and convert it -function parse_dim(h) -{ - return parse_dim_(h, 1) -} - -# Draw a DIP outline: useful for any rectangular package with a little -# half circle centered on the top line -# arcr: radius of the half circle -# xhalf: optional coordinate where the circle should be put -function dip_outline(layer, x1, y1, x2, y2, arcr ,xhalf) -{ - if (xhalf == "") - xhalf=(x1+x2)/2 - - subc_rectangle(layer, x1, y1, x2, y2, "top") - subc_line(layer, x1, y1, xhalf-arcr, y1) - subc_line(layer, xhalf+arcr, y1, x2, y1) - - subc_arc(layer, xhalf, y1, arcr, 0, 180) -} - -# decide whether x is true or false -# returns 1 if true -# returns 0 if false -function tobool(x) -{ - if (x == int(x)) - return (int(x) != 0) - - x = tolower(x) - return (x == "true") || (x == "yes") || (x == "on") -} - -# default pin1 mark on a box -# style: mark style, ":" separated list -# x,y: the coordinates of the origin corner (top-left) -# half: half the stepping of the pin grid - the size of the mark -# step: optional size of the external arrow or square (defaults to 2*half) -function silkmark(style, x, y, half, step, S,n,v) -{ - if (step == "") - step = half*2 - - v = split(style, S, ":") - - for(n = 1; n <= v; n++) { - if (S[n] == "angled") { - subc_line("top-silk", x+half, y, x, y+half) - } - else if (S[n] == "square") { - subc_line("top-silk", x, y+step, x+2*half, y+step) - subc_line("top-silk", x+step, y, x+2*half, y+step) - } - else if ((S[n] == "external") || (S[n] == "externalx")) { - subc_line("top-silk", x, y+half, x-step+half, y+half/2) - subc_line("top-silk", x, y+half, x-step+half, y+half*1.5) - subc_line("top-silk", x-step+half, y+half/2, x-step+half, y+half*1.5) - } - else if (S[n] == "externaly") { - subc_line("top-silk", x+half, y, x-half/2+half, y-step+half) - subc_line("top-silk", x+half, y, x+half/2+half, y-step+half) - subc_line("top-silk", x-half/2+half, y-step+half, x+half/2+half, y-step+half) - } - else if (S[n] == "external45") { - subc_line("top-silk", x, y, x-half, y-half/3) - subc_line("top-silk", x, y, x-half/3, y-half) - subc_line("top-silk", x-half, y-half/3, x-half/3, y-half) - } - else if (S[n] == "arc") { - subc_arc("top-silk", x, y, step/2, 180, 270) - } - else if (S[n] == "circle") { - subc_arc("top-silk", x, y, step/2, 0, 360) - } - else if (S[n] == "dot") { - subc_arc("top-silk", x-step/2, y-step/2, step/4, 0, 360) - } - else if ((S[n] != "none") && (S[n] != "")) { - error("invalid silkmark parameter: " S[n]) - } - } -} - -# output a dimension specification between x1;y1 and x2;y2, text distance at dist -# for a name,value pair -# if name is empty, only value is printed -# if value is empty, it's calculated -# if only name should be printed, value should be "!" -# if dist starts with a "@", it's the absolute coordinate of the center of the dim line (text base), else it's relative distance from the measured line -function dimension(x1, y1, x2, y2, dist, name, value, vx,vy) -{ - print "#dimension", x1, y1, x2, y2, dist, name, value -} - -function help_extract(SEEN, fn, dirn, OVER, IGN, WANT,tmp,key,val,i,skip) -{ - if (fn in SEEN) - return - SEEN[fn]++ - print "#@@info-gen-extract " fn - close(fn) - while((getline line < fn) > 0) { - if (line ~ "^#@@include") { - sub("^#@@include[ \t]*", "", line) - tmp = dirn "/" line - WANT[tmp]++ - } - else if (line ~ "^#@@over@ignore") { - key = line - sub("^#@@over@ignore:", "", key) - sub(" .*", "", key) - IGN[key] = 1 - } - else if (line ~ "^#@@over@") { - key = line - sub("^#@@over@", "", key) - val = "#@@" key - sub(" .*", "", key) - OVER[key] = val - } - else if (line ~ "^#@@") { - key = line - sub("^#@@", "", key) - sub(" .*", "", key) - skip = 0 - for(i in IGN) { - if (key ~ i) - skip = 1 - } - if (skip) - continue - if (key in OVER) { - print OVER[key] - OVER[key "::PRINTED"] = 1 - } - else - print line - } - } - close(fn) - for(tmp in WANT) - help_extract(SEEN, tmp, dirn, OVER, IGN) -} - -function help_print( SEEN, OVER, dirn, k) -{ - print "#@@info-generator pcblib common_subc.awk" - dirn = genfull - sub("/[^/]*$", "", dirn) - help_extract(SEEN, genfull, dirn, OVER) - for(k in OVER) { - if (!(k ~ "::PRINTED$") && !((k "::PRINTED") in OVER)) - print OVER[k] - } -} - -function help_auto() -{ - if ((args ~ "^--help") || (args ~ ",[ \t]*--help")) { - help_print() - exit(0) - } -} Index: parametric_lht/qfp =================================================================== --- parametric_lht/qfp (revision 27205) +++ parametric_lht/qfp (nonexistent) @@ -1,24 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP - -#@@example qfp(32,7x7,0.8) - -#@@purpose Generate QFP packages -#@@desc Generate QFP packages - a simplified frontend to qf() - -#@@desc look up 3..4 data in the datasheet and get a regular QFP footprint! -#@@desc NOTE: some of the qf() parameters can be also used. -#@@desc Should work for QFP, TQFP, LQFP, etc. - -#@@params pins,size,pitch,cpad_size - -#@@param:pins total number of pins (leads); must be divisible by 4 -#@@param:size a single integer N or NxN or NxNxH; body dimension (width or height of the plastic body) in mm -#@@param:pitch lead pitch (distance between the centerline of two adjacent leads), in mm; must be one of 0.4, 0.5, 0.65 - -#@@param:cpad_size width (and height) of the central pad, in mm -#@@optional:cpad_size -#@@default:cpad_size empty, there's no central pad - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/qfp.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/qfp ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/qf.awk =================================================================== --- parametric_lht/qf.awk (revision 27205) +++ parametric_lht/qf.awk (nonexistent) @@ -1,192 +0,0 @@ -function qf_globals(pre_args, post_args ,reqs) -{ - DEFAULT["cpad_mask", "dim"] = 1 - - if (hook_spc_conv == "") - hook_spc_conv = 1.8 - if (hook_cpad_mult == "") - hook_cpad_mult = 1 - - if (!qf_no_defaults) { - set_arg(P, "?pad_spacing", "0.5mm") - set_arg(P, "?ext_bloat", "0.37mm") - set_arg(P, "?int_bloat", "0.37mm") - set_arg(P, "?pad_thickness", "0.3mm") - set_arg(P, "?silkmark", "dot") - set_arg(P, "?line_thickness", "0.1mm") - set_arg(P, "?cpm_width", "1mm") - set_arg(P, "?cpm_height", "1mm") - set_arg(P, "?cpm_nx", "2") - set_arg(P, "?cpm_ny", "2") - } - - reqs = "nx,ny" - - if (pre_args != "") - reqs="" - - if ((post_args != "") && (!(post_args ~ "^,"))) - post_args = "," post_args - - if ((pre_args != "") && (!(pre_args ~ ",$"))) - pre_args = pre_args "," - - proc_args(P, pre_args "nx,ny,x_spacing,y_spacing,pad_spacing,ext_bloat,int_bloat,width,height,cpad_width,cpad_height,cpad_auto,cpm_nx,cpm_ny,cpm_width,cpm_height,cpad_mask,rpad_round,bodysilk,pinoffs,silkmark" post_args, reqs) - - nx = int(P["nx"]) - ny = int(P["ny"]) - - if (P["ny"] == "") - ny = nx - - if ((nx < 2) || (ny < 2)) - error("Number of pins have to be more than 2 in both directions") - - x_spacing=parse_dim(P["x_spacing"]) - y_spacing=parse_dim(P["y_spacing"]) - pad_spacing=parse_dim(P["pad_spacing"]) - pt = DEFAULT["pad_thickness"] - ext_bloat=parse_dim(P["ext_bloat"]) - pt/2 - int_bloat=parse_dim(P["int_bloat"]) - pt/2 - width=parse_dim(P["width"]) - height=parse_dim(P["height"]) - pinoffs = int(P["pinoffs"]) - - if (x_spacing == "") - x_spacing = (nx+hook_spc_conv) * pad_spacing - if (y_spacing == "") - y_spacing = (ny+hook_spc_conv) * pad_spacing - - cpad_width=parse_dim(P["cpad_width"]) - cpad_height=parse_dim(P["cpad_height"]) - - if (P["cpad_mask"] != "") - cpad_mask=parse_dim(P["cpad_mask"]) - - - if (tobool(P["cpad_auto"]) || hook_cpad_auto) { - if (cpad_width == "") - cpad_width = (x_spacing*0.85 - int_bloat*2 - pt) * hook_cpad_mult - if (cpad_height == "") - cpad_height = (y_spacing*0.85 - int_bloat*2 - pt) * hook_cpad_mult - } - - - if (width == "") - width = x_spacing - if (height == "") - height = y_spacing - - pinmax=(nx+ny)*2 - - if (!tobool(P["rpad_round"])) - rpad_round = "square" - else - rpad_round = "" - - - cpm_width = parse_dim(P["cpm_width"]) - cpm_height = parse_dim(P["cpm_height"]) - cpm_nx = int(P["cpm_nx"]) - cpm_ny = int(P["cpm_ny"]) -} - -function pinnum(num) -{ - return ((num-1) + pinoffs) % (pinmax)+1 -} - -# draw a matrix of paste rectangles; top-left corner is x1;y1, there are nx*ny -# rectangles of w*h size. rows/cols of pads are drawn with ox and oy offset -function paste_matrix(x1, y1, nx, ny, w, h, ox, oy, flags, attrbiutes, clearance, ix,iy) -{ - for(iy = 0; iy < ny; iy++) - for(ix = 0; ix < nx; ix++) - subc_rect("top-paste", x1+ix*ox, y1+iy*oy, x1+ix*ox+w, y1+iy*oy+h, clearance, flags, attributes) -} - - -BEGIN { - base_unit_mm = 0 - - help_auto() - qf_globals() - - subc_begin("", "U1", -width/2 - mm(1), -height/2 - mm(2), 0) - - cx = (nx+1)/2 - cy = (ny+1)/2 - if (rpad_round == "square") - proto = subc_proto_create_pad_sqline(-ext_bloat, int_bloat, pad_width) - else - proto = subc_proto_create_pad_line(-ext_bloat, int_bloat, pad_width) - - for(n = 1; n <= ny; n++) { - y = (-cy + n) * pad_spacing - x1 = -x_spacing/2 - x2 = x_spacing/2 - subc_pstk(proto, x1, y, 0, pinnum(n)) - subc_pstk(proto, x2, y, 180, pinnum(nx+2*ny-n+1)) - if (n == 1) - y1 = y - if (n == 2) - dimension(x1, y1, x1, y, (ext_bloat * -3), "pad_spacing") - } - - dimension(x1, y-pt/2, x1, y+pt/2, (ext_bloat * -3), "pad_thickness") - - for(n = 1; n <= nx; n++) { - x = (-cx + n) * pad_spacing - y1 = -y_spacing/2 - y2 = y_spacing/2 - subc_pstk(proto, x, y1, 270, pinnum(nx*2+ny*2-n+1)) - subc_pstk(proto, x, y2, 90, pinnum(n+ny)) - } - - - if ((cpad_width != "") && (cpad_height != "")) { - cpadid = 2*nx+2*ny+1 -# center pad paste matrix - if ((cpm_nx > 0) && (cpm_ny > 0)) { - ox = (cpad_width - (cpm_nx*cpm_width)) / (cpm_nx - 1) - oy = (cpad_height - (cpm_ny*cpm_height)) / (cpm_ny - 1) - paste_matrix(-cpad_width/2, -cpad_height/2, cpm_nx,cpm_ny, cpm_width,cpm_height, - ox+cpm_width,oy+cpm_height, "", "termid=" cpadid ";", 0) - } - -# center pad - cpad_proto = subc_proto_create_pad_rect(cpad_width, cpad_height, cpad_mask, "none") - subc_pstk(cpad_proto, 0, 0, 0, cpadid) - dimension(-cpad_width/2, -cpad_height/2, +cpad_width/2, -cpad_height/2, "@0;" (height * -0.6-ext_bloat), "cpad_width") - dimension(cpad_width/2, -cpad_height/2, cpad_width/2, +cpad_height/2, "@" (width * 0.8+ext_bloat) ";0", "cpad_height") - } - - wx = (width - nx * pad_spacing) / 3.5 - wy = (height - ny * pad_spacing) / 3.5 - - bodysilk = P["bodysilk"] - if ((bodysilk == "corners") || (bodysilk == "")) { - subc_rectangle_corners("top-silk", -width/2, -height/2, width/2, height/2, wx, wy) - silkmark(P["silkmark"], -width/2 - wx/2, -height/2+wy*1.5, (wx+wy)/4) - } - else if (bodysilk == "full") { - subc_rectangle("top-silk", -width/2, -height/2, width/2, height/2) - silkmark(P["silkmark"], -width/2 + wx*3, -height/2+wy*3, (wx+wy)/2) - } - else if (bodysilk == "plcc") { - r = (width+height)/10 - subc_rectangle("top-silk", -width/2, -height/2, width/2, height/2, "arc,NE,SW,SE", r) - subc_line("top-silk", -width/2, -height/2+r, width/2, -height/2+r) - silkmark(P["silkmark"], 0, -height*0.2, height/40) - } - else if (bodysilk != "none") - error("invalid bodysilk parameter") - - dimension(-width/2, -height/2, +width/2, -height/2, "@0;" height*-0.8-ext_bloat, "width") - dimension(+width/2, -height/2, +width/2, +height/2, "@" (width * 1+ext_bloat) ";0", "height") - - dimension(-x_spacing/2, -height/2, +x_spacing/2, -height/2, "@0;" height*-1-ext_bloat, "x_spacing") - dimension(+width/2, -y_spacing/2, +width/2, +y_spacing/2, "@" (width * 1.2+ext_bloat) ";0", "y_spacing") - - subc_end() -} Index: parametric_lht/bga =================================================================== --- parametric_lht/bga (revision 27205) +++ parametric_lht/bga (nonexistent) @@ -1,74 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP - -#@@example bga(map=a1:a2:a3:#:b1:!:b3:#:c1:c2:!) - -#@@purpose Generate ball grid array - -#@@desc Generate a grid of circular pads for BGA chips - -#@@params nx,ny,spacing,balldia,silkmark,map,width,height,automap,automap2 - -#@@param:nx number of pins in the X direction -#@@optional:nx -#@@default:nx deduced from the map - -#@@param:ny number of pins in the Y direction -#@@optional:ny -#@@default:ny deduced from the map - -#@@param:spacing spacing between the pins -#@@dim:spacing -#@@default:spacing 0.5 mm - -#@@param:balldia diameter of a ball -#@@dim:balldia -#@@default:spacing 0.35 mm - -#@@include silkmark.help -#@@optional:silkmark -#@@default:silkmark square -#@@preview_args:silkmark 3,3 - -#@@param:map pin name map; a colon separated list of names, from left to right, rows first. If a name is empty or is a hash mark, a new row is started. If a name is a !, the given pin is missing and no pad is generated. -#@@optional:map - -#@@param:width width of the box (silk rectangle x size) -#@@dim:width -#@@optional:width -#@@default:width two columns wider than the array - -#@@param:height height of the box (silk rectangle y size) -#@@dim:height -#@@optional:height -#@@default:height two columns higher than the array - - -#@@param:automap assume a regular nx*ny array, automap (autonumber) the pins -#@@optional:automap -#@@enum:automap:none do not autonumber pins -#@@enum:automap:alnum number y rows from A..Z (then AA..AZ) from top to bottom, number x rows from 0..nx left to right -#@@default:none -#@@preview_args:automap 3,3 -#@@thumbsize:automap 3 -#@@thumbnum:automap 1 - -#@@param:automap2 change how automap behaves - multiple values separated by colon are accepted (e.g. automap2=pivot,reversex) -#@@enum:automap2:pivot swap x and y -#@@enum:automap2:reversex number x from right to left -#@@enum:automap2:reversey number y from bottom up -#@@preview_args:automap2 3,3,automap=alnum -#@@thumbsize:automap2 3 -#@@thumbnum:automap2 1 - -#@@param:alphabet the alphabet automap may use for rows; use A..Z if unspecified, else use the letters in this alphabet (in order). List letters without separator, e.g. ABCDEF -#@@preview_args:automap2 3,3,automap=alnum,alphabet=QDT -#@@thumbsize:automap2 3 -#@@thumbnum:automap2 1 - - -#@@include common_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/bga.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/bga ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/connector =================================================================== --- parametric_lht/connector (revision 27205) +++ parametric_lht/connector (nonexistent) @@ -1,53 +0,0 @@ -#!/bin/sh - -#@@example connector(2, 3, silkmark=external, spacing=100) - -#@@purpose Generate pin-array connectors (e.g. headers). - -#@@desc Generate thru-hole connectors that consits of an array of -#@@desc evenly spaced pins, a plain frame and some optional pin marks -#@@desc on the silk layer. - -#@@params nx, ny, spacing, silkmark, eshift, etrunc - -#@@param:nx number of pins in the X direction -#@@param:ny number of pins in the Y direction -#@@param:spacing spacing between the pins -#@@dim:spacing -#@@default:spacing 100 mil - -#@@include silkmark.help -#@@optional:silkmark -#@@default:silkmark square -#@@preview_args:silkmark 2,3 - -#@@param:eshift shift even rows or columns by half spacing (optional; default: don't shift) -#@@enum:eshift:x shift columns -#@@enum:eshift:y shift rows -#@@enum:eshift:none do not shift anything -#@@default:eshift none -#@@optional:eshift -#@@preview_args:eshift 2,3 - -#@@param:etrunc truncate the last pin of a shifted row or column -#@@bool:etrunc -#@@default:etrunc false -#@@optional:etrunc -#@@preview_args:etrunc 2,3,eshift=x - -#@@param:sequence pin numbering sequence -#@@enum:sequence:normal increase by y first, then by x -#@@enum:sequence:pivot increase by x first, then by y -#@@enum:sequence:zigzag "dip-style" numbering in zig-zag: number odd x rows by y ascending, even x rows by y descending -#@@preview_args:sequence 2,4 -#@@thumbsize:sequence 3 -#@@thumbnum:sequence 1 -#@@default:sequence normal -#@@optional:sequence - - - -#@@include common_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/connector.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/connector ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/acy.awk =================================================================== --- parametric_lht/acy.awk (revision 27205) +++ parametric_lht/acy.awk (nonexistent) @@ -1,158 +0,0 @@ -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", -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) - - subc_rectangle("top-silk", sx1, y1, sx1+cl1, -y1, "right,NE,SE", rarc) - subc_rectangle("top-silk", 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 - subc_arrow("top-silk", -2*x/4, dia*2, +2*x/4, -dia*2-mil(30)) - } - else if (P["wiper"] == "parrow") { - subc_arrow("top-silk", 0, -dia*2-mil(30), 0, -dia) - } - else if (P["wiper"] == "looparrow") { - y = -dia*2-mil(30) - x = sx2+len/8 - subc_arrow("top-silk", 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) - - oy = size*2.2-offs_y - ox = DEFAULT["pin_ringdia"]/2+size*1.1-offs_x - subc_line("top-silk", ox-size, oy, ox+size, oy) - - ox = spacing - (DEFAULT["pin_ringdia"]/2+size*1.1)-offs_x - subc_line("top-silk", ox-size, oy, ox+size, oy) - subc_line("top-silk", ox, oy-size, ox, oy+size) - } - else if (P["pol"] == "bar") { - offs=DEFAULT["line_thickness"] - subc_rectangle("top-silk", -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/rcy =================================================================== --- parametric_lht/rcy (revision 27205) +++ parametric_lht/rcy (nonexistent) @@ -1,32 +0,0 @@ -#!/bin/sh - -#@@example rcy(300,bar+) - -#@@purpose Generate radial lead through-hole component - -#@@desc Generate radial lead through-hole component with 2 pins (typical use: electrolytic caps) -#@@params spacing,pol,dia - -#@@param:spacing spacing between the two pins -#@@dim:spacing - -#@@param:pol how to mark polarity: (optional; default: sign) -#@@enum:pol:none no marking -#@@enum:pol:sign print + next to pin 1 and - next to pin 2 -#@@enum:pol:bar+ draw a bar inside the circle, around pin 2 -#@@enum:pol:bar- draw a bar inside the circle, around pin 1 -#@@enum:pol:bar same as bar+ -#@@enum:pol:bar+sign bar+ and sign combined -#@@enum:pol:bar-sign bar- and sign combined -#@@optional:pol -#@@default:pol sign -#@@preview_args:pol 300 - -#@@param:dia body diameter - affects the silk circle -#@@optional:dia -#@@default:dia spacing*2 - -#@@include common_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/rcy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/rcy ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/dip.awk =================================================================== --- parametric_lht/dip.awk (revision 27205) +++ parametric_lht/dip.awk (nonexistent) @@ -1,32 +0,0 @@ -BEGIN { - base_unit_mm = 0 - - help_auto() - set_arg(P, "?spacing", 300) - - proc_args(P, "n,spacing", "n") - - P["n"] = int(P["n"]) - if ((P["n"] < 2) || ((P["n"] % 2) != 0)) - error("Number of pins have to be an even positive number") - - spacing=parse_dim(P["spacing"]) - - subc_begin(P["n"] "*" P["spacing"], "U1_lht", 0, mil(-100)) - - half = mil(50) - - pstk_s = subc_proto_create_pin_square() - pstk_r = subc_proto_create_pin_round() - - for(n = 1; n <= P["n"]/2; n++) { - subc_pstk((n == 1 ? pstk_s : pstk_r), 0, (n-1) * mil(100), 0, n) - subc_pstk(pstk_r, spacing, (n-1) * mil(100), 0, P["n"] - n + 1) - } - - dip_outline("top-silk", -half, -half, spacing + half , (n-2) * mil(100) + half, half) - - dimension(0, 0, spacing, 0, mil(100), "spacing") - - subc_end() -} Index: parametric_lht/plcc.awk =================================================================== --- parametric_lht/plcc.awk (revision 27205) +++ parametric_lht/plcc.awk (nonexistent) @@ -1,60 +0,0 @@ -function parri(A ,s,i) -{ - for(i in A) - s = s " " i - return s -} - -BEGIN { - base_unit_mm = 0 - - help_auto() - PT["50"] = "26mil" - set_arg(P, "?pitch", "50") - - proc_args(P, "pins,size,pitch,cpad_size,pad_thickness", "pins") - - pitch = P["pitch"] - sub("[.]0*$", "", pitch) - - if (!(args ~ "pad_thickness=")) { - if (!(pitch in PT)) - error("Unknown pitch (" pitch "), should be one of:" parri(PT)) - pt = PT[pitch] - } - else - pt = rev_mil(DEFAULT["pad_thickness"]) - - if (P["size"] == "") - P["size"] = int(P["pins"] * (pitch/4) + 140) - - split(P["size"], S, "x") - if (S[2] == "") - S[2] = S[1] - if (S[1] != S[2]) - error("need n*n size") - - pins = int(P["pins"]) - if (pins / 4 != int(pins / 4)) - error("number of pins must be divisible by 4") - - pins=pins/4 - - if ((pins % 2) != 1) - error("number of pins per side must be odd") - - S[1] -= 60 - S[2] -= 60 - args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mil,y_spacing=" S[2] "mil,pad_spacing=" pitch "mil,pad_thickness=" pt - - args = args ",width=" S[1]-150 " mil,height=" S[2]-150 " mil" - - - if (P["cpad_size"] != "") - args = args ",cpad_width=" P["cpad_size"] "mil,cpad_height=" P["cpad_size"] "mil" - - args = args ",int_bloat=47mil,ext_bloat=47mil" - args = args ",?bodysilk=plcc,?silkmark=circle,pinoffs=" int(pins/2+0.5) - - -} Index: parametric_lht/so.awk =================================================================== --- parametric_lht/so.awk (revision 27205) +++ parametric_lht/so.awk (nonexistent) @@ -1,55 +0,0 @@ -BEGIN { - base_unit_mm = 0 - - help_auto() - set_arg(P, "?row_spacing", 250) - set_arg(P, "?pad_spacing", 50) - set_arg(P, "?ext_bloat", 10) - set_arg(P, "?int_bloat", 55) - - proc_args(P, "n,row_spacing,pad_spacing,ext_bloat,int_bloat", "n") - - P["n"] = int(P["n"]) - if ((P["n"] < 2) || ((P["n"] % 2) != 0)) - error("Number of pins have to be an even positive number") - - row_spacing=parse_dim(P["row_spacing"]) - pad_spacing=parse_dim(P["pad_spacing"]) - ext_bloat=parse_dim(P["ext_bloat"]) - int_bloat=parse_dim(P["int_bloat"]) - -# translate origin to the middle (int() and -0.5 rounds it for odd number of pins) - offs_x = -(row_spacing/2) - offs_y = -int((P["n"]/4-0.5) * pad_spacing) - - subc_begin(P["n"] "*" P["row_spacing"], "U1", -offs_x, mil(-100)-offs_y) - - proto = subc_proto_create_pad_sqline(-ext_bloat, int_bloat, pad_width) - - for(n = 1; n <= P["n"]/2; n++) { - y = (n-1) * pad_spacing - subc_pstk(proto, 0, y, 0, n) - subc_pstk(proto, row_spacing, y, 180, P["n"] - n + 1) - } - - silk_dist_x = either(parse_dim(P["silk_ext_x"]), pad_spacing/2) - silk_dist_y = either(parse_dim(P["silk_ext_y"]), pad_spacing/2) - rarc = either(parse_dim(P["rarc"]), pad_spacing/2) - - dip_outline("top-silk", -silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat , (n-2) * pad_spacing + silk_dist_y, rarc) - - left_dim="@" -silk_dist_x-ext_bloat-pad_spacing ";0" - dimension(0, 0, 0, pad_spacing, left_dim, "pad_spacing") - dimension(0, 0, row_spacing, 0, (pad_spacing * 1.8), "row_spacing") - dimension(-ext_bloat, 0, 0, 0, (pad_spacing * 1.2), "ext_bloat") - dimension(row_spacing-int_bloat, 0, row_spacing, 0, (pad_spacing * 1.2), "int_bloat") - - th=DEFAULT["pad_thickness"] - y = (n-2) * pad_spacing - dimension(-ext_bloat-th/2, y, +int_bloat+th/2, y, (pad_spacing * -1.2), "") - dimension(0, y-th/2, 0, y+th/2, left_dim, "pad_thickness") - -# dimension(-silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat, -silk_dist_y, pad_spacing*2.5, "") - - subc_end() -} Index: parametric_lht/alf =================================================================== --- parametric_lht/alf (revision 27205) +++ parametric_lht/alf (nonexistent) @@ -1,37 +0,0 @@ -#!/bin/sh - -#@@example alf(300, schottky) - -#@@purpose Generate ALF: axial lead through-hole component for diodes - -#@@desc Generate axial lead through-hole component with 2 pin diodes -#@@params spacing,type,dia -#@@thumbsize 2 - -#@@param:spacing spacing between the two pins -#@@dim:spacing - -#@@param:type symbol type -#@@enum:type:normal -#@@enum:type:schottky -#@@enum:type:zener -#@@enum:type:tunnel -#@@enum:type:varactor -#@@optional:type -#@@default:type normal -#@@preview_args:type 300 - -#@@param:dia body diameter - affects silk symbol size -#@@dim:dia -#@@optional:dia -#@@default:dia spacing/12 - -#@@param:aspect silk symbol aspect: total width expressed as a portion of spacing -#@@optional:aspect -#@@default:aspect spacing/6 - - -#@@include common_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/alf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/alf ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/screw.awk =================================================================== --- parametric_lht/screw.awk (revision 27205) +++ parametric_lht/screw.awk (nonexistent) @@ -1,131 +0,0 @@ -function shp(r, edges, tx ,a,x,y,xl,yl,step,x1,y1,x2,y2,tx1,tx2,txs) -{ - step = 2*3.141592654/edges - if (tx == 1) { - tx1 = 0.7 - tx2 = 0.6 - txs = 5 - } - else if (tx == 2) { - tx1 = 0.85 - tx2 = 0.8 - txs = 5 - } - else if (tx == 3) { - tx1 = 0.2 - tx2 = 0.2 - txs = 3 - } - for(n = 0; n <= edges; n++) { - a += step - x = cos(a)*r - y = sin(a)*r - if (xl != "") { - if (tx) { - x1 = cos(a-(txs-1)*step/txs)*r*tx1 - y1 = sin(a-(txs-1)*step/txs)*r*tx1 - x2 = cos(a-step/txs)*r*tx1 - y2 = sin(a-step/txs)*r*tx1 - x3 = cos(a-step/2)*r*tx2 - y3 = sin(a-step/2)*r*tx2 - subc_line("top-silk", xl, yl, x1, y1) - subc_line("top-silk", x, y, x2, y2) - subc_line("top-silk", x3, y3, x1, y1) - subc_line("top-silk", x3, y3, x2, y2) - } - else - subc_line("top-silk", xl, yl, x, y) - } - xl = x - yl = y - } -} - -function round_up(num, to) -{ - if ((num/to) == int(num/to)) - return num - return int(num/to+1)*to -} - -BEGIN { - help_auto() - set_arg(P, "?shape", "circle") - proc_args(P, "hole,head,shape,ring", "hole") - - subc_begin("screw:" P["hole"] "," P["head"]"," P["shape"], "S1", 0, -mil(100), 0) - - if (P["hole"] ~ "^M") { - hole = P["hole"] - sub("^M", "", hole) - h = parse_dim(int(hole) "mm") - if ((hole ~ "tight") || (hole ~ "close.fit")) - hole = h * 1.05 - else - hole = h * 1.1 - hd = parse_dim(P["head"]) - if ((hd == 0) || (hd == "")) { - hd = P["head"] - if (hd == "button") - head = 1.9*h - else if (hd == "button") - head = 1.9*h - else if (hd == "cheese") - head = round_up(1.7*h, mm(0.5)) - else if (hd ~ "flat.washer") - head = round_up(2.1*h, mm(1)) - else if ((hd == "") || (hd == "pan") || (hd ~ "int.*.lock.washer")) - head = 2*h - else - error("Unknown standard head: " hd) - } - else - head = hd -# print hole, head > "/dev/stderr" - } - else { - hole = parse_dim(P["hole"]) - head = parse_dim(P["head"]) - } - - if (head == "") - error("need a standard screw name, e.g. M3, or a head diameter") - - if (head < hole) - error("head diameter must be larger than hole diameter") - - ring = parse_dim(P["ring"]) - - if (ring == "") - ring = head*0.8 - - - proto = subc_proto_create_pin_round(hole, ring) - subc_pstk(proto, 0, 0, 0, 1) - - - shape = ":" P["shape"] ":" - - if (shape ~ ":circle:") - subc_arc("top-silk", 0, 0, head/2, 0, 360) - - if (shape ~ ":hex:") - shp(head/2, 6, 0) - - if (shape ~ ":tx:") - shp(head/2, 6, 1) - - if (shape ~ ":xzn:") - shp(head/2, 12, 2) - - if (shape ~ ":ph:") - shp(head*0.4, 4, 3) - - if (shape ~ ":slot:") - subc_line("top-silk", -head/2, 0, head/2, 0) - - dimension(-head/2, 0, head/2, 0, head*0.7, "head") - dimension(-hole/2, 0, hole/2, 0, head*0.6, "hole") - - subc_end() -} Index: parametric_lht/qfn.awk =================================================================== --- parametric_lht/qfn.awk (revision 27205) +++ parametric_lht/qfn.awk (nonexistent) @@ -1,47 +0,0 @@ -function parri(A ,s,i) -{ - for(i in A) - s = s " " i - return s -} - -BEGIN { - help_auto() - PT["0.65"] = "0.35mm" - PT["0.5"] = "0.3mm" - PT["0.4"] = "0.2mm" - - proc_args(P, "pins,size,pitch,cpad_size,pad_thickness", "pins,size,pitch") - - pitch = P["pitch"] - sub("0*$", "", pitch) - - if (!(args ~ "pad_thickness=")) { - if (!(pitch in PT)) - error("Unknown pitch, should be one of:" parri(PT)) - pt = PT[pitch] - } - else - pt = rev_mm(DEFAULT["pad_thickness"]) "mm" - - split(P["size"], S, "x") - if (S[2] == "") - S[2] = S[1] - if (S[1] != S[2]) - error("need n*n size") - - pins = int(P["pins"]) - if (pins / 4 != int(pins / 4)) - error("number of pins must be divisible by 4") - - pins=pins/4 - - - args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mm,y_spacing=" S[2] "mm,pad_spacing=" pitch "mm,pad_thickness=" pt - - if (P["cpad_size"] != "") - args = args ",cpad_width=" P["cpad_size"] "mm,cpad_height=" P["cpad_size"] "mm" - -# qf_globals("pins,size") - -} Index: parametric_lht/qf =================================================================== --- parametric_lht/qf (revision 27205) +++ parametric_lht/qf (nonexistent) @@ -1,114 +0,0 @@ -#!/bin/sh - -#@@example qf(nx=4,ny=4,cpad_auto=1) - -#@@purpose Generate generic *qf* (e.g. tqfp, qfn) packages - -#@@desc Generate *qf* (e.g. tqfp, qfn) packages: smd pads around a square; this is the generic implementation, end users may want to use the specific ones, e.g. tqfp(), qfn(), etc. -#@@params nx,ny,x_spacing,y_spacing,pad_spacing,ext_bloat,int_bloat,width,height,cpad_width,cpad_height,cpad_auto,bodysilk,pinoffs,silkmark - -#@@param:nx number of pins along the horizontal sides - -#@@param:ny number of pins along the vertical sides -#@@optional:ny -#@@default:ny assume ny=nx - -#@@param:x_spacing spacing between the two vertical rows of pins -#@@dim:x_spacing -#@@optional:x_spacing -#@@default:x_spacing calculated using nx and pad_spacing - -#@@param:y_spacing spacing between the two vertical rows of pins -#@@dim:y_spacing -#@@optional:y_spacing -#@@default:y_spacing calculated using ny and pad_spacing - -#@@param:pad_spacing spacing between the centerlines of two adjacent pads (aka pitch) -#@@dim:pad_spacing -#@@optional:pad_spacing - -#@@param:ext_bloat how much longer the pad should extend outwards from the end-point of the pin -#@@dim:ext_bloat -#@@optional:ext_bloat -#@@default:ext_bloat 0.37 mm - -#@@param:int_bloat how much longer the pad should extend inwards from the end-point of the pin -#@@dim:int_bloat -#@@optional:int_bloat -#@@default:int_bloat 0.37 mm - -#@@param:width width (horizontal, x axis size) of the box drawn on silk -#@@dim:width -#@@optional:width -#@@default:width calculated from the pad row geometry - -#@@param:height height (vertical, y axis size) of the box drawn on silk -#@@dim:height -#@@optional:height -#@@default:height calculated from the pad row geometry - -#@@param:cpad_width width (horizontal, x axis size) of the central pad -#@@dim:cpad_width -#@@optional:cpad_width -#@@default:cpad_width empty, no central pad - -#@@param:cpad_height height (vertical, y axis size) of the central pad -#@@dim:cpad_height -#@@optional:cpad_height -#@@default:cpad_height empty, no central pad - -#@@param:cpad_auto when true, calculate central pad sizes automatically from the pad row geometry -#@@bool:cpad_auto -#@@optional:cpad_height -#@@default:cpad_height false, no central pad - -#@@param:cpm_nx central pad paste matrix, number of paste pads in x direction -#@@optional:cpm_nx -#@@default:cpm_nx 2 - -#@@param:cpm_ny central pad paste matrix, number of paste pads in y direction -#@@optional:cpm_ny -#@@default:cpm_ny 2 - -#@@param:cpm_width central pad paste matrix, paste pad width (dimension of each paste rectangle) -#@@dim:cpm_width -#@@optional:cpm_width -#@@default:cpm_width 1mm - -#@@param:cpm_height central pad paste matrix, paste pad height (dimension of each paste rectangle) -#@@dim:cpm_height -#@@optional:cpm_height -#@@default:cpm_height 1mm - -#@@param:cpad_mask center pad mask; if not specified, use the same gap as for the rows (pad_mask) -#@@dim:cpad_mask -#@@optional:cpad_mask - -#@@param:rpad_round when true, row pads are round -#@@bool:rpad_round -#@@optional:rpad_round -#@@default:rpad_round false, row pads are square - -#@@param:bodysilk how to draw body on the silk layer -#@@enum:bodysilk:none no drawing -#@@enum:bodysilk:corners draw the corners, silkmark is outside of the top-left corner -#@@enum:bodysilk:full draw a full rectanlge, silkmark of the top-left corner -#@@enum:bodysilk:plcc angled top-left corner, horizontal line on the top -#@@optional:bodysilk -#@@default:bodysilk corners - -#@@param:pinoffs rotate pins by this amount, CW -#@@optional:pinoffs -#@@default:pinoffs 0 - -#@@include silkmark.help -#@@optional:silkmark -#@@default:silkmark square -#@@preview_args:silkmark 4,4 - -#@@default:silkmark dot -#@@include common_subc.awk - - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/qf ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/qfp.awk =================================================================== --- parametric_lht/qfp.awk (revision 27205) +++ parametric_lht/qfp.awk (nonexistent) @@ -1,52 +0,0 @@ -function parri(A ,s,i) -{ - for(i in A) - s = s " " i - return s -} - -BEGIN { - help_auto() - PT["0.8"] = "0.55mm" - PT["0.65"] = "0.35mm" - PT["0.5"] = "0.3mm" - PT["0.4"] = "0.2mm" - - proc_args(P, "pins,size,pitch,cpad_size,pad_thickness", "pins,size,pitch") - - pitch = P["pitch"] - sub("0*$", "", pitch) - - if (!(args ~ "pad_thickness=")) { - if (!(pitch in PT)) - error("Unknown pitch, should be one of:" parri(PT)) - pt = PT[pitch] - } - else - pt = rev_mm(DEFAULT["pad_thickness"]) "mm" - - split(P["size"], S, "x") - if (S[2] == "") - S[2] = S[1] - if (S[1] != S[2]) - error("need n*n size") - - pins = int(P["pins"]) - if (pins / 4 != int(pins / 4)) - error("number of pins must be divisible by 4") - - pins=pins/4 - - args = args ",width=" S[1] " mm,height=" S[2] " mm" - - S[1] += 1.45 - S[2] += 1.45 - args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mm,y_spacing=" S[2] "mm,pad_spacing=" pitch "mm,pad_thickness=" pt "mm" - - - if (P["cpad_size"] != "") - args = args ",cpad_width=" P["cpad_size"] "mm,cpad_height=" P["cpad_size"] "mm" - - args = args ",int_bloat=0.5mm,ext_bloat=1.1mm" - args = args ",?bodysilk=full,?silkmark=circle" -} Index: parametric_lht/tssop =================================================================== --- parametric_lht/tssop (revision 27205) +++ parametric_lht/tssop (nonexistent) @@ -1,33 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), MSOP - -#@@example tssop(8) - -#@@purpose Generate TSSOP packages. - -#@@desc Generate TSSOP 4.4mm body packages with variable number of pins and -#@@desc row spacing - -#@@include so -#@@include common_subc.awk - -#@@over@default:pad_spacing 0.65 mm -#@@over@default:row_spacing 6.4 mm -#@@over@default:int_bloat 0.6 mm -#@@over@default:ext_bloat 0.4 mm -#@@over@default:pad_thickness 0.45 mm - -defaults=' -?pad_spacing=0.65mm, -?row_spacing=6.4mm, -?int_bloat=0.6mm, -?ext_bloat=0.4mm, -?rarc=25, -?silk_ext_x=18, -?silk_ext_y=22, -?pad_thickness=0.45mm -' - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/tssop ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/bga.awk =================================================================== --- parametric_lht/bga.awk (revision 27205) +++ parametric_lht/bga.awk (nonexistent) @@ -1,125 +0,0 @@ -function pinalpha(p, s) -{ - if (p >= alphabet_len) - s = pinalpha(int(p/alphabet_len)-1) - return s sprintf("%s", substr(alphabet, (p % alphabet_len)+1, 1)) -} - -function automap(algo, pivot, revx, revy ,xx,yy) -{ - if (algo == 1) { - for(y = 0; y < ny; y++) { - if (revy) - yy = ny - y - 1 - else - yy = y - for(x = 0; x < nx; x++) { - if (revx) - xx = nx - x - 1 - else - xx = x - if (pivot) - MAP[x,y] = pinalpha(xx) yy+1 - else - MAP[x,y] = pinalpha(yy) xx+1 - } - } - } -} - -BEGIN { - help_auto() - set_arg(P, "?spacing", "0.5mm") - set_arg(P, "?balldia", "0.35mm") - set_arg(P, "?silkmark", "arc") - - proc_args(P, "nx,ny,spacing,balldia,silkmark,map,width,height,automap,automap2,alphabet", "") - - step = parse_dim(P["spacing"]) - - half=step/2 - - nx = int(P["nx"]) - ny = int(P["ny"]) - - alphabet = P["alphabet"] - if (alphabet == "") - alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - alphabet_len = length(alphabet) - - if (P["map"] != "") { - v = split(P["map"], A, ":") - x = 0 - y = 0 - for(n = 1; n <= v; n++) { - if ((A[n] == "") || (A[n] == "#")) { - x = 0 - y++ - continue; - } - if (x > nx) - nx = x - if (y > ny) - ny = y - print x,y,A[n] > "/dev/stderr" - MAP[x, y] = A[n] - x++ - } - ny++; - nx++; - } - else { - if ((nx == "") || (ny == "")) - error("missing argument: need nx,ny or a map") - if (P["automap"] ~ "alnum") - automap(1, (P["automap2"] ~ "pivot"), (P["automap2"] ~ "reversex"), (P["automap2"] ~ "reversey")) - else if ((P["automap"] ~ "none") || (P["automap"] == "")) { - } - else - error("automap should be alnum or none") - } - - balldia = parse_dim(P["balldia"]) - bw = parse_dim(P["width"]) - bh = parse_dim(P["height"]) - - if (bw == "") - bw = (nx+1)*step - if (bh == "") - bh = (ny+1)*step - - xo = (nx-1)*step/2 - yo = (ny-1)*step/2 - - subc_begin(nx "*" ny, "U1", 0, -bh) - - proto = subc_proto_create_pad_circle(balldia) - - for(x = 0; x < nx; x++) { - for(y = 0; y < ny; y++) { - xx = x * step - xo - yy = y * step - yo - name = MAP[x,y] - if (name == "!") - continue - if (name == "") - name = "NC" - subc_pstk(proto, xx, yy, 0, name) - } - } - - dimension(-xo, -yo, -xo+step, -yo, bw/2, "spacing") - dimension(-xo-balldia/2, +yo, -xo+balldia/2, +yo, -bw*0.75, "balldia") - - - xx = -1 * (bw/2) - yy = -1 * (bh/2) - subc_rectangle("top-silk", xx, yy, bw/2, bh/2) - - dimension(xx, yy, bw/2, yy, bw/2, "width") - dimension(bw/2, yy, bw/2, bh/2, +bh/2, "height") - - silkmark(P["silkmark"], xx, yy, half*1.5) - - subc_end() -} Index: parametric_lht/connector.awk =================================================================== --- parametric_lht/connector.awk (revision 27205) +++ parametric_lht/connector.awk (nonexistent) @@ -1,93 +0,0 @@ -BEGIN { - base_unit_mm = 0 - - help_auto() - set_arg(P, "?spacing", 100) - set_arg(P, "?silkmark", "square") - set_arg(P, "?sequence", "normal") - - proc_args(P, "nx,ny,spacing,silkmark,eshift,etrunc", "nx,ny") - - - step = parse_dim(P["spacing"]) - - if (pin_ringdia > step*0.9) - pin_ringdia = step*0.9 - - if (pin_drill > pin_ringdia*0.9) - pin_drill = pin_ringdia*0.9 - - half=step/2 - - P["nx"] = int(P["nx"]) - P["ny"] = int(P["ny"]) - - eshift=tolower(P["eshift"]) - etrunc=tobool(P["etrunc"]) - if ((eshift != "x") && (eshift != "y") && (eshift != "") && (eshift != "none")) - error("eshift must be x or y or none (got: " eshift ")"); - - subc_begin(P["nx"] "*" P["ny"], "CONN1", 0, -step) - - proto_s = subc_proto_create_pin_square() - proto_r = subc_proto_create_pin_round() - - for(x = 0; x < P["nx"]; x++) { - if ((eshift == "x") && ((x % 2) == 1)) - yo = step/2 - else - yo = 0 - for(y = 0; y < P["ny"]; y++) { - if ((eshift == "y") && ((y % 2) == 1)) { - xo = step/2 - if ((etrunc) && (x == P["nx"]-1)) - continue - } - else { - xo = 0 - if ((etrunc) && (y == P["ny"]-1) && (yo != 0)) - continue - } - if (P["sequence"] == "normal") { - pinno++ - } - else if (P["sequence"] == "pivot") { - pinno = y * P["nx"] + x + 1 - } - else if (P["sequence"] == "zigzag") { - if (x % 2) { - pinno = (x+1) * P["ny"] - y - if ((etrunc) && (eshift == "x")) - pinno -= int(x/2)+1 - else if ((etrunc) && (eshift == "y")) - pinno += int(x/2) - } - else { - pinno = x * P["ny"] + y + 1 - if ((etrunc) && (eshift == "x")) - pinno -= x/2 - else if ((etrunc) && (eshift == "y")) - pinno += x/2-1 - } - } - subc_pstk(pinno == 1 ? proto_s : proto_r, x * step + xo, y * step + yo, 0, pinno) - } - } - - xo = 0 - yo = 0 - if (!etrunc) { - if (eshift == "y") - xo = step/2 - if (eshift == "x") - yo = step/2 - } - - subc_rectangle("top-silk", -half, -half, P["nx"] * step - half + xo, P["ny"] * step - half + yo) - - silkmark(P["silkmark"], -half, -half, half) - - dimension(0, step, step, step, step*2, "spacing") - - subc_end() -} Index: parametric_lht/dip =================================================================== --- parametric_lht/dip (revision 27205) +++ parametric_lht/dip (nonexistent) @@ -1,21 +0,0 @@ -#!/bin/sh - -#@@example dip(18) - -#@@purpose Generate classic DIP packages. - -#@@desc Generate thru-hole DIP packages with variable number of pins and -#@@desc row spacing -#@@params n, spacing - -#@@param:n number of pins - -#@@param:spacing spacing between the two rows of pins -#@@dim:spacing -#@@optional:spacing -#@@default:spacing 100 mil - -#@@include common_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/dip.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/dip ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/acy =================================================================== --- parametric_lht/acy (revision 27205) +++ parametric_lht/acy (nonexistent) @@ -1,56 +0,0 @@ -#!/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_subc.awk - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/acy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/acy ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/msop =================================================================== --- parametric_lht/msop (revision 27205) +++ parametric_lht/msop (nonexistent) @@ -1,34 +0,0 @@ -#!/bin/sh - -# Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), MSOP - -#@@example msop(8) - -#@@purpose Generate MSOP packages. - -#@@desc Generate MSOP packages with variable number of pins and -#@@desc row spacing - -#@@include so -#@@include common_subc.awk - -#@@over@default:pad_spacing 0.65 mm -#@@over@default:row_spacing 4.9 mm -#@@over@default:int_bloat 0.6 mm -#@@over@default:ext_bloat 0.6 mm -#@@over@default:pad_thickness 0.45 mm - - -defaults=' -?pad_spacing=0.65mm, -?row_spacing=4.9mm, -?int_bloat=0.6mm, -?ext_bloat=0.4mm, -?rarc=25, -?silk_ext_x=18, -?silk_ext_y=22, -?pad_thickness=0.45mm -' - -awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" - Property changes on: parametric_lht/msop ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: parametric_lht/rcy.awk =================================================================== --- parametric_lht/rcy.awk (revision 27205) +++ parametric_lht/rcy.awk (nonexistent) @@ -1,95 +0,0 @@ -function pol_sign( ox) -{ - size=mil(20) - - ox = dia/2+size*2 - subc_line("top-silk", ox-size, 0, ox+size, 0) - - ox = -dia/2-size*2 - subc_line("top-silk", ox-size, 0, ox+size, 0) - subc_line("top-silk", ox, -size, ox, size) -} - -BEGIN { - base_unit_mm = 0 - - help_auto() - 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 - - subc_begin("rcy" P["spacing"], "C1", -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*0.8, "spacing") - - -# silk rectangle and pins - subc_arc("top-silk", 0, 0, dia/2, 0, 360) - dimension(-dia/2, 0, +dia/2, 0, dia*-0.8, "dia") - - - if (P["pol"] == "sign") { - pol_sign() - } - else if (P["pol"] ~ "^bar") { -# determine bar side (default to -) - side=P["pol"] - sub("^bar", "", side) - if (side ~ "sign") { - pol_sign() - sub("sign", "", 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) { - subc_line("top-silk", side*xs, y, side*x, y, th) - if (y != 0) - subc_line("top-silk", 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) - subc_line("top-silk", side*xs, y, side*end1, y, th) - if (end2 < x) - subc_line("top-silk", side*end2, y, side*x, y, th) - if (y != 0) { - if (end1 > xs) - subc_line("top-silk", side*xs, -y, side*end1, -y, th) - if (end2 < x) - subc_line("top-silk", side*end2, -y, side*x, -y, th) - } - } - } - } - else if ((P["pol"] != "") && (P["pol"] != "none")) { - error("Invalid pol") - } - - subc_end() -} Index: parametric/silkmark.help =================================================================== --- parametric/silkmark.help (revision 27205) +++ parametric/silkmark.help (nonexistent) @@ -1,11 +0,0 @@ -#@@param:silkmark how to mark pin 1 on the silk layer; multiple values can be listed separated with colons, e.g. "silkmark=externalx:angled" -#@@enum:silkmark:square a rectangle around pin 1 -#@@enum:silkmark:externalx a little triangle placed outside of the box pointing in line with the first x row -#@@enum:silkmark:externaly a little triangle placed outside of the box pointing in line with the first y row -#@@enum:silkmark:external45 a little triangle placed outside of the box pointing at the corner in 45 degree -#@@enum:silkmark:external shorthand for external -#@@enum:silkmark:angled an angled line in the corner -#@@enum:silkmark:arc an external 270 degree arc -#@@enum:silkmark:circle a circle, 270 degrees external -#@@enum:silkmark:dot a small external dot -#@@enum:silkmark:none no mark Index: parametric/acy =================================================================== --- parametric/acy (revision 27205) +++ parametric/acy (revision 27206) @@ -50,7 +50,7 @@ #@@thumbsize 2 -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/acy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/acy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/acy.awk =================================================================== --- parametric/acy.awk (revision 27205) +++ parametric/acy.awk (revision 27206) @@ -3,13 +3,13 @@ step = len/repeat for(x = sx1; x < sx2; x += step) { if (type == 1) { - element_arc(x+step/2, 0, step/2, step/2, 0, -180) + subc_arc("top-silk", x+step/2, 0, step/2, 0, -180) } else if (type == 2) { y = dia - element_line(x, 0, x+step/4, -y) - element_line(x+step/4, -y, x+3*step/4, y) - element_line(x+3*step/4, y, x+step, 0) + 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) } } @@ -16,6 +16,8 @@ } BEGIN { + base_unit_mm = 0 + help_auto() set_arg(P, "?type", "block") proc_args(P, "spacing,type,pol,dia", "spacing") @@ -28,17 +30,20 @@ offs_x = +spacing/2 - element_begin("", "R1", "acy" P["spacing"] ,0,0, spacing/2-spacing/5,-mil(20)) + subc_begin("acy" P["spacing"], "R1", -spacing/5, -mil(20), 0) - element_pin(-spacing/2, 0, 1) - element_pin(+spacing/2, 0, 2) + 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") { - element_line(-spacing/2, 0, -spacing/4, 0) - element_line(+spacing/4, 0, +spacing/2, 0) + subc_line("top-silk", -spacing/2, 0, -spacing/4, 0) + subc_line("top-silk", +spacing/4, 0, +spacing/2, 0) } # silk symbol @@ -46,7 +51,7 @@ sx2 = +spacing/4 len = sx2-sx1 if (P["type"] == "block") { - element_rectangle(sx1, -dia, sx2, +dia) + subc_rectangle("top-silk", sx1, -dia, sx2, +dia) } else if (P["type"] == "zigzag") { wave(2, 3) @@ -60,16 +65,16 @@ y1 = dia*1.2 y2 = dia rarc = dia/5 - element_line(sx1+cl2, y2, sx2-cl2, y2) - element_line(sx1+cl2, y2, sx1+cl1, y1) - element_line(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_line(sx1+cl2, -y2, sx2-cl2, -y2) - element_line(sx1+cl2, -y2, sx1+cl1, -y1) - element_line(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) + subc_rectangle("top-silk", sx1, y1, sx1+cl1, -y1, "right,NE,SE", rarc) + subc_rectangle("top-silk", sx2-cl1, y1, sx2, -y1, "left,NW,SW", rarc) } else if (P["type"] ~ "^core") { wave(1, 4) @@ -82,18 +87,18 @@ y = -len/8 for(nlines = int(nlines); nlines > 0; nlines--) { y-=cdist - element_line(sx1, y, sx2, y) + subc_line("top-silk", sx1, y, sx2, y) } } else if (P["type"] == "line") { - element_line(-spacing/2, 0, +spacing/2, 0) + 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 - element_arc(-spacing/2, 0, r, r, 0, 360) - element_line(-spacing/2, 0, +spacing/2, 0) + subc_arc("top-silk", -spacing/2, 0, r, 0, 360) + subc_line("top-silk", -spacing/2, 0, +spacing/2, 0) } else { error("Invalid type") @@ -104,22 +109,22 @@ # silk wiper if (P["wiper"] == "thermistor") { x = len/3 - element_line(-4*x/4, dia*2, -2*x/4, dia*2) - element_line(-2*x/4, dia*2, +2*x/4, -dia*2) + 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)) + subc_arrow("top-silk", -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) + subc_arrow("top-silk", 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) - element_line(0, y, x, y) - element_line(x, y, x, 0) + subc_arrow("top-silk", 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") @@ -129,25 +134,25 @@ if (P["pol"] == "sign") { size=mil(10) - offs_y = size*2.2 - offs_x = DEFAULT["pin_ringdia"]/2+size*1.1 - element_line(-size, 0, +size, 0) + oy = size*2.2-offs_y + ox = DEFAULT["pin_ringdia"]/2+size*1.1-offs_x + subc_line("top-silk", ox-size, oy, ox+size, oy) - offs_x = spacing - (DEFAULT["pin_ringdia"]/2+size*1.1) - element_line(-size, 0, +size, 0) - element_line(0, -size, 0, +size) + ox = spacing - (DEFAULT["pin_ringdia"]/2+size*1.1)-offs_x + subc_line("top-silk", ox-size, oy, ox+size, oy) + subc_line("top-silk", ox, oy-size, ox, oy+size) } else if (P["pol"] == "bar") { offs=DEFAULT["line_thickness"] - element_rectangle(-spacing/4-offs, -dia, -spacing/4+offs, +dia, DEFAULT["line_thickness"]*4) + subc_rectangle("top-silk", -spacing/4-offs, -dia, -spacing/4+offs, +dia, DEFAULT["line_thickness"]*4) } else if (P["pol"] == "dot") { r=2*DEFAULT["line_thickness"]/3 - element_arc(-spacing/4-r*3, -dia/2, r, r, 0, 360) + subc_arc("top-silk", -spacing/4-r*3, -dia/2, r, 0, 360) } else if ((P["pol"] != "") && (P["pol"] != "none")) { error("Invalid pol") } - element_end() + subc_end() } Index: parametric/alf =================================================================== --- parametric/alf (revision 27205) +++ parametric/alf (revision 27206) @@ -31,7 +31,7 @@ #@@default:aspect spacing/6 -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/alf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/alf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/alf.awk =================================================================== --- parametric/alf.awk (revision 27205) +++ parametric/alf.awk (revision 27206) @@ -1,4 +1,6 @@ BEGIN { + base_unit_mm = 0 + help_auto() set_arg(P, "?aspect", 6) set_arg(P, "?type", "normal") @@ -11,20 +13,24 @@ offs_x = +spacing/2 - element_begin("", "D1", "acy" P["spacing"] ,0,0, 2.2*spacing/3,-mil(50)) + subc_begin("acy" P["spacing"], "D1", 2.2*spacing/3-offs_x,-mil(50)) - element_pin(-spacing/2, 0, 1) - element_pin(+spacing/2, 0, 2) + 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") # pins - element_line(-spacing/2, 0, -spacing/aspect, 0) - element_line(+spacing/aspect, 0, +spacing/2, 0) + subc_line("top-silk", -spacing/2, 0, -spacing/aspect, 0) + subc_line("top-silk", +spacing/aspect, 0, +spacing/2, 0) # triangle - element_line(+spacing/aspect, -dia, +spacing/aspect, +dia) - element_line(+spacing/aspect, -dia, -spacing/aspect, 0) - element_line(+spacing/aspect, +dia, -spacing/aspect, 0) + subc_line("top-silk", +spacing/aspect, -dia, +spacing/aspect, +dia) + subc_line("top-silk", +spacing/aspect, -dia, -spacing/aspect, 0) + subc_line("top-silk", +spacing/aspect, +dia, -spacing/aspect, 0) dimension(+spacing/aspect, -dia, +spacing/aspect, dia, "@" spacing*1.2 ";0", "dia") @@ -32,34 +38,34 @@ # front cross line with decoration r = dia*0.3 if (P["type"] == "normal") { - element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) + subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) } else if (P["type"] == "zener") { - element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) - element_line(-spacing/aspect, +dia, -spacing/aspect-r, +dia) - element_line(-spacing/aspect, -dia, -spacing/aspect+r, -dia) + subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) + subc_line("top-silk", -spacing/aspect, +dia, -spacing/aspect-r, +dia) + subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect+r, -dia) } else if (P["type"] == "tunnel") { - element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) - element_line(-spacing/aspect, +dia, -spacing/aspect+r, +dia) - element_line(-spacing/aspect, -dia, -spacing/aspect+r, -dia) + subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) + subc_line("top-silk", -spacing/aspect, +dia, -spacing/aspect+r, +dia) + subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect+r, -dia) } else if (P["type"] == "varactor") { - element_line(-spacing/aspect, -dia, -spacing/aspect, +dia) - element_line(-spacing/aspect-r, -dia, -spacing/aspect-r, +dia) + subc_line("top-silk", -spacing/aspect, -dia, -spacing/aspect, +dia) + subc_line("top-silk", -spacing/aspect-r, -dia, -spacing/aspect-r, +dia) } else if (P["type"] == "schottky") { cx = -spacing/aspect + r cy = -(dia-r) - element_line(-spacing/aspect, -(dia-r), -spacing/aspect, +dia-r) - element_arc(cx, cy, r, r, 0, -180) + subc_line("top-silk", -spacing/aspect, -(dia-r), -spacing/aspect, +dia-r) + subc_arc("top-silk", cx, cy, r, 0, -180) cx = -spacing/aspect - r cy = +(dia-r) - element_arc(cx, cy, r, r, 0, +180) + subc_arc("top-silk", cx, cy, r, 0, +180) } else if ((P["type"] != "") && (P["type"] != "none")) { error("Invalid type") } - element_end() + subc_end() } Index: parametric/bga =================================================================== --- parametric/bga (revision 27205) +++ parametric/bga (revision 27206) @@ -2,7 +2,7 @@ # Reference: Microchip Packaging Specification DS00000049BX (en012702.pdf), SSOP -#@@example bga(map=a1:a2:a2:#:b1:!:b3:#:c1:c2:!) +#@@example bga(map=a1:a2:a3:#:b1:!:b3:#:c1:c2:!) #@@purpose Generate ball grid array @@ -68,7 +68,7 @@ #@@thumbnum:automap2 1 -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/bga.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/bga.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/bga.awk =================================================================== --- parametric/bga.awk (revision 27205) +++ parametric/bga.awk (revision 27206) @@ -66,6 +66,7 @@ x++ } ny++; + nx++; } else { if ((nx == "") || (ny == "")) @@ -90,8 +91,10 @@ xo = (nx-1)*step/2 yo = (ny-1)*step/2 - element_begin("", "U1", nx "*" ny ,0,0, 0, -bh) + subc_begin(nx "*" ny, "U1", 0, -bh) + proto = subc_proto_create_pad_circle(balldia) + for(x = 0; x < nx; x++) { for(y = 0; y < ny; y++) { xx = x * step - xo @@ -101,7 +104,7 @@ continue if (name == "") name = "NC" - element_pad_circle(xx, yy, balldia, name) + subc_pstk(proto, xx, yy, 0, name) } } @@ -111,7 +114,7 @@ xx = -1 * (bw/2) yy = -1 * (bh/2) - element_rectangle(xx, yy, bw/2, bh/2) + subc_rectangle("top-silk", xx, yy, bw/2, bh/2) dimension(xx, yy, bw/2, yy, bw/2, "width") dimension(bw/2, yy, bw/2, bh/2, +bh/2, "height") @@ -118,6 +121,5 @@ silkmark(P["silkmark"], xx, yy, half*1.5) - - element_end() + subc_end() } Index: parametric/common_subc.awk =================================================================== --- parametric/common_subc.awk (nonexistent) +++ parametric/common_subc.awk (revision 27206) @@ -0,0 +1,1021 @@ +#@@param:pin_ringdia pin's copper ring (annulus) outer diameter (in mil by default, mm suffix can be used) +#@@optional:pin_ringdia +#@@dim:pin_ringdia + +#@@param:pin_clearance pin's copper clearance diameter (in mil by default, mm suffix can be used) +#@@optional:pin_clearance +#@@dim:pin_clearance + +#@@param:pin_mask pin's solder mask diameter (in mil by default, mm suffix can be used) +#@@optional:pin_mask +#@@dim:pin_mask + +#@@param:pin_drill copper pin's drill diameter (in mil by default, mm suffix can be used) +#@@optional:pin_drill +#@@dim:pin_drill + +#@@param:pad_thickness width of pads (in mil by default, mm suffix can be used) +#@@optional:pad_thickness +#@@dim:pad_thickness + +#@@param:pad_clearance copper clearance around the pad (in mil by default, mm suffix can be used) +#@@optional:pad_clearance +#@@dim:pad_clearance + +#@@param:pad_mask pin's solder mask (in mil by default, mm suffix can be used) +#@@optional:pad_mask +#@@dim:pad_mask + +#@@param:pad_paste pad's paste line thickness (in mil by default, mm suffix can be used) +#@@optional:pad_paste +#@@dim:pad_paste + +#@@param:line_thickness silk line thickness (in mil by default, mm suffix can be used) +#@@optional:line_thickness +#@@dim:line_thickness + +BEGIN { + q="\"" + + DEFAULT["pin_ringdia"] = mil(80) + DEFAULT["pin_ringdia", "dim"] = 1 + + DEFAULT["pin_clearance"] = mil(50) + DEFAULT["pin_clearance", "dim"] = 1 + + DEFAULT["pin_mask"] = mil(86) + DEFAULT["pin_mask", "dim"] = 1 + + DEFAULT["pin_drill"] = mm(1) + DEFAULT["pin_drill", "dim"] = 1 + + DEFAULT["line_thickness"] = mil(10) + DEFAULT["line_thickness", "dim"] = 1 + + DEFAULT["pad_thickness"] = mil(20) + DEFAULT["pad_thickness", "dim"] = 1 + DEFAULT["pad_clearance"] = mil(10) + DEFAULT["pad_clearance", "dim"] = 1 + DEFAULT["pad_mask"] = mil(30) + DEFAULT["pad_mask", "dim"] = 1 + DEFAULT["pad_paste"] = "" # use copper size + DEFAULT["pad_paste", "dim"] = 1 + + DEFAULT["pin_flags"] = "__auto" + + s_default=1 + s_weak=2 + s_explicit=3 + + offs_x = 0 + offs_y = 0 + objid = 1 + proto_next_id = 0 + + pi=3.141592654 + + NL = "\n" +} + +# Throw an error and exit +function error(msg) +{ + print "Error: " msg > "/dev/stderr" + exit 1 +} + +# return a if it is not empty, else return b +function either(a, b) +{ + return a != "" ? a : b +} + +# strip leading/trailing whitespaces +function strip(s) +{ + sub("^[ \t\r\n]*", "", s) + sub("[ \t\r\n]*$", "", s) + return s +} + +function lht_str(s) +{ + if (s ~ "[^A-Za-z0-9 _-]") { + gsub("}", "\\}", s) + return "{" s "}" + } + return s +} + +function unit(coord) +{ + if (coord == "") + coord = 0 + if (base_unit_mm) + return coord "mm" + return coord "mil" +} + +function subc_text(layer, x, y, str, scale, rot, flags, attributes ,s) +{ + + s = s " ha:text." ++objid "{" NL + s = s " scale = " either(scale, 100) NL + if (attributes != "") + s = s " ha:attributes {" attributes "}" NL + s = s " x = " unit(x) NL + s = s " y = " unit(y) NL + s = s " rot = " either(rot, 0) NL + s = s " string = %a.parent.refdes%" NL + s = s " fid = 0" NL + s = s " ha:flags {" flags "}" NL + s = s " }" NL + + LAYER[layer] = LAYER[layer] NL s +} + +function subc_line(layer, x1, y1, x2, y2, thick, clr, flags, attributes ,s) +{ + s = s " ha:line." ++objid " {" NL + s = s " x1 = " unit(x1) NL + s = s " y1 = " unit(y1) NL + s = s " x2 = " unit(x2) NL + s = s " y2 = " unit(y2) NL + s = s " thickness = " unit(either(thick, DEFAULT["line_thickness"])) NL + s = s " clearance = " unit(either(clr, 0)) NL + if (attributes != "") + s = s " ha:attributes {" attributes "}" NL + s = s " ha:flags {" flags "}" NL + s = s " }" NL + + LAYER[layer] = LAYER[layer] NL s +} + +function subc_arc(layer, cx, cy, r, a_start, a_delta, thick, clr, flags, attributes ,s) +{ + s = s " ha:arc." ++objid " {" NL + s = s " x = " unit(cx) NL + s = s " y = " unit(cy) NL + s = s " astart = " a_start NL + s = s " adelta = " a_delta NL + s = s " thickness = " unit(either(thick, DEFAULT["line_thickness"])) NL + s = s " clearance = " unit(either(clr, 0)) NL + s = s " width = " unit(r) NL + s = s " height = " unit(r) NL + if (attributes != "") + s = s " ha:attributes {" attributes "}" NL + s = s " ha:flags {" flags "}" NL + s = s " }" NL + + LAYER[layer] = LAYER[layer] NL s +} + +function subc_rect(layer, x1, y1, x2, y2, clearance, flags, attributes ,s) +{ + w = w/2 + h = h/2 + s = s " ha:polygon." ++objid " {" NL + s = s " clearance=" unit(clearance) NL + s = s " li:geometry {" NL + s = s " ta:contour {" NL + s = s " { " unit(x1) "; " unit(y1) " }" NL + s = s " { " unit(x2) "; " unit(y1) " }" NL + s = s " { " unit(x2) "; " unit(y2) " }" NL + s = s " { " unit(x1) "; " unit(y2) " }" NL + s = s " }" NL + s = s " }" NL + s = s " ha:attributes {" attributes "}" NL + s = s " ha:flags {" flags "}" NL + s = s " }" NL + + LAYER[layer] = LAYER[layer] NL s +} + +# start generating a subcircuit +function subc_begin(footprint, refdes, refdes_x, refdes_y, refdes_dir) +{ + print "li:pcb-rnd-subcircuit-v6 {" + print " ha:subc." ++objid "{" + print " ha:attributes {" + print " footprint = " lht_str(footprint) + if (refdes != "") + print " refdes = " lht_str(refdes) + print " }" + + + subc_text("top-silk", refdes_x, refdes_y, "%a.parent.refdes%", 100, text_dir, "dyntext = 1;floater=1;") + LAYER_TYPE["subc-aux"] = "top-misc-virtual" + subc_line("subc-aux", -offs_x, -offs_y, -offs_x + mm(1), -offs_y, mm(0.1), 0, "", "subc-role = x"); + subc_line("subc-aux", -offs_x, -offs_y, -offs_x, -offs_y + mm(1), mm(0.1), 0, "", "subc-role = y"); + subc_line("subc-aux", -offs_x, -offs_y, -offs_x, -offs_y, mm(0.1), 0, "", "subc-role = origin"); +} + +# generate subcircuit footers +function subc_end( layer,n,v,L,lt) +{ + print " ha:data {" + print " li:padstack_prototypes {" + for(n = 0; n < proto_next_id; n++) { + if (PROTO_COMMENT[n] != "") + print PROTO_COMMENT[n] + print " ha:ps_proto_v6." n " {" + print PROTO[n] + print " }" + } + print " }" + +# global objects (padstack refs) + print " li:objects {" + print globals + print " }" + +# layers and layer objects + print " li:layers {" + for(layer in LAYER) { + lt = either(LAYER_TYPE[layer], layer) + v = split(lt, L, "-") + print " ha:" layer " {" + print " lid = 0" + print " ha:type {" + for(n = 1; n <= v; n++) + print " " L[n] " = 1" + print " }" + print " li:objects {" + print LAYER[layer] + print " }" + print " ha:combining {" + print " }" + print " }" + } + print " }" + print " }" + print " }" + print "}" +} + +function subc_proto_alloc() +{ + return proto_next_id++ +} + +function subc_pstk_add_hole(proto, dia, plated, htop, hbottom ,s) +{ + s = s " hdia = " unit(dia) NL + s = s " hplated = " int(plated) NL + s = s " htop = " int(htop) NL + s = s " hbottom = " int(hbottom) NL + PROTO[proto] = PROTO[proto] s + PROTO_HOLE[proto] = dia +} + +function subc_pstk_no_hole(proto ,s) +{ + s = s " hdia = 0; hplated = 0; htop = 0; hbottom = 0" NL + PROTO[proto] = PROTO[proto] s +} + +function subc_pstk_shape_layer(layer ,s,L,v,n) +{ + v = split(layer, L, "-") + s = s " ha:layer_mask {" NL + for(n = 1; n <= v; n++) + s = s " " L[n] " = 1" NL + s = s " }" NL + s = s " ha:combining {" NL + if (layer ~ "mask") + s = s " sub = 1" NL + if ((layer ~ "mask") || (layer ~ "paste")) + s = s " auto = 1" NL + s = s " }" NL + return s +} + +function subc_pstk_add_shape_circ(proto, layer, x, y, dia ,s) +{ + s = s " ha:ps_shape_v4 {" NL + s = s " clearance = 0" NL + s = s " ha:ps_circ {" NL + s = s " x = " unit(x) NL + s = s " y = " unit(y) NL + s = s " dia = " unit(dia) NL + s = s " }" NL + s = s subc_pstk_shape_layer(layer) + s = s " }" NL + PROTO[proto] = PROTO[proto] s +} + +function subc_pstk_add_shape_square(proto, layer, x, y, sx, sy ,s) +{ + sx = sx / 2 + sy = sy / 2 + s = s " ha:ps_shape_v4 {" NL + s = s " clearance = 0" NL + s = s " li:ps_poly {" NL + s = s " " unit(x - sx) ";" unit(y - sy) "; " unit(x + sx) ";" unit(y - sy) ";" NL + s = s " " unit(x + sx) ";" unit(y + sy) "; " unit(x - sx) ";" unit(y + sy) ";" NL + s = s " }" NL + s = s subc_pstk_shape_layer(layer) + s = s " }" NL + PROTO[proto] = PROTO[proto] s +} + +function subc_pstk_add_shape_square_corners(proto, layer, x1, y1, x2, y2 ,s) +{ + sx = sx / 2 + sy = sy / 2 + s = s " ha:ps_shape_v4 {" NL + s = s " clearance = 0" NL + s = s " li:ps_poly {" NL + s = s " " unit(x1) ";" unit(y1) "; " unit(x2) ";" unit(y1) ";" NL + s = s " " unit(x2) ";" unit(y2) "; " unit(x1) ";" unit(y2) ";" NL + s = s " }" NL + s = s subc_pstk_shape_layer(layer) + s = s " }" NL + PROTO[proto] = PROTO[proto] s +} + +function subc_pstk_add_shape_line(proto, layer, x1, y1, x2, y2, thick ,s) +{ + s = s " ha:ps_shape_v4 {" NL + s = s " clearance = 0" NL + s = s " ha:ps_line {" NL + s = s " x1=" unit(x1) "; y1=" unit(y1) "; x2=" unit(x2) "; y2=" unit(y2) ";" NL + s = s " thickness=" unit(thick) "; square=0" NL + s = s " }" NL + s = s subc_pstk_shape_layer(layer) + s = s " }" NL + PROTO[proto] = PROTO[proto] s +} + +function subc_proto_create_pin_round(drill_dia, ring_dia, mask_dia ,proto) +{ + proto = subc_proto_alloc() + subc_pstk_add_hole(proto, either(drill_dia, DEFAULT["pin_drill"]), 1) + + PROTO_COMMENT[proto] = "# Round plated through hole " unit(ring_dia) "/" unit(drill_dia) + PROTO[proto] = PROTO[proto] " li:shape {" NL + + ring_dia = either(ring_dia, DEFAULT["pin_ringdia"]) + subc_pstk_add_shape_circ(proto, "top-copper", x, y, ring_dia) + subc_pstk_add_shape_circ(proto, "intern-copper", x, y, ring_dia) + subc_pstk_add_shape_circ(proto, "bottom-copper", x, y, ring_dia) + + mask_dia = either(mask_dia, DEFAULT["pin_mask"]) + subc_pstk_add_shape_circ(proto, "top-mask", x, y, mask_dia) + subc_pstk_add_shape_circ(proto, "bottom-mask", x, y, mask_dia) + + PROTO[proto] = PROTO[proto] " }" NL + return proto +} + +function subc_proto_create_pin_square(drill_dia, ring_span, mask_span ,proto) +{ + proto = subc_proto_alloc() + subc_pstk_add_hole(proto, either(drill_dia, DEFAULT["pin_drill"]), 1) + + PROTO_COMMENT[proto] = "# Square plated through hole " unit(ring_dia) "/" unit(drill_dia) + PROTO[proto] = PROTO[proto] " li:shape {" NL + + ring_span = either(ring_span, DEFAULT["pin_ringdia"]) + subc_pstk_add_shape_square(proto, "top-copper", x, y, ring_span, ring_span) + subc_pstk_add_shape_square(proto, "intern-copper", x, y, ring_span, ring_span) + subc_pstk_add_shape_square(proto, "bottom-copper", x, y, ring_span, ring_span) + + mask_span = either(mask, DEFAULT["pin_mask"]) + subc_pstk_add_shape_square(proto, "top-mask", x, y, mask_span, mask_span) + subc_pstk_add_shape_square(proto, "bottom-mask", x, y, mask_span, mask_span) + PROTO[proto] = PROTO[proto] " }" NL + + return proto +} + +function pad_paste(copper, absval, offsval, ratio) +{ + if (absval != "") + return absval + if (offsval != 0) + return copper+offsval + if (ratio != 0) + return copper*ratio + if (DEFAULT["pad_paste"] != "") + return DEFAULT["pad_paste"] + return copper +} + +function pad_paste_offs(offsval) +{ + return either(offsval, (DEFAULT["pad_paste"]) - DEFAULT["pad_thickness"]) +} + +function subc_proto_create_pad_sqline(x1, x2, thick, mask, paste ,proto,m,p) +{ + proto = subc_proto_alloc() + + thick = either(thick, DEFAULT["pad_thickness"]) + + subc_pstk_no_hole(proto) + + PROTO_COMMENT[proto] = "# Square smd pad " x2-x1 " * " thick + PROTO[proto] = PROTO[proto] " li:shape {" NL + + subc_pstk_add_shape_square_corners(proto, "top-copper", x1-thick/2, -thick/2, x2+thick/2, thick/2) + + m = (either(mask, DEFAULT["pad_mask"]) - thick) / 2 + subc_pstk_add_shape_square_corners(proto, "top-mask", x1-thick/2-m, -thick/2-m, x2+thick/2+m, thick/2+m) + + p = (pad_paste(thick, paste)-thick)/2 + subc_pstk_add_shape_square_corners(proto, "top-paste", x1-thick/2-p, -thick/2-p, x2+thick/2+p, thick/2+p) + + PROTO[proto] = PROTO[proto] " }" NL + + return proto +} + +function subc_proto_create_pad_line(x1, x2, thick, mask, paste ,proto,m,p) +{ + proto = subc_proto_alloc() + + thick = either(thick, parse_dim(DEFAULT["pad_thickness"])) + + subc_pstk_no_hole(proto) + + PROTO_COMMENT[proto] = "# Square smd pad " x2-x1 " * " thick + PROTO[proto] = PROTO[proto] " li:shape {" NL + + subc_pstk_add_shape_line(proto, "top-copper", x1, 0, x2, 0, thick) + subc_pstk_add_shape_line(proto, "top-mask", x1, 0, x2, 0, either(mask, DEFAULT["pad_mask"])) + subc_pstk_add_shape_line(proto, "top-paste", x1, 0, x2, 0, pad_paste(thick, paste)) + + PROTO[proto] = PROTO[proto] " }" NL + + return proto +} + +function subc_proto_create_pad_rect(w, h, mask_offs, paste_offs ,proto,m,p) +{ + proto = subc_proto_alloc() + + subc_pstk_no_hole(proto) + + PROTO_COMMENT[proto] = "# Square smd pad " w " * " h + PROTO[proto] = PROTO[proto] " li:shape {" NL + + w = w/2 + h = h/2 + + subc_pstk_add_shape_square_corners(proto, "top-copper", -w, -h, +w, +h) + + if (mask_offs != "none") { + m = (either(mask_offs, (DEFAULT["pad_mask"]) - DEFAULT["pad_thickness"]) / 2) + subc_pstk_add_shape_square_corners(proto, "top-mask", -w-m, -h-m, +w+m, +h+m) + } + + if (paste_offs != "none") { + p = pad_paste_offs(paste_offs) / 2 + subc_pstk_add_shape_square_corners(proto, "top-paste", -w-p, -h-p, +w+p, +h+p) + } + + PROTO[proto] = PROTO[proto] " }" NL + + return proto +} + + +function subc_proto_create_pad_circle(dia, mask_dia, paste_dia ,proto) +{ + proto = subc_proto_alloc() + subc_pstk_no_hole(proto) + + dia = either(dia, DEFAULT["pad_dia"]) + + PROTO_COMMENT[proto] = "# Circular smd pad " unit(dia) + PROTO[proto] = PROTO[proto] " li:shape {" NL + + subc_pstk_add_shape_circ(proto, "top-copper", 0, 0, dia) + + mask_dia = either(mask_dia, DEFAULT["pad_mask_dia"]) + subc_pstk_add_shape_circ(proto, "top-mask", 0, 0, mask_dia) + + paste_dia = either(mask_dia, DEFAULT["pad_paste_dia"]) + subc_pstk_add_shape_circ(proto, "top-mask", 0, 0, paste_dia) + + PROTO[proto] = PROTO[proto] " }" NL + return proto +} + +# generate a padstack reference +function subc_pstk(proto, x, y, rot, termid, name, clearance, s) +{ + if (termid == "") + termid = ++pin_number + + s = s " ha:padstack_ref." ++objid " {" NL + s = s " proto = " proto NL + s = s " x = " unit(x) NL + s = s " y = " unit(y) NL + s = s " rot = " rot+0 NL + s = s " smirror = 0; xmirror = 0" NL + s = s " clearance = " unit(either(clearance, (PROTO_HOLE[proto] > 0 ? DEFAULT["pin_clearance"] : DEFAULT["pad_clearance"]))/2) NL + s = s " ha:attributes {" NL + s = s " term = " termid NL + if (name != "") + s = s " name = 1" NL + s = s " }" NL + s = s " li:thermal { }" NL + s = s " ha:flags { clearline = 1; }" NL + s = s " }" NL + + globals = globals NL s +} + +# draw element pad +function subc_pad(x1, y1, x2, y2, thickness, number, flags, clearance, mask, name) +{ + print " Pad[", x1, y1, x2, y2, int(either(thickness, DEFAULT["pad_thickness"])), + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q flags q "]" +} + +# draw element pad - no thickness, but exact corner coordinates given +function subc_pad_rectangle(x1, y1, x2, y2, number, flags, clearance, mask, name, th,dx,dy,cx,cy) +{ + if (x2 < x1) { + th = x2 + x2 = x1 + x1 = th + } + if (y2 < y1) { + th = y2 + y2 = y1 + y1 = th + } + + dx = x2-x1 + dy = y2-y1 + + if (dx >= dy) { + th = dy + cy = (y1+y2)/2 + + print " Pad[", x1+th/2, cy, x2-th/2, cy, th, + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q flags q "]" + } + else { + th = dx + cx = (x1+x2)/2 + + print " Pad[", cx, y1+th/2, cx, y2-th/2, th, + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q flags q "]" + } +} + +# draw element pad circle +function subc_pad_circle(x1, y1, radius, number, clearance, mask, name) +{ + print " Pad[", x1, y1, x1, y1, int(either(radius, DEFAULT["pad_thickness"])), + int(either(clearance, DEFAULT["pad_clearance"])), int(either(mask, DEFAULT["pad_mask"])), + q name q, q number q, q "" q "]" +} + +function subc_arrow(layer, x1, y1, x2, y2, asize, thickness ,vx,vy,nx,ny,len,xb,yb) +{ + subc_line(layer, x1, y1, x2,y2, thickness) + + if (asize == 0) + asize = mil(20) + + vx = x2-x1 + vy = y2-y1 + len = sqrt(vx*vx+vy*vy) + if (len != 0) { + vx /= len + vy /= len + nx = vy + ny = -vx + xb = x2 - vx*asize + yb = y2 - vy*asize +# subc_line(layer, x2, y2, xb + 1000, yb + 1000) + subc_line(layer, x2, y2, xb + nx*asize/2, yb + ny*asize/2) + subc_line(layer, x2, y2, xb - nx*asize/2, yb - ny*asize/2) + subc_line(layer, xb - nx*asize/2, yb - ny*asize/2, xb + nx*asize/2, yb + ny*asize/2) + } +} + +# draw a rectangle of silk lines +# omit sides as requested in omit +# if r is non-zero, round corners - omit applies as NW, NW, SW, SE +# if omit includes "arc", corners are "rounded" with lines +function subc_rectangle(layer, x1, y1, x2, y2, omit, r, thickness ,tmp,r1,r2) +{ +# order coords for round corners + if (x1 > x2) { + tmp = x1 + x1 = x2 + x2 = tmp + } + if (y1 > y2) { + tmp = y1 + y1 = y2 + y2 = tmp + } + + if (!(omit ~ "left")) { + r1 = (omit ~ "NW") ? 0 : r + r2 = (omit ~ "SW") ? 0 : r + subc_line(layer, x1, y1+r1, x1, y2-r2, thickness) + } + if (!(omit ~ "top")) { + r1 = (omit ~ "NW") ? 0 : r + r2 = (omit ~ "NE") ? 0 : r + subc_line(layer, x1+r1, y1, x2-r2, y1, thickness) + } + if (!(omit ~ "bottom")) { + r1 = (omit ~ "SE") ? 0 : r + r2 = (omit ~ "SW") ? 0 : r + subc_line(layer, x2-r1, y2, x1+r2, y2, thickness) + } + if (!(omit ~ "right")) { + r1 = (omit ~ "SE") ? 0 : r + r2 = (omit ~ "NE") ? 0 : r + subc_line(layer, x2, y2-r1, x2, y1+r2, thickness) + } + + if (r > 0) { + if (omit ~ "arc") { + if (!(omit ~ "NW")) + subc_line(layer, x1, y1+r, x1+r, y1) + if (!(omit ~ "SW")) + subc_line(layer, x1, y2-r, x1+r, y2) + if (!(omit ~ "NE")) + subc_line(layer, x2, y1+r, x2-r, y1) + if (!(omit ~ "SE")) + subc_line(layer, x2, y2-r, x2-r, y2) + } + else { + if (!(omit ~ "NW")) + subc_arc(layer, x1+r, y1+r, r, 270, 90) + if (!(omit ~ "SW")) + subc_arc(layer, x1+r, y2-r, r, 0, 90) + if (!(omit ~ "NE")) + subc_arc(layer, x2-r, y1+r, r, 180, 90) + if (!(omit ~ "SE")) + subc_arc(layer, x2-r, y2-r, r, 90, 90) + } + } +} + +# draw a rectangle corners of silk lines, wx and wy long in x and y directions +# omit sides as requested in omit: NW, NW, SW, SE +# corners are always sharp +function subc_rectangle_corners(layer, x1, y1, x2, y2, wx, wy, omit, thickness ,tmp) +{ + if (!(omit ~ "NW")) { + subc_line(layer, x1, y1, x1+wx, y1, thickness) + subc_line(layer, x1, y1, x1, y1+wy, thickness) + } + if (!(omit ~ "NE")) { + subc_line(layer, x2-wx, y1, x2, y1, thickness) + subc_line(layer, x2, y1, x2, y1+wy, thickness) + } + if (!(omit ~ "SW")) { + subc_line(layer, x1, y2, x1+wx, y2, thickness) + subc_line(layer, x1, y2-wy, x1, y2, thickness) + } + if (!(omit ~ "SE")) { + subc_line(layer, x2-wx, y2, x2, y2, thickness) + subc_line(layer, x2, y2-wy, x2, y2, thickness) + } +} + +# convert coord given in mils to footprint units +function mil(coord) +{ + if (base_unit_mm) + return coord / 39.3701 + else + return coord +} + +# reverse mil(): converts footprint units back to mil +function rev_mil(coord) +{ + if (base_unit_mm) + return coord * 39.3701 + else + return coord +} + + +# convert coord given in mm to footprint units +function mm(coord) +{ + if (base_unit_mm) + return coord + else + return coord * 39.3701 +} + +# reverse mm(): converts footprint units back to mm +function rev_mm(coord) +{ + if (base_unit_mm) + return coord + else + return coord / 39.3701 +} + + +function set_arg_(OUT, key, value, strength) +{ + if (OUT[key, "strength"] > strength) + return + + OUT[key] = value + OUT[key, "strength"] = strength +} + +# set parameter key=value with optioal strength (s_* consts) in array OUT[] +# set only if current strength is stronger than the original value +# if key starts with a "?", use s_weak +# if key is in DEFAULT[], use DEFAULT[] instead of OUT[] +function set_arg(OUT, key, value ,strength) +{ + if (strength == "") + strength = s_explicit + if (key ~ "^[?]") { + sub("^[?]", "", key) + strength = s_weak + } + + if (key in DEFAULT) { + if (DEFAULT[key, "dim"]) + value = parse_dim_(value, 0) + set_arg_(DEFAULT, key, value, strength) + } + else + set_arg_(OUT, key, value, strength) +} + +# Process a generator argument list from arg_names. Save the result in +# array OUT. If mandatory is specified, check whether all mandatory +# parameters are specified +# Both arg_names and mandatory are comma separated list of argument names +function proc_args(OUT, arg_names, mandatory, N,A,M,v,n,key,val,pos) +{ + gsub(" ", "", arg_names) + gsub(" ", "", mandatory) + split(arg_names, N, ",") + v = split(args, A, ",") + +# fill in all named and positional arguments + pos = 1 + for(n = 1; n <= v; n++) { + A[n] = strip(A[n]) + if (A[n] == "") + continue + if (A[n] ~ "=") { +# named + key=A[n] + val=A[n] + sub("=.*", "", key) + sub("^[^=]*=", "", val) + set_arg(OUT, key, val, s_explicit) + } + else { +# positional + if (N[pos] == "") { + error("too many positional arguments at " A[n]) + } + while((N[pos] in OUT) && (N[pos, "strength"] == s_explicit)) pos++ + set_arg(OUT, N[pos], A[n], s_explicit) + pos++ + } + } + +# check whether all mandatory arguments are specified + v = split(mandatory, M, ",") + for(n = 1; n <= v; n++) { + if (!(M[n] in OUT)) { + error("missing argument " M[n] " (or positional " n ")") + exit 1 + } + } +} + +function parse_dim_(h, fallback_mil) +{ + if (h == "") + return "" + if (h ~ "mm$") { + sub("mm", "", h) + return mm(h) + } + if (h ~ "um$") { + sub("um", "", h) + return mm(h)/1000 + } + if (h ~ "nm$") { + sub("nm", "", h) + return mm(h)/1000000 + } + if (h ~ "cm$") { + sub("cm", "", h) + return mm(h)*10 + } + if (h ~ "m$") { + sub("m", "", h) + return mm(h)*1000 + } + if (h ~ "km$") { + sub("km", "", h) + return mm(h)*1000000 + } + + if (h ~ "in$") { + sub("in", "", h) + return mil(h)*1000 + } + if (h ~ "dmil$") { + sub("dmil", "", h) + return mil(h)/10 + } + if (h ~ "cmil$") { + sub("cmil", "", h) + return mil(h)/100 + } + if (h ~ "mil$") { + sub("mil", "", h) + return mil(h) + } + if (fallback_mil) + return mil(h) + else + return h +} + +# Assume h is a dimension and convert it +function parse_dim(h) +{ + return parse_dim_(h, 1) +} + +# Draw a DIP outline: useful for any rectangular package with a little +# half circle centered on the top line +# arcr: radius of the half circle +# xhalf: optional coordinate where the circle should be put +function dip_outline(layer, x1, y1, x2, y2, arcr ,xhalf) +{ + if (xhalf == "") + xhalf=(x1+x2)/2 + + subc_rectangle(layer, x1, y1, x2, y2, "top") + subc_line(layer, x1, y1, xhalf-arcr, y1) + subc_line(layer, xhalf+arcr, y1, x2, y1) + + subc_arc(layer, xhalf, y1, arcr, 0, 180) +} + +# decide whether x is true or false +# returns 1 if true +# returns 0 if false +function tobool(x) +{ + if (x == int(x)) + return (int(x) != 0) + + x = tolower(x) + return (x == "true") || (x == "yes") || (x == "on") +} + +# default pin1 mark on a box +# style: mark style, ":" separated list +# x,y: the coordinates of the origin corner (top-left) +# half: half the stepping of the pin grid - the size of the mark +# step: optional size of the external arrow or square (defaults to 2*half) +function silkmark(style, x, y, half, step, S,n,v) +{ + if (step == "") + step = half*2 + + v = split(style, S, ":") + + for(n = 1; n <= v; n++) { + if (S[n] == "angled") { + subc_line("top-silk", x+half, y, x, y+half) + } + else if (S[n] == "square") { + subc_line("top-silk", x, y+step, x+2*half, y+step) + subc_line("top-silk", x+step, y, x+2*half, y+step) + } + else if ((S[n] == "external") || (S[n] == "externalx")) { + subc_line("top-silk", x, y+half, x-step+half, y+half/2) + subc_line("top-silk", x, y+half, x-step+half, y+half*1.5) + subc_line("top-silk", x-step+half, y+half/2, x-step+half, y+half*1.5) + } + else if (S[n] == "externaly") { + subc_line("top-silk", x+half, y, x-half/2+half, y-step+half) + subc_line("top-silk", x+half, y, x+half/2+half, y-step+half) + subc_line("top-silk", x-half/2+half, y-step+half, x+half/2+half, y-step+half) + } + else if (S[n] == "external45") { + subc_line("top-silk", x, y, x-half, y-half/3) + subc_line("top-silk", x, y, x-half/3, y-half) + subc_line("top-silk", x-half, y-half/3, x-half/3, y-half) + } + else if (S[n] == "arc") { + subc_arc("top-silk", x, y, step/2, 180, 270) + } + else if (S[n] == "circle") { + subc_arc("top-silk", x, y, step/2, 0, 360) + } + else if (S[n] == "dot") { + subc_arc("top-silk", x-step/2, y-step/2, step/4, 0, 360) + } + else if ((S[n] != "none") && (S[n] != "")) { + error("invalid silkmark parameter: " S[n]) + } + } +} + +# output a dimension specification between x1;y1 and x2;y2, text distance at dist +# for a name,value pair +# if name is empty, only value is printed +# if value is empty, it's calculated +# if only name should be printed, value should be "!" +# if dist starts with a "@", it's the absolute coordinate of the center of the dim line (text base), else it's relative distance from the measured line +function dimension(x1, y1, x2, y2, dist, name, value, vx,vy) +{ + print "#dimension", x1, y1, x2, y2, dist, name, value +} + +function help_extract(SEEN, fn, dirn, OVER, IGN, WANT,tmp,key,val,i,skip) +{ + if (fn in SEEN) + return + SEEN[fn]++ + print "#@@info-gen-extract " fn + close(fn) + while((getline line < fn) > 0) { + if (line ~ "^#@@include") { + sub("^#@@include[ \t]*", "", line) + tmp = dirn "/" line + WANT[tmp]++ + } + else if (line ~ "^#@@over@ignore") { + key = line + sub("^#@@over@ignore:", "", key) + sub(" .*", "", key) + IGN[key] = 1 + } + else if (line ~ "^#@@over@") { + key = line + sub("^#@@over@", "", key) + val = "#@@" key + sub(" .*", "", key) + OVER[key] = val + } + else if (line ~ "^#@@") { + key = line + sub("^#@@", "", key) + sub(" .*", "", key) + skip = 0 + for(i in IGN) { + if (key ~ i) + skip = 1 + } + if (skip) + continue + if (key in OVER) { + print OVER[key] + OVER[key "::PRINTED"] = 1 + } + else + print line + } + } + close(fn) + for(tmp in WANT) + help_extract(SEEN, tmp, dirn, OVER, IGN) +} + +function help_print( SEEN, OVER, dirn, k) +{ + print "#@@info-generator pcblib common_subc.awk" + dirn = genfull + sub("/[^/]*$", "", dirn) + help_extract(SEEN, genfull, dirn, OVER) + for(k in OVER) { + if (!(k ~ "::PRINTED$") && !((k "::PRINTED") in OVER)) + print OVER[k] + } +} + +function help_auto() +{ + if ((args ~ "^--help") || (args ~ ",[ \t]*--help")) { + help_print() + exit(0) + } +} Index: parametric/connector =================================================================== --- parametric/connector (revision 27205) +++ parametric/connector (revision 27206) @@ -47,7 +47,7 @@ -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/connector.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/connector.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/connector.awk =================================================================== --- parametric/connector.awk (revision 27205) +++ parametric/connector.awk (revision 27206) @@ -1,4 +1,6 @@ BEGIN { + base_unit_mm = 0 + help_auto() set_arg(P, "?spacing", 100) set_arg(P, "?silkmark", "square") @@ -25,8 +27,11 @@ if ((eshift != "x") && (eshift != "y") && (eshift != "") && (eshift != "none")) error("eshift must be x or y or none (got: " eshift ")"); - element_begin("", "CONN1", P["nx"] "*" P["ny"] ,0,0, 0, -step) + subc_begin(P["nx"] "*" P["ny"], "CONN1", 0, -step) + proto_s = subc_proto_create_pin_square() + proto_r = subc_proto_create_pin_round() + for(x = 0; x < P["nx"]; x++) { if ((eshift == "x") && ((x % 2) == 1)) yo = step/2 @@ -65,7 +70,7 @@ pinno += x/2-1 } } - element_pin(x * step + xo, y * step + yo, pinno) + subc_pstk(pinno == 1 ? proto_s : proto_r, x * step + xo, y * step + yo, 0, pinno) } } @@ -78,11 +83,11 @@ yo = step/2 } - element_rectangle(-half, -half, P["nx"] * step - half + xo, P["ny"] * step - half + yo) + subc_rectangle("top-silk", -half, -half, P["nx"] * step - half + xo, P["ny"] * step - half + yo) silkmark(P["silkmark"], -half, -half, half) dimension(0, step, step, step, step*2, "spacing") - element_end() + subc_end() } Index: parametric/dip =================================================================== --- parametric/dip (revision 27205) +++ parametric/dip (revision 27206) @@ -15,7 +15,7 @@ #@@optional:spacing #@@default:spacing 100 mil -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/dip.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/dip.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/dip.awk =================================================================== --- parametric/dip.awk (revision 27205) +++ parametric/dip.awk (revision 27206) @@ -1,4 +1,6 @@ BEGIN { + base_unit_mm = 0 + help_auto() set_arg(P, "?spacing", 300) @@ -10,19 +12,21 @@ spacing=parse_dim(P["spacing"]) - element_begin("", "U1", P["n"] "*" P["spacing"] ,0,0, 0, mil(-100)) + subc_begin(P["n"] "*" P["spacing"], "U1_lht", 0, mil(-100)) half = mil(50) + pstk_s = subc_proto_create_pin_square() + pstk_r = subc_proto_create_pin_round() + for(n = 1; n <= P["n"]/2; n++) { - element_pin(0, (n-1) * mil(100), n) - element_pin(spacing, (n-1) * mil(100), P["n"] - n + 1) + subc_pstk((n == 1 ? pstk_s : pstk_r), 0, (n-1) * mil(100), 0, n) + subc_pstk(pstk_r, spacing, (n-1) * mil(100), 0, P["n"] - n + 1) } - dip_outline(-half, -half, spacing + half , (n-2) * mil(100) + half, half) + dip_outline("top-silk", -half, -half, spacing + half , (n-2) * mil(100) + half, half) - dimension(0, 0, spacing, 0, mil(100), "spacing") - element_end() + subc_end() } Index: parametric/msop =================================================================== --- parametric/msop (revision 27205) +++ parametric/msop (revision 27206) @@ -10,7 +10,7 @@ #@@desc row spacing #@@include so -#@@include common.awk +#@@include common_subc.awk #@@over@default:pad_spacing 0.65 mm #@@over@default:row_spacing 4.9 mm @@ -30,5 +30,5 @@ ?pad_thickness=0.45mm ' -awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/plcc =================================================================== --- parametric/plcc (revision 27205) +++ parametric/plcc (revision 27206) @@ -25,5 +25,5 @@ #@@optional:cpad_size #@@default:cpad_size empty, there's no central pad -awk -f `dirname $0`/common.awk -f `dirname $0`/plcc.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/plcc.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/plcc.awk =================================================================== --- parametric/plcc.awk (revision 27205) +++ parametric/plcc.awk (revision 27206) @@ -6,6 +6,8 @@ } BEGIN { + base_unit_mm = 0 + help_auto() PT["50"] = "26mil" set_arg(P, "?pitch", "50") @@ -43,7 +45,7 @@ S[1] -= 60 S[2] -= 60 - args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mil,y_spacing=" S[2] "mil,pad_spacing=" pitch "mil,pad_thickness=" pt "mil" + args = args ",nx=" pins ",ny=" pins ",x_spacing=" S[1] "mil,y_spacing=" S[2] "mil,pad_spacing=" pitch "mil,pad_thickness=" pt args = args ",width=" S[1]-150 " mil,height=" S[2]-150 " mil" Index: parametric/qf =================================================================== --- parametric/qf (revision 27205) +++ parametric/qf (revision 27206) @@ -107,8 +107,8 @@ #@@preview_args:silkmark 4,4 #@@default:silkmark dot -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/qf.awk =================================================================== --- parametric/qf.awk (revision 27205) +++ parametric/qf.awk (revision 27206) @@ -60,9 +60,7 @@ cpad_width=parse_dim(P["cpad_width"]) cpad_height=parse_dim(P["cpad_height"]) - if (P["cpad_mask"] == "") - cpad_mask = (cpad_width > cpad_height ? cpad_width : cpad_height) + either(parse_dim(P["pad_mask"]), DEFAULT["pad_mask"]) - else + if (P["cpad_mask"] != "") cpad_mask=parse_dim(P["cpad_mask"]) @@ -98,21 +96,37 @@ return ((num-1) + pinoffs) % (pinmax)+1 } +# draw a matrix of paste rectangles; top-left corner is x1;y1, there are nx*ny +# rectangles of w*h size. rows/cols of pads are drawn with ox and oy offset +function paste_matrix(x1, y1, nx, ny, w, h, ox, oy, flags, attrbiutes, clearance, ix,iy) +{ + for(iy = 0; iy < ny; iy++) + for(ix = 0; ix < nx; ix++) + subc_rect("top-paste", x1+ix*ox, y1+iy*oy, x1+ix*ox+w, y1+iy*oy+h, clearance, flags, attributes) +} + + BEGIN { + base_unit_mm = 0 + help_auto() qf_globals() - element_begin("", "U1", 2*nx + 2*ny ,0,0, -width/2 - mm(1), -height/2 - mm(2)) + subc_begin("", "U1", -width/2 - mm(1), -height/2 - mm(2), 0) cx = (nx+1)/2 cy = (ny+1)/2 + if (rpad_round == "square") + proto = subc_proto_create_pad_sqline(-ext_bloat, int_bloat, pad_width) + else + proto = subc_proto_create_pad_line(-ext_bloat, int_bloat, pad_width) for(n = 1; n <= ny; n++) { y = (-cy + n) * pad_spacing x1 = -x_spacing/2 x2 = x_spacing/2 - element_pad(x1-ext_bloat, y, x1+int_bloat, y, pad_width, pinnum(n), rpad_round) - element_pad(x2-int_bloat, y, x2+ext_bloat, y, pad_width, pinnum(nx+2*ny-n+1), rpad_round) + subc_pstk(proto, x1, y, 0, pinnum(n)) + subc_pstk(proto, x2, y, 180, pinnum(nx+2*ny-n+1)) if (n == 1) y1 = y if (n == 2) @@ -125,24 +139,24 @@ x = (-cx + n) * pad_spacing y1 = -y_spacing/2 y2 = y_spacing/2 - element_pad(x, y1-ext_bloat, x, y1+int_bloat, pad_width, pinnum(nx*2+ny*2-n+1), rpad_round) - element_pad(x, y2-int_bloat, x, y2+ext_bloat, pad_width, pinnum(n+ny), rpad_round) + subc_pstk(proto, x, y1, 270, pinnum(nx*2+ny*2-n+1)) + subc_pstk(proto, x, y2, 90, pinnum(n+ny)) } if ((cpad_width != "") && (cpad_height != "")) { + cpadid = 2*nx+2*ny+1 # center pad paste matrix if ((cpm_nx > 0) && (cpm_ny > 0)) { ox = (cpad_width - (cpm_nx*cpm_width)) / (cpm_nx - 1) oy = (cpad_height - (cpm_ny*cpm_height)) / (cpm_ny - 1) - element_pad_matrix(-cpad_width/2, -cpad_height/2, cpm_nx,cpm_ny, cpm_width,cpm_height, ox+cpm_width,oy+cpm_height, 2*nx+2*ny+1, "square,nopaste") + paste_matrix(-cpad_width/2, -cpad_height/2, cpm_nx,cpm_ny, cpm_width,cpm_height, + ox+cpm_width,oy+cpm_height, "", "termid=" cpadid ";", 0) } # center pad - tmp = DEFAULT["pad_mask"] - DEFAULT["pad_mask"] = cpad_mask - element_pad_rectangle(-cpad_width/2, -cpad_height/2, +cpad_width/2, +cpad_height/2, 2*nx+2*ny+1, "square,nopaste") - DEFAULT["pad_mask"] = tmp + cpad_proto = subc_proto_create_pad_rect(cpad_width, cpad_height, cpad_mask, "none") + subc_pstk(cpad_proto, 0, 0, 0, cpadid) dimension(-cpad_width/2, -cpad_height/2, +cpad_width/2, -cpad_height/2, "@0;" (height * -0.6-ext_bloat), "cpad_width") dimension(cpad_width/2, -cpad_height/2, cpad_width/2, +cpad_height/2, "@" (width * 0.8+ext_bloat) ";0", "cpad_height") } @@ -152,17 +166,17 @@ bodysilk = P["bodysilk"] if ((bodysilk == "corners") || (bodysilk == "")) { - element_rectangle_corners(-width/2, -height/2, width/2, height/2, wx, wy) + subc_rectangle_corners("top-silk", -width/2, -height/2, width/2, height/2, wx, wy) silkmark(P["silkmark"], -width/2 - wx/2, -height/2+wy*1.5, (wx+wy)/4) } else if (bodysilk == "full") { - element_rectangle(-width/2, -height/2, width/2, height/2) + subc_rectangle("top-silk", -width/2, -height/2, width/2, height/2) silkmark(P["silkmark"], -width/2 + wx*3, -height/2+wy*3, (wx+wy)/2) } else if (bodysilk == "plcc") { r = (width+height)/10 - element_rectangle(-width/2, -height/2, width/2, height/2, "arc,NE,SW,SE", r) - element_line(-width/2, -height/2+r, width/2, -height/2+r) + subc_rectangle("top-silk", -width/2, -height/2, width/2, height/2, "arc,NE,SW,SE", r) + subc_line("top-silk", -width/2, -height/2+r, width/2, -height/2+r) silkmark(P["silkmark"], 0, -height*0.2, height/40) } else if (bodysilk != "none") @@ -174,7 +188,5 @@ dimension(-x_spacing/2, -height/2, +x_spacing/2, -height/2, "@0;" height*-1-ext_bloat, "x_spacing") dimension(+width/2, -y_spacing/2, +width/2, +y_spacing/2, "@" (width * 1.2+ext_bloat) ";0", "y_spacing") - - - element_end() + subc_end() } Index: parametric/qfn =================================================================== --- parametric/qfn (revision 27205) +++ parametric/qfn (revision 27206) @@ -20,5 +20,5 @@ #@@optional:cpad_size #@@default:cpad_size empty, there's no central pad -awk -f `dirname $0`/common.awk -f `dirname $0`/qfn.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/qfn.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/qfn.awk =================================================================== --- parametric/qfn.awk (revision 27205) +++ parametric/qfn.awk (revision 27206) @@ -42,9 +42,6 @@ if (P["cpad_size"] != "") args = args ",cpad_width=" P["cpad_size"] "mm,cpad_height=" P["cpad_size"] "mm" - - print "args=" args > "/dev/stderr" - # qf_globals("pins,size") } Index: parametric/qfp =================================================================== --- parametric/qfp (revision 27205) +++ parametric/qfp (revision 27206) @@ -20,5 +20,5 @@ #@@optional:cpad_size #@@default:cpad_size empty, there's no central pad -awk -f `dirname $0`/common.awk -f `dirname $0`/qfp.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/qfp.awk -f `dirname $0`/qf.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/qsop =================================================================== --- parametric/qsop (revision 27205) +++ parametric/qsop (revision 27206) @@ -10,7 +10,7 @@ #@@desc row spacing #@@include so -#@@include common.awk +#@@include common_subc.awk #@@over@default:pad_spacing 25 mil #@@over@default:row_spacing 213 mil @@ -30,5 +30,5 @@ ?pad_thickness=16mil ' -awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/rcy =================================================================== --- parametric/rcy (revision 27205) +++ parametric/rcy (revision 27206) @@ -26,7 +26,7 @@ #@@optional:dia #@@default:dia spacing*2 -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/rcy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/rcy.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/rcy.awk =================================================================== --- parametric/rcy.awk (revision 27205) +++ parametric/rcy.awk (revision 27206) @@ -1,20 +1,18 @@ -function pol_sign( ox,oy) +function pol_sign( ox) { - ox = offs_x - - size=mil(20) + size=mil(20) - offs_x = spacing/2 +dia/2+size*2 - element_line(-size, 0, +size, 0) + ox = dia/2+size*2 + subc_line("top-silk", ox-size, 0, ox+size, 0) - offs_x = spacing/2 -dia/2-size*2 - element_line(-size, 0, +size, 0) - element_line(0, -size, 0, +size) - - offs_x = ox + ox = -dia/2-size*2 + subc_line("top-silk", ox-size, 0, ox+size, 0) + subc_line("top-silk", ox, -size, ox, size) } BEGIN { + base_unit_mm = 0 + help_auto() set_arg(P, "?pol", "sign") proc_args(P, "spacing,pol,dia", "spacing") @@ -24,15 +22,19 @@ offs_x = +spacing/2 - element_begin("", "C1", "acy" P["spacing"] ,0,0, spacing/2-spacing/5,-mil(20)) + subc_begin("rcy" P["spacing"], "C1", -spacing/5, -mil(20), 0) - element_pin(-spacing/2, 0, 1) - element_pin(+spacing/2, 0, 2) + 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*0.8, "spacing") # silk rectangle and pins - element_arc(0, 0, dia/2, dia/2, 0, 360) + subc_arc("top-silk", 0, 0, dia/2, 0, 360) dimension(-dia/2, 0, +dia/2, 0, dia*-0.8, "dia") @@ -64,9 +66,9 @@ if (x <= xs) break if (y > ring/2+th/2) { - element_line(side*xs, y, side*x, y, th) + subc_line("top-silk", side*xs, y, side*x, y, th) if (y != 0) - element_line(side*xs, -y, side*x, -y, th) + subc_line("top-silk", side*xs, -y, side*x, -y, th) } else { # keep out a rectangle around the pin @@ -73,14 +75,14 @@ end1=spacing/2-ring end2=spacing/2+ring if (end1 > xs) - element_line(side*xs, y, side*end1, y, th) + subc_line("top-silk", side*xs, y, side*end1, y, th) if (end2 < x) - element_line(side*end2, y, side*x, y, th) + subc_line("top-silk", side*end2, y, side*x, y, th) if (y != 0) { if (end1 > xs) - element_line(side*xs, -y, side*end1, -y, th) + subc_line("top-silk", side*xs, -y, side*end1, -y, th) if (end2 < x) - element_line(side*end2, -y, side*x, -y, th) + subc_line("top-silk", side*end2, -y, side*x, -y, th) } } } @@ -89,5 +91,5 @@ error("Invalid pol") } - element_end() + subc_end() } Index: parametric/screw =================================================================== --- parametric/screw (revision 27205) +++ parametric/screw (revision 27206) @@ -30,6 +30,6 @@ #@@default:shape circle #@@preview_args:shape 3mm,6mm -#@@include common.awk +#@@include common_subc.awk -awk -f `dirname $0`/common.awk -f `dirname $0`/screw.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/screw.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" -v "genfull=$0" Index: parametric/screw.awk =================================================================== --- parametric/screw.awk (revision 27205) +++ parametric/screw.awk (revision 27206) @@ -28,13 +28,13 @@ y2 = sin(a-step/txs)*r*tx1 x3 = cos(a-step/2)*r*tx2 y3 = sin(a-step/2)*r*tx2 - element_line(xl, yl, x1, y1) - element_line(x, y, x2, y2) - element_line(x3, y3, x1, y1) - element_line(x3, y3, x2, y2) + subc_line("top-silk", xl, yl, x1, y1) + subc_line("top-silk", x, y, x2, y2) + subc_line("top-silk", x3, y3, x1, y1) + subc_line("top-silk", x3, y3, x2, y2) } else - element_line(xl, yl, x, y) + subc_line("top-silk", xl, yl, x, y) } xl = x yl = y @@ -53,7 +53,7 @@ set_arg(P, "?shape", "circle") proc_args(P, "hole,head,shape,ring", "hole") - element_begin("", "S1", "screw:" P["hole"] "," P["head"]"," P["shape"] ,0,0, 0, mil(-100)) + subc_begin("screw:" P["hole"] "," P["head"]"," P["shape"], "S1", 0, -mil(100), 0) if (P["hole"] ~ "^M") { hole = P["hole"] @@ -99,12 +99,15 @@ if (ring == "") ring = head*0.8 - element_pin(0, 0, 1, "none", ring, "", "", hole) + proto = subc_proto_create_pin_round(hole, ring) + subc_pstk(proto, 0, 0, 0, 1) + + shape = ":" P["shape"] ":" if (shape ~ ":circle:") - element_arc(0, 0, head/2, head/2, 0, 360) + subc_arc("top-silk", 0, 0, head/2, 0, 360) if (shape ~ ":hex:") shp(head/2, 6, 0) @@ -119,10 +122,10 @@ shp(head*0.4, 4, 3) if (shape ~ ":slot:") - element_line(-head/2, 0, head/2, 0) + subc_line("top-silk", -head/2, 0, head/2, 0) dimension(-head/2, 0, head/2, 0, head*0.7, "head") dimension(-hole/2, 0, hole/2, 0, head*0.6, "hole") - element_end() + subc_end() } Index: parametric/so =================================================================== --- parametric/so (revision 27205) +++ parametric/so (revision 27206) @@ -32,9 +32,9 @@ #@@optional:int_bloat #@@default:int_bloat 55 mil -#@@include common.awk +#@@include common_subc.awk #@@over@ignore::pin_ -awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/so.awk =================================================================== --- parametric/so.awk (revision 27205) +++ parametric/so.awk (revision 27206) @@ -1,4 +1,6 @@ BEGIN { + base_unit_mm = 0 + help_auto() set_arg(P, "?row_spacing", 250) set_arg(P, "?pad_spacing", 50) @@ -20,12 +22,14 @@ offs_x = -(row_spacing/2) offs_y = -int((P["n"]/4-0.5) * pad_spacing) - element_begin("", "U1", P["n"] "*" P["row_spacing"] ,0,0, 0, mil(-100)) + subc_begin(P["n"] "*" P["row_spacing"], "U1", -offs_x, mil(-100)-offs_y) + proto = subc_proto_create_pad_sqline(-ext_bloat, int_bloat, pad_width) + for(n = 1; n <= P["n"]/2; n++) { y = (n-1) * pad_spacing - element_pad(-ext_bloat, y, int_bloat, y, pad_width, n, "square") - element_pad(row_spacing-int_bloat, y, row_spacing+ext_bloat, y, pad_width, P["n"] - n + 1, "square") + subc_pstk(proto, 0, y, 0, n) + subc_pstk(proto, row_spacing, y, 180, P["n"] - n + 1) } silk_dist_x = either(parse_dim(P["silk_ext_x"]), pad_spacing/2) @@ -32,7 +36,7 @@ silk_dist_y = either(parse_dim(P["silk_ext_y"]), pad_spacing/2) rarc = either(parse_dim(P["rarc"]), pad_spacing/2) - dip_outline(-silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat , (n-2) * pad_spacing + silk_dist_y, rarc) + dip_outline("top-silk", -silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat , (n-2) * pad_spacing + silk_dist_y, rarc) left_dim="@" -silk_dist_x-ext_bloat-pad_spacing ";0" dimension(0, 0, 0, pad_spacing, left_dim, "pad_spacing") @@ -47,5 +51,5 @@ # dimension(-silk_dist_x-ext_bloat, -silk_dist_y, row_spacing + silk_dist_x+ext_bloat, -silk_dist_y, pad_spacing*2.5, "") - element_end() + subc_end() } Index: parametric/ssop =================================================================== --- parametric/ssop (revision 27205) +++ parametric/ssop (revision 27206) @@ -10,7 +10,7 @@ #@@desc row spacing #@@include so -#@@include common.awk +#@@include common_subc.awk #@@over@default:pad_spacing 0.65 mm #@@over@default:row_spacing 7.8 mm @@ -29,5 +29,5 @@ ?pad_thickness=0.45mm ' -awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" Index: parametric/tssop =================================================================== --- parametric/tssop (revision 27205) +++ parametric/tssop (revision 27206) @@ -10,7 +10,7 @@ #@@desc row spacing #@@include so -#@@include common.awk +#@@include common_subc.awk #@@over@default:pad_spacing 0.65 mm #@@over@default:row_spacing 6.4 mm @@ -29,5 +29,5 @@ ?pad_thickness=0.45mm ' -awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0" +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/so.awk -v "args=$defaults,$*" -v gen=`basename $0` -v "genfull=$0"