Index: pcblib-param/so =================================================================== --- pcblib-param/so (revision 293) +++ pcblib-param/so (nonexistent) @@ -1,20 +0,0 @@ -#!/bin/sh - -#@@example so(14) - -#@@purpose Generate classic DIP 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 (in mil, or in mm using the mm suffix; optional, default is 250 mil) -#@@param:pad_spacing spacing between the centerline of two pads (in mil, or in mm using the mm suffix; optional, default is 50 mil) -#@@param:ext_bloat how much longer the pad should extend outwards from the end-point of the pin (in mil, or in mm using the mm suffix; optional) -#@@param:int_bloat how much longer the pad should extend inwards from the end-point of the pin (in mil, or in mm using the mm suffix; optional) - -#@@include common.awk - -awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$*" - Property changes on: pcblib-param/so ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: pcblib-param/so.awk =================================================================== --- pcblib-param/so.awk (revision 293) +++ pcblib-param/so.awk (nonexistent) @@ -1,33 +0,0 @@ -BEGIN { - proc_args(P, "n,row_spacing,pad_spacing,ext_bloat,int_bloat", "n") - - set_arg(P, "?row_spacing", 250) - set_arg(P, "?pad_spacing", 50) - set_arg(P, "?ext_bloat", 10) - set_arg(P, "?int_bloat", 55) - - 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"]) - - element_begin(P["n"] "*" P["row_spacing"] " DIP socket", "U1", P["n"] "*" P["row_spacing"] ,0,0, 0, mil(-100)) - - 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") - } - - silk_dist = pad_spacing/2 - rarc = pad_spacing/2 - - dip_outline(-silk_dist-ext_bloat, -silk_dist, row_spacing + silk_dist+ext_bloat , (n-2) * pad_spacing + silk_dist, rarc) - - - element_end() -} Index: pcblib-param/common.awk =================================================================== --- pcblib-param/common.awk (revision 293) +++ pcblib-param/common.awk (nonexistent) @@ -1,247 +0,0 @@ -#@@param:pin_ringdia pin's copper ring (annulus) diameter (in mil by default, mm suffix can be used) -#@@param:pin_clearance pin's copper clearance diameter (in mil by default, mm suffix can be used) -#@@param:pin_mask copper pin's solder mask diameter (in mil by default, mm suffix can be used) -#@@param:pin_drill copper pin's drill diameter (in mil by default, mm suffix can be used) -#@@param:line_thickness silk line thickness (in mil by default, mm suffix can be used) - -BEGIN { - q="\"" - - DEFAULT["pin_ringdia"] = 8000 - DEFAULT["pin_ringdia", "dim"] = 1 - - DEFAULT["pin_clearance"] = 5000 - DEFAULT["pin_clearance", "dim"] = 1 - - DEFAULT["pin_mask"] = 8600 - DEFAULT["pin_mask", "dim"] = 1 - - DEFAULT["pin_drill"] = 3937 - DEFAULT["pin_drill", "dim"] = 1 - - DEFAULT["line_thickness"] = 1500 - DEFAULT["line_thickness", "dim"] = 1 - - DEFAULT["pad_thickness"] = 2000 - DEFAULT["pad_thickness", "dim"] = 1 - DEFAULT["pad_clearance"] = 1000 - DEFAULT["pad_clearance", "dim"] = 1 - DEFAULT["pad_mask"] = 3000 - DEFAULT["pad_mask", "dim"] = 1 - - DEFAULT["pin_flags"] = "__auto" - - s_default=1 - s_weak=2 - s_explicit=3 -} - -# 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 -} - -# generate an element header line; any argument may be empty -function element_begin(desc, name, value, cent_x, cent_y, text_x, text_y, text_dir, text_scale) -{ - print "Element[" q q, q desc q, q name q, q value q, - int(either(cent_x, 0)), int(either(cent_y, 0)), - int(either(text_x, 0)), int(either(text_y, 0)), - int(either(text_dir, 0)), int(either(text_scale, 100)), q q "]" - print "(" -} - -# generate an element footer line -function element_end() -{ - print ")" -} - -# generate a pin; arguments from ringdia are optional (defaults are in global vars pin_*) -function element_pin(x, y, number, flags, ringdia, clearance, mask, drill, name) -{ - if (number == "") - number = ++pin_number - - flags = either(flags, DEFAULT["pin_flags"]) - - if (flags == "__auto") { - if (number == 1) - flags = "square" - else - flags = "" - } - - print " Pin[" int(x), int(y), - int(either(ringdia, DEFAULT["pin_ringdia"])), int(either(clearance, DEFAULT["pin_clearance"])), int(either(mask, DEFAULT["pin_mask"])), - int(either(drill, DEFAULT["pin_drill"])), q name q, q number q, q flags q "]" -} - -# draw element pad -function element_pad(x1, y1, x2, y2, thickness, number, flags, clearance, mask, name) -{ - print " Pad[", int(x1), int(y1), int(x2), int(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 a line on silk; thickness is optional (default: line_thickness) -function element_line(x1, y1, x2, y2, thickness) -{ - print " ElementLine[" int(x1), int(y1), int(x2), int(y2), int(either(thickness, DEFAULT["line_thickness"])) "]" -} - -# draw a rectangle of silk lines -function element_rectangle(x1, y1, x2, y2, omit, thickness) -{ - if (!(omit ~ "left")) - element_line(x1, y1, x1, y2, thickness) - if (!(omit ~ "top")) - element_line(x1, y1, x2, y1, thickness) - if (!(omit ~ "right")) - element_line(x2, y2, x1, y2, thickness) - if (!(omit ~ "bottom")) - element_line(x2, y2, x2, y1, thickness) -} - -# draw a line on silk; thickness is optional (default: line_thickness) -function element_arc(cx, cy, rx, ry, a_start, a_delta, thickness) -{ - print " ElementArc[" int(cx), int(cy), int(rx), int(ry), int(a_start), int(a_delta), int(either(thickness, DEFAULT["line_thickness"])) "]" -} - - -# convert coord given in mils to footprint units -function mil(coord) -{ - return coord * 100 -} - -# convert coord given in mm to footprint units -function mm(coord) -{ - return coord*3937 -} - - -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"]) { - if (value ~ "mm") - value = mm(value) - else - value = mil(value) - } - 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++) { - if (A[n] ~ "=") { -# named - key=strip(A[n]) - val=strip(A[n]) - sub("=.*", "", key) - sub("^[^=]*=", "", val) - set_arg(OUT, key, val, s_explicit) - } - else { -# positional - A[n] = strip(A[n]) - if (N[pos] == "") { - error("too many positional arguments at " A[n]) - } - while(N[pos] in OUT) 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 - } - } -} - -# Assume h is a dimension; if it has an "mm" suffix, convert it from mm, -# else convert it from mil. -function parse_dim(h) -{ - if (h ~ "mm") { - sub("mm", "", h) - return mm(h) - } - return mil(h) -} - -# 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(x1, y1, x2, y2, arcr ,xhalf) -{ - if (xhalf == "") - xhalf=(x1+x2)/2 - - element_rectangle(x1, y1, x2, y2, "top") - element_line(x1, y1, xhalf-arcr, y1) - element_line(xhalf+arcr, y1, x2, y1) - - element_arc(xhalf, y1, arcr, arcr, 0, 180) -} Index: pcblib-param/connector =================================================================== --- pcblib-param/connector (revision 293) +++ pcblib-param/connector (nonexistent) @@ -1,23 +0,0 @@ -#!/bin/sh - -#@@example connector(2, 3, silkmark=external) - -#@@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 (mandatory, no default) -#@@param:ny number of pins in the Y direction (mandatory, no default) -#@@param:spacing spacing between the pins (in mil, or in mm using the mm suffix; optional, default is 100 mil) -#@@param:silkmark how to mark pin 1; values: square, external, angled, none (optional; default is square) -#@@param:eshift shift even rows or columns by half spacing; values: x (shift columns), y (shift rows) (optional; default: don't shift) -#@@param:etrunc truncate the last pin of a shifted row or column (optional boolean, defaults to false) - -#@@include common.awk - -awk -f `dirname $0`/common.awk -f `dirname $0`/connector.awk -v "args=$*" - Property changes on: pcblib-param/connector ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: pcblib-param/connector.awk =================================================================== --- pcblib-param/connector.awk (revision 293) +++ pcblib-param/connector.awk (nonexistent) @@ -1,74 +0,0 @@ -BEGIN { - - proc_args(P, "nx,ny,spacing,silkmark,eshift,etrunc", "nx,ny") - - set_arg(P, "?spacing", 100) - set_arg(P, "?silkmark", "square") - - - 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 - - eshift=tolower(P["eshift"]) - etrunc=tolower(P["etrunc"]) - if ((eshift != "x") && (eshift != "y") && (eshift != "")) - error("eshift must be x or y (got: ", eshift ")"); - - element_begin(P["spacing"] " mil connector", "CONN1", P["nx"] "*" P["ny"] ,0,0, 0, -step) - - 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 - } - element_pin(x * step + xo, y * step + yo) - } - } - - xo = 0 - yo = 0 - if (!etrunc) { - if (eshift == "y") - xo = step/2 - if (eshift == "x") - yo = step/2 - } - - element_rectangle(-half, -half, P["nx"] * step - half + xo, P["ny"] * step - half + yo) - - if (P["silkmark"] == "angled") { - element_line(0, -half, -half, 0) - } - else if (P["silkmark"] == "square") { - element_line(-half, half, half, half) - element_line(half, -half, half, half) - } - else if (P["silkmark"] == "external") { - element_line(-half, 0, -step, -half/2) - element_line(-half, 0, -step, +half/2) - element_line(-step, -half/2, -step, +half/2) - } - else if ((P["silkmark"] != "none") && (P["silkmark"] != "")) { - error("invalid silkmark parameter: " P["silkmark"]) - } - - element_end() -} Index: pcblib-param/dip =================================================================== --- pcblib-param/dip (revision 293) +++ pcblib-param/dip (nonexistent) @@ -1,17 +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 (in mil, or in mm using the mm suffix; optional, default is 100 mil) - -#@@include common.awk - -awk -f `dirname $0`/common.awk -f `dirname $0`/dip.awk -v "args=$*" - Property changes on: pcblib-param/dip ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: pcblib-param/dip.awk =================================================================== --- pcblib-param/dip.awk (revision 293) +++ pcblib-param/dip.awk (nonexistent) @@ -1,24 +0,0 @@ -BEGIN { - proc_args(P, "n,spacing", "n") - - set_arg(P, "?spacing", 300) - - 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"]) - - element_begin(P["n"] "*" P["spacing"] " DIP socket", "U1", P["n"] "*" P["spacing"] ,0,0, 0, mil(-100)) - - half = mil(50) - - 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) - } - - dip_outline(-half, -half, spacing + half , (n-2) * mil(100) + half, half) - - element_end() -} Index: pcblib/parametric/common.awk =================================================================== --- pcblib/parametric/common.awk (nonexistent) +++ pcblib/parametric/common.awk (revision 294) @@ -0,0 +1,247 @@ +#@@param:pin_ringdia pin's copper ring (annulus) diameter (in mil by default, mm suffix can be used) +#@@param:pin_clearance pin's copper clearance diameter (in mil by default, mm suffix can be used) +#@@param:pin_mask copper pin's solder mask diameter (in mil by default, mm suffix can be used) +#@@param:pin_drill copper pin's drill diameter (in mil by default, mm suffix can be used) +#@@param:line_thickness silk line thickness (in mil by default, mm suffix can be used) + +BEGIN { + q="\"" + + DEFAULT["pin_ringdia"] = 8000 + DEFAULT["pin_ringdia", "dim"] = 1 + + DEFAULT["pin_clearance"] = 5000 + DEFAULT["pin_clearance", "dim"] = 1 + + DEFAULT["pin_mask"] = 8600 + DEFAULT["pin_mask", "dim"] = 1 + + DEFAULT["pin_drill"] = 3937 + DEFAULT["pin_drill", "dim"] = 1 + + DEFAULT["line_thickness"] = 1500 + DEFAULT["line_thickness", "dim"] = 1 + + DEFAULT["pad_thickness"] = 2000 + DEFAULT["pad_thickness", "dim"] = 1 + DEFAULT["pad_clearance"] = 1000 + DEFAULT["pad_clearance", "dim"] = 1 + DEFAULT["pad_mask"] = 3000 + DEFAULT["pad_mask", "dim"] = 1 + + DEFAULT["pin_flags"] = "__auto" + + s_default=1 + s_weak=2 + s_explicit=3 +} + +# 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 +} + +# generate an element header line; any argument may be empty +function element_begin(desc, name, value, cent_x, cent_y, text_x, text_y, text_dir, text_scale) +{ + print "Element[" q q, q desc q, q name q, q value q, + int(either(cent_x, 0)), int(either(cent_y, 0)), + int(either(text_x, 0)), int(either(text_y, 0)), + int(either(text_dir, 0)), int(either(text_scale, 100)), q q "]" + print "(" +} + +# generate an element footer line +function element_end() +{ + print ")" +} + +# generate a pin; arguments from ringdia are optional (defaults are in global vars pin_*) +function element_pin(x, y, number, flags, ringdia, clearance, mask, drill, name) +{ + if (number == "") + number = ++pin_number + + flags = either(flags, DEFAULT["pin_flags"]) + + if (flags == "__auto") { + if (number == 1) + flags = "square" + else + flags = "" + } + + print " Pin[" int(x), int(y), + int(either(ringdia, DEFAULT["pin_ringdia"])), int(either(clearance, DEFAULT["pin_clearance"])), int(either(mask, DEFAULT["pin_mask"])), + int(either(drill, DEFAULT["pin_drill"])), q name q, q number q, q flags q "]" +} + +# draw element pad +function element_pad(x1, y1, x2, y2, thickness, number, flags, clearance, mask, name) +{ + print " Pad[", int(x1), int(y1), int(x2), int(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 a line on silk; thickness is optional (default: line_thickness) +function element_line(x1, y1, x2, y2, thickness) +{ + print " ElementLine[" int(x1), int(y1), int(x2), int(y2), int(either(thickness, DEFAULT["line_thickness"])) "]" +} + +# draw a rectangle of silk lines +function element_rectangle(x1, y1, x2, y2, omit, thickness) +{ + if (!(omit ~ "left")) + element_line(x1, y1, x1, y2, thickness) + if (!(omit ~ "top")) + element_line(x1, y1, x2, y1, thickness) + if (!(omit ~ "right")) + element_line(x2, y2, x1, y2, thickness) + if (!(omit ~ "bottom")) + element_line(x2, y2, x2, y1, thickness) +} + +# draw a line on silk; thickness is optional (default: line_thickness) +function element_arc(cx, cy, rx, ry, a_start, a_delta, thickness) +{ + print " ElementArc[" int(cx), int(cy), int(rx), int(ry), int(a_start), int(a_delta), int(either(thickness, DEFAULT["line_thickness"])) "]" +} + + +# convert coord given in mils to footprint units +function mil(coord) +{ + return coord * 100 +} + +# convert coord given in mm to footprint units +function mm(coord) +{ + return coord*3937 +} + + +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"]) { + if (value ~ "mm") + value = mm(value) + else + value = mil(value) + } + 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++) { + if (A[n] ~ "=") { +# named + key=strip(A[n]) + val=strip(A[n]) + sub("=.*", "", key) + sub("^[^=]*=", "", val) + set_arg(OUT, key, val, s_explicit) + } + else { +# positional + A[n] = strip(A[n]) + if (N[pos] == "") { + error("too many positional arguments at " A[n]) + } + while(N[pos] in OUT) 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 + } + } +} + +# Assume h is a dimension; if it has an "mm" suffix, convert it from mm, +# else convert it from mil. +function parse_dim(h) +{ + if (h ~ "mm") { + sub("mm", "", h) + return mm(h) + } + return mil(h) +} + +# 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(x1, y1, x2, y2, arcr ,xhalf) +{ + if (xhalf == "") + xhalf=(x1+x2)/2 + + element_rectangle(x1, y1, x2, y2, "top") + element_line(x1, y1, xhalf-arcr, y1) + element_line(xhalf+arcr, y1, x2, y1) + + element_arc(xhalf, y1, arcr, arcr, 0, 180) +} Index: pcblib/parametric/connector =================================================================== --- pcblib/parametric/connector (nonexistent) +++ pcblib/parametric/connector (revision 294) @@ -0,0 +1,23 @@ +#!/bin/sh + +#@@example connector(2, 3, silkmark=external) + +#@@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 (mandatory, no default) +#@@param:ny number of pins in the Y direction (mandatory, no default) +#@@param:spacing spacing between the pins (in mil, or in mm using the mm suffix; optional, default is 100 mil) +#@@param:silkmark how to mark pin 1; values: square, external, angled, none (optional; default is square) +#@@param:eshift shift even rows or columns by half spacing; values: x (shift columns), y (shift rows) (optional; default: don't shift) +#@@param:etrunc truncate the last pin of a shifted row or column (optional boolean, defaults to false) + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/connector.awk -v "args=$*" + Property changes on: pcblib/parametric/connector ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: pcblib/parametric/connector.awk =================================================================== --- pcblib/parametric/connector.awk (nonexistent) +++ pcblib/parametric/connector.awk (revision 294) @@ -0,0 +1,74 @@ +BEGIN { + + proc_args(P, "nx,ny,spacing,silkmark,eshift,etrunc", "nx,ny") + + set_arg(P, "?spacing", 100) + set_arg(P, "?silkmark", "square") + + + 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 + + eshift=tolower(P["eshift"]) + etrunc=tolower(P["etrunc"]) + if ((eshift != "x") && (eshift != "y") && (eshift != "")) + error("eshift must be x or y (got: ", eshift ")"); + + element_begin(P["spacing"] " mil connector", "CONN1", P["nx"] "*" P["ny"] ,0,0, 0, -step) + + 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 + } + element_pin(x * step + xo, y * step + yo) + } + } + + xo = 0 + yo = 0 + if (!etrunc) { + if (eshift == "y") + xo = step/2 + if (eshift == "x") + yo = step/2 + } + + element_rectangle(-half, -half, P["nx"] * step - half + xo, P["ny"] * step - half + yo) + + if (P["silkmark"] == "angled") { + element_line(0, -half, -half, 0) + } + else if (P["silkmark"] == "square") { + element_line(-half, half, half, half) + element_line(half, -half, half, half) + } + else if (P["silkmark"] == "external") { + element_line(-half, 0, -step, -half/2) + element_line(-half, 0, -step, +half/2) + element_line(-step, -half/2, -step, +half/2) + } + else if ((P["silkmark"] != "none") && (P["silkmark"] != "")) { + error("invalid silkmark parameter: " P["silkmark"]) + } + + element_end() +} Index: pcblib/parametric/dip =================================================================== --- pcblib/parametric/dip (nonexistent) +++ pcblib/parametric/dip (revision 294) @@ -0,0 +1,17 @@ +#!/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 (in mil, or in mm using the mm suffix; optional, default is 100 mil) + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/dip.awk -v "args=$*" + Property changes on: pcblib/parametric/dip ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: pcblib/parametric/dip.awk =================================================================== --- pcblib/parametric/dip.awk (nonexistent) +++ pcblib/parametric/dip.awk (revision 294) @@ -0,0 +1,24 @@ +BEGIN { + proc_args(P, "n,spacing", "n") + + set_arg(P, "?spacing", 300) + + 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"]) + + element_begin(P["n"] "*" P["spacing"] " DIP socket", "U1", P["n"] "*" P["spacing"] ,0,0, 0, mil(-100)) + + half = mil(50) + + 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) + } + + dip_outline(-half, -half, spacing + half , (n-2) * mil(100) + half, half) + + element_end() +} Index: pcblib/parametric/so =================================================================== --- pcblib/parametric/so (nonexistent) +++ pcblib/parametric/so (revision 294) @@ -0,0 +1,20 @@ +#!/bin/sh + +#@@example so(14) + +#@@purpose Generate classic DIP 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 (in mil, or in mm using the mm suffix; optional, default is 250 mil) +#@@param:pad_spacing spacing between the centerline of two pads (in mil, or in mm using the mm suffix; optional, default is 50 mil) +#@@param:ext_bloat how much longer the pad should extend outwards from the end-point of the pin (in mil, or in mm using the mm suffix; optional) +#@@param:int_bloat how much longer the pad should extend inwards from the end-point of the pin (in mil, or in mm using the mm suffix; optional) + +#@@include common.awk + +awk -f `dirname $0`/common.awk -f `dirname $0`/so.awk -v "args=$*" + Property changes on: pcblib/parametric/so ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: pcblib/parametric/so.awk =================================================================== --- pcblib/parametric/so.awk (nonexistent) +++ pcblib/parametric/so.awk (revision 294) @@ -0,0 +1,33 @@ +BEGIN { + proc_args(P, "n,row_spacing,pad_spacing,ext_bloat,int_bloat", "n") + + set_arg(P, "?row_spacing", 250) + set_arg(P, "?pad_spacing", 50) + set_arg(P, "?ext_bloat", 10) + set_arg(P, "?int_bloat", 55) + + 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"]) + + element_begin(P["n"] "*" P["row_spacing"] " DIP socket", "U1", P["n"] "*" P["row_spacing"] ,0,0, 0, mil(-100)) + + 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") + } + + silk_dist = pad_spacing/2 + rarc = pad_spacing/2 + + dip_outline(-silk_dist-ext_bloat, -silk_dist, row_spacing + silk_dist+ext_bloat , (n-2) * pad_spacing + silk_dist, rarc) + + + element_end() +}