Index: bug_files/TODO/brickhole =================================================================== --- bug_files/TODO/brickhole (nonexistent) +++ bug_files/TODO/brickhole (revision 37278) @@ -0,0 +1,24 @@ +#!/bin/sh + +#@@example brickhole(1, 3, fill:corners, spacing:axle) + +#@@purpose stud and axle spaced mounting holes. + +#@@desc Generate a hole or holes to suit Danish brick stud or axle spacing +#@@params nx,ny,fill,spacing + +#@@param:nx number of holes in x direction +#@@param:ny number of holes in y direction +#@@param:fill place holes in corners or in grid +#@@enum:fill:grid place holes in nx * ny grid +#@@enum:fill:corners place holes in corners only +#@@default:fill corners +#@@preview_args:fill 3,3 + +#@@param:spacing space holes to suit axle holes or studs +#@@enum:spacing:axle place holes to suit brick axle spacing +#@@enum:spacing:stud place holes to suit brick stud spacing +#@@default:spacing axle +#@@preview_args:spacing 3,3 + +awk -f `dirname $0`/common_subc.awk -f `dirname $0`/brickhole.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0" -v "genfull=$0" Index: bug_files/TODO/brickhole.awk =================================================================== --- bug_files/TODO/brickhole.awk (nonexistent) +++ bug_files/TODO/brickhole.awk (revision 37278) @@ -0,0 +1,55 @@ +BEGIN { + base_unit_mm = 1 + help_auto() + set_arg(P, "?spacing", "axle") + set_arg(P, "?fill", "corners") + proc_args(P, "nx,ny,fill,spacing", "nx,ny") + + spacing = ":" P["spacing"] ":" + + if (spacing ~ ":axle:") { + xstep = 16 + ystep = 9.6 + } else { + xstep = 8 + ystep = 8 + } + + fill = ":" P["fill"] ":" + + if (fill ~ ":grid:") + gridded = 1 + else + gridded = 0 + + subc_begin(P["nx"] "*" P["ny"], "BRICK1", 0, -step) + proto = subc_proto_alloc() + subc_pstk_add_hole(proto, 4.8, 0) + + PROTO_COMMENT[proto] = "# Round non plate through hole 4.8mm" + PROTO[proto] = PROTO[proto] " li:shape {" NL + + mask_dia = pin_mask(4.9, 4.9) + 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 + + P["nx"] = int(P["nx"]) + P["ny"] = int(P["ny"]) + + if (gridded) { + for(x = 0; x < P["nx"]; x++) { + for(y = 0; y < P["ny"]; y++) { + subc_pstk(proto, x*xstep, y*ystep, 0) + } + } + } else { + subc_pstk(proto, 0, 0, 0) + subc_pstk(proto, 0, (P["ny"]-1)*ystep, 0) + subc_pstk(proto, (P["nx"]-1)*xstep, 0, 0) + subc_pstk(proto, (P["nx"]-1)*xstep, (P["ny"]-1)*ystep, 0) + } + + subc_end() +} +