def wire_clip_bar(length, awg, direction='', center=False): size = [length, 2, 2] x = size[0] y = size[1] z = size[2] assembly = translate([0, 0, awg + 0.5])(rotate( [0, 90, 0])(translate([-(length / 2 + 1) / 2, 0, 0])(cube([length / 2 - 1, 2, 2], center=True)) + translate([(length / 2 + 1) / 2, 0, 0])(cube([length / 2 - 1, 2, 2], center=True)))) rotation = bh.spin(direction) if not center: translation = bh.origin(*size, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': size[0], 'width': size[1], 'height': size[2] })
def fan_opening_30mmx30mm_covered(direction='', wall=2, center=False, _test=True): opening = fan_opening_30mmx30mm_open(direction='', wall=wall, center=center, _test=_test) assembly = (opening.assembly - hole()(cube([30, 2, wall], center=True) + cube([2, 30, wall], center=True) + cylinder(d=10, h=wall, center=True))) size = [opening.length, opening.width, opening.height] rotation = bh.spin(direction) if not center: translation = bh.origin(size[0], size[1], -size[2], direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': size[0], 'width': size[1], 'height': size[2] })
def zip_tie_clip(direction='', space=2, size=(10, 2, 2), center=False): """ direction: orientation of container first letter is direction of top, second is direction of face, any combination of x, y, z space: space from base to bottom of ring size: 0 - diameter of ring; 1 - ring thickness; 2 ring width center: set True to not offset assembly to the origin/direction returns DotMap containing assembly and information about the assembly, use zip_tie_clip().assembly to access object """ x = size[0] y = size[1] z = size[2] #assembly = translate([0, -(x-y)/2 + space, 0])(cylinder(d=x, h=z, center=True) - cylinder(d=x-y, h=z+EPSILON, center=True) # ) - translate([0, -x/2, 0])(cube([x, x, z+EPSILON], center=True)) assembly = cube([x, y + space, z], center=True) - color('green')(translate( [0, -y / 2, 0])(cube([x - y * 2, space, z + EPSILON], center=True))) rotation = bh.spin(direction) if not center: translation = bh.origin(x, y + space, z, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': x, 'width': y, 'height': z })
def shelf_rail(direction='', size=(2, 5, 100), center=False): """ direction: orientation of container first letter is direction of top, second is direction of face, any combination of x, y, z size: 0 - length; 1 - height; 2 - thickness center: set True to not offset assembly to the origin/direction returns DotMap containing assembly and information about the assembly, use shelf_rail().assembly to access object """ x = size[0] # rail thickness y = size[1] # rail width z = size[2] # rail length assembly = cube([x, y, z], center=True) + translate([0, y / 2, 0])(rotate( [0, 0, 0])(cylinder(d=x, h=z, center=True))) rotation = bh.spin(direction) if not center: translation = bh.origin(x, y, z, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': x, 'width': y, 'height': z })
def wire_clip_above(awg, direction='', count=4, center=False, thickness=2, spacing=0.6): """ Clip to hold wire to casing, etc. awg: wire gauge size mm direction: orientation of clip first letter is direction of top, second is direction of face, any combination of x, y, z count: number of clips in strip center: set True to not offset assembly to the origin/direction thickness: thickness of clip returns DotMap containing assembly and information about the assembly, use wire_clip().assembly to access object """ clip_height = 3 # height of clip x = clip_height + spacing y = clip_height z = thickness assembly = [] for c in range(count): shift = c * x - x / 2 * (count - 1) assembly.append( translate([shift, 0, -(2 - awg / 2) / 2 ])(translate([0, 0, 1])(cube([x, z, 2], center=True)) - rotate([90, 0, 0])(translate([0, 0, 0])(cylinder( d=awg, h=z + EPSILON * 2, center=True))))) size = [x * count, z, 2 + awg / 2] rotation = bh.spin(direction) if not center: translation = bh.origin(*size, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': size[0], 'width': size[1], 'height': size[2] })
def fan_opening_30mmx30mm_open(direction='', wall=2, center=False, _test=True): """ Full opening for 30mm x 30 mm fan direction: orientation of fan holes first letter is direction of if opening (outward face), second is the wall orientation (i.e. z for vertical wall), any combination of x, y, z wall: thickness of wall the hole will be cut into center: set True to not offset assembly to the origin/direction _test: set True to draw a cube to better visualize the hole configuration, for testing only, do not change returns DotMap containing assembly and information about the assembly, use fan_opening_30mm_form1().assembly to access object """ size = [30, 30, 2] spacing = 12 assembly = [] fan_screw_hole = screw_hole(hole_size=M3, length=wall, countersink_top=True, hole_top_length=-1.7) if _test: assembly.append(cube([35, 35, wall], center=True)) assembly.append( color('green')( hole()(cylinder(d=28, h=wall + EPSILON * 2, center=True)) + translate([-spacing, spacing, 0]) (fan_screw_hole) + # fan mount holes translate([-spacing, -spacing, 0])(fan_screw_hole) + translate([spacing, spacing, 0])(fan_screw_hole) + translate([spacing, -spacing, 0])(fan_screw_hole))) rotation = bh.spin(direction) if not center: translation = bh.origin(size[0], size[1], -size[2], direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': size[0], 'width': size[1], 'height': size[2] })
def support_bar_chamfer(direction='', size=(17.5, 6, 6), center=False): """ Support for faceplate, panels, etc., inset from edge direction: orientation of bar first letter is direction of top, second is direction of face, any combination of x, y, z size: [length, width, height] center: set True to not offset assembly to the origin/direction returns DotMap containing assembly and information about the assembly, use support_bar_chamfer().assembly to access object """ size = list(size) x = size[0] y = size[1] z = size[2] pt1 = [0, 0] pt2 = [0, y] pt3 = [z / 3, y] pt4 = [z, 0] assembly = rotate([90, 0, 90])(linear_extrude(height=x)(polygon( [pt1, pt2, pt3, pt4]))) assembly = translate([-x / 2, -y / 2, -z / 2])(assembly) rotation = bh.spin(direction) if not center: translation = bh.origin(*size, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': x, 'width': y, 'height': z })
def logo(direction='xz', size=10, depth=1, center=False): """Screw mount with chamfer on one corner direction: orientation of mount first letter is direction of hole, second is direction of face, any combination of x, y, z size: dimensions of the logo depth: depth of the logo in the surface center: set True to not offset assembly to the origin/direction returns DotMap containing assembly and information about the assembly, use screw_mount_chamfer().assembly to access object """ x = size y = size z = depth assembly = color('red')(translate([-x / 2, -y / 2, -z / 2])(resize([x, y])( (linear_extrude(height=z + EPSILON))( import_dxf(file=LIB + 'InfinitycliffLogo.dxf'))))) modification = [1, 1, -1] # if direction in ['xz', '-x-z', 'x-y', 'y-z', 'yx', '-y-x', '-yz' 'z-x', 'zy', '-z-y']: # modification = [-1, 1, 1] rotation = bh.spin(direction) if not center: translation = bh.origin(x, y, z, direction, modification) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': z, 'width': x, 'height': y })
def ender_3_rail(direction='', length=10, center=False): """ V-slot rail for Ender 3 direction: orientation of rail first letter is direction of rail (length), second is the orientation of rail top, any combination of x, y, z length: length of rail center: set True to not offset assembly to the origin/direction returns DotMap containing assembly and information about the assembly, use ender_3_rail().assembly to access object """ x1 = 1.96 x2 = 7.65 x3 = 9.61 y1 = 2.2 y2 = 3.64 y3 = 5.6 size = [x3, y3, length] assembly = rotate([0, 0, 0])(translate([-x3 / 2, -y3 / 2, -length / 2])( linear_extrude(height=length)(polygon([[x1, 0], [x1, y1], [0, y1], [0, y2], [x1, y3], [x2, y3], [x3, y2], [x3, y1], [x2, y1], [x2, 0]])))) rotation = bh.spin(direction) if not center: translation = bh.origin(*size, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': size[0], 'width': size[1], 'height': size[2] })
def ender_3_dual_rail(direction='', length=10, center=False): """ Dual V-slot rail for Ender 3 direction: orientation of rail first letter is direction of rail (length), second is the orientation of rail top, any combination of x, y, z length: length of rail center: set True to not offset assembly to the origin/direction returns DotMap containing assembly and information about the assembly, use ender_3_dual_rail().assembly to access object """ RAIL_SEPARATION = 20 rail = ender_3_rail(direction='', length=length, center=center) assembly = translate( [-RAIL_SEPARATION / 2, 0, 0])(rail.assembly + translate([RAIL_SEPARATION, 0, 0])(rail.assembly)) size = [rail.length * 2 + 20 - rail.length, rail.width, rail.height] rotation = bh.spin(direction) if not center: translation = bh.origin(*size, direction) else: translation = [0, 0, 0] return DotMap({ 'assembly': rotate(rotation)(translate(translation)(assembly)), 'length': size[0], 'width': size[1], 'height': size[2] })