dipole-balun/balun.scad

217 lines
5.1 KiB
OpenSCAD

// Enclosure Width (x)
width=80;
// Enclosure Length (y)
length=80;
// Enclosure Depth (z)
depth=30;
// Wall/Floor thickness
wall=2;
// Cover Screw Diameter (clearance)
cover_screw_diameter=3.5;
// Heat-press insert height
insert_height=5;
// Heat-press insert diameter
insert_diameter=5;
// Diameter of binding posts
pole_clearance=4.5;
// Generate cover model
include_cover = true;
// Choose a radius that ensures adequate wall thickness
radius = max(insert_diameter, cover_screw_diameter) / 2 + wall;
$fn=32;
enclosure(
width = width,
length = length,
depth = depth,
wall = wall,
cover_screw_diameter = cover_screw_diameter,
insert_height = insert_height,
insert_diameter = insert_diameter,
pole_clearance = pole_clearance
);
if (include_cover == true) {
translate([width+10, 0, 0])
enclosure_cover(
width = width,
length = length,
thickness = wall,
radius = radius
);
}
module enclosure_cover(
width,
length,
thickness,
radius,
screw_diameter=3.5,
) {
difference() {
radiused_box(width, length, thickness, radius);
for (i = [[0, 0], [1, 0], [0, 1], [1, 1]]) {
translate([
radius + (i[0]*(width - 2*radius)),
radius + (i[1]*(length - 2*radius)),
0
])
cylinder(r=screw_diameter/2, h=thickness+1);
}
}
}
module enclosure(width, length, depth,
wall = 3,
cover_screw_diameter = 3, // diameter of corner screws (clearance)
insert_height = 0, // height of heat-press insert
insert_diameter = 0, // diameter of heat-press insert
pole_clearance = 4.5 // diameter binding posts for each pole
) {
radius = max(insert_diameter, cover_screw_diameter) / 2 + wall;
// Top
translate([radius, length, 0])
hanging_tab(
width = width-(2*radius),
length = 15,
diameter = 8,
thickness = wall*3
);
difference() {
radiused_box(width, length, depth, radius);
translate([wall, wall, wall])
radiused_box(
width = width-2*wall,
length = length-2*wall,
depth = depth,
radius = radius-wall
);
// SO-239 mount, centered on front
translate([width/2, wall+1, (depth-wall)/2+wall])
rotate([90, 0, 0])
so_239_mount(height=wall+2);
// Binding posts
translate([-1, (2*length)/3, depth/2])
rotate([0, 90, 0])
cylinder(r=pole_clearance/2, h=width+2);
}
// screw bosses in each corner
for (i = [[0, 0], [1, 0], [0, 1], [1, 1]]) {
translate([
radius + (i[0]*(width - 2*radius)),
radius + (i[1]*(length - 2*radius)),
0
])
screw_boss(
radius,
depth,
inner_diameter = cover_screw_diameter,
depth = depth-wall, // not a blind hole, leave a floor thickness
counterbore_depth = insert_height,
counterbore_diameter = insert_diameter
);
}
}
module hanging_tab(
width = 50,
diameter = 5,
length = 10,
thickness = 5
) {
difference() {
union() {
translate([length, 0, 0])
cube([width-(2*length), length, thickness]);
cube([width, length/2, thickness]);
translate([length, length/2, 0])
cylinder(r=length/2, h=thickness);
translate([width-length, length/2, 0])
cylinder(r=length/2, h=thickness);
}
// Round the edges, add a fillet
translate([0, length/2, -1])
cylinder(r=length/2, h=thickness+2);
translate([width, length/2, -1])
cylinder(r=length/2, h=thickness+2);
// Slot
translate([length, length/2, -1])
cylinder(r=diameter/2, h=thickness+2);
translate([width-length, length/2, -1])
cylinder(r=diameter/2, h=thickness+2);
translate([length, (length-diameter)/2, -1])
cube([width-(2*length), diameter, thickness+2]);
}
}
/**
* Describes clearance holes for a SO-239 connector
*/
module so_239_mount(
center_diameter = 15,
bolt_spacing = 18,
bolt_diameter = 3.5,
height = 10
) {
cylinder(r=center_diameter/2, h=height);
for (i = [[-1, 1], [-1, -1], [1, 1], [1, -1]]) {
translate([i[0]*bolt_spacing/2, i[1]*bolt_spacing/2, 0])
cylinder(r=bolt_diameter/2, h=height);
}
}
/**
* Describes a cylinder with a center bore for accepting a screw,
* and a counterbore for a heat-press insert
*/
module screw_boss(
radius,
height,
inner_diameter,
depth,
counterbore_depth=0,
counterbore_diameter=0
) {
difference() {
cylinder(r=radius, h=height);
translate([0, 0, height-depth])
cylinder(r=inner_diameter/2, h=height+depth);
translate([0, 0, height - counterbore_depth])
cylinder(r=counterbore_diameter/2, h=counterbore_depth+1);
}
}
module radiused_box(width, length, depth, radius=0) {
translate([0, radius, 0])
cube([width, length-2*radius, depth]);
translate([radius, 0, 0])
cube([width-2*radius, length, depth]);
translate([radius, radius, 0])
cylinder(r=radius, h=depth);
translate([width-radius, radius, 0])
cylinder(r=radius, h=depth);
translate([radius, length-radius, 0])
cylinder(r=radius, h=depth);
translate([width-radius, length-radius, 0])
cylinder(r=radius, h=depth);
}