def create_baffle(baffle_height, baffle_thickness, n_notch, delta, overhang=0, overhang_height=None, overhang_taper=False, margin=MARGIN): ''' delta = DX/DY overhang = amount of extra plastic from center of last notch overhang_height = height of overhang. if None, baffle_height margin = extra gap for slots ''' if overhang_height is None: overhang_height = baffle_height p = MyPath() p.moveTo(0, 0) if overhang > 0: p.lineTo(-overhang, 0) if overhang_taper: p.lineTo(-overhang, overhang_height/2) else: p.lineTo(-overhang, overhang_height) p.lineTo(-baffle_thickness / 2. - margin, overhang_height) p.lineTo(-baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo(0, baffle_height / 2 - margin) for i in range(n_notch): p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height / 2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo((i + 1) * delta, baffle_height / 2 - margin) if overhang > 0: p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, baffle_height / 2 - margin) p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, overhang_height) if overhang_taper: p.lineTo(n_notch * delta + overhang, overhang_height/2) else: p.lineTo(n_notch * delta + overhang, overhang_height) p.lineTo(n_notch * delta + overhang, 0) p.lineTo(n_notch * delta, 0) p.lineTo(0, 0) return p
def x30_v_baffle(baffle_height, baffle_thickness, n_notch, delta, overhangs=(0,0), overhang_heights=(None,None), overhang_tapers=(False, False), margin=MARGIN, skip_notches=()): ''' delta = DX/DY overhangs = amount of extra plastic from center of last notch overhang_heights = height of overhang. if None, baffle_height overhang_tapers = straight~False, tapered~True, margin = extra gap for slots ''' overhang_heights = list(overhang_heights) for i in range(2): if overhang_heights[i] is None: overhang_heights[i] = baffle_height p = MyPath() p.moveTo(0, 0) p.lineTo(-overhangs[0], 0) p.lineTo(-overhangs[0], baffle_height + BOARD_THICKNESS) p.lineTo(-baffle_thickness / 2. - margin, baffle_height + BOARD_THICKNESS) for i in range(n_notch - 1): p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) ## do last notch i = n_notch - 1 p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) # do last taper p.lineTo(i * delta + baffle_thickness / 2 + margin, baffle_height + BOARD_THICKNESS) if overhang_tapers[1]: p.lineTo((n_notch - 1) * delta + overhangs[1], overhang_heights[1]/2) else: p.lineTo((n_notch - 1) * delta + overhangs[1], overhang_heights[1] + BOARD_THICKNESS) p.lineTo((n_notch - 1) * delta + overhangs[1], 0) p.lineTo((n_notch - 1) * delta, 0) p.lineTo(0, 0) return p
def asym_baffle(baffle_height, baffle_thickness, n_notch, delta, overhangs=(0,0), overhang_heights=(None,None), overhang_tapers=(False, False), jump_strips=(False), margin=MARGIN): ''' delta = DX/DY overhangs = amount of extra plastic from center of last notch overhang_heights = height of overhang. if None, baffle_height overhang_tapers = straight~False, tapered~True, board_catches = hooks to grab the board and hold the baffle in place. margin = extra gap for slots ''' overhang_heights = list(overhang_heights) for i in range(2): if overhang_heights[i] is None: overhang_heights[i] = baffle_height p = MyPath() p.moveTo(0, 0) if overhangs[0] > 0: p.lineTo(-overhangs[0], 0) if overhang_tapers[0]: p.lineTo(-overhangs[0], overhang_heights[0]/2.) else: p.lineTo(-overhangs[0], overhang_heights[0]) p.lineTo(-baffle_thickness / 2. - margin, overhang_heights[0]) p.lineTo(-baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo(0, baffle_height / 2 - margin) for i in range(n_notch): p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height / 2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo((i + 1) * delta, baffle_height / 2 - margin) if overhangs[1] > 0: p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, baffle_height / 2 - margin) p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, overhang_heights[1]) if overhang_tapers[1]: p.lineTo(n_notch * delta + overhangs[1], overhang_heights[1]/2) else: p.lineTo(n_notch * delta + overhangs[1], overhang_heights[1]) p.lineTo(n_notch * delta + overhangs[1], 0) p.lineTo(n_notch * delta, 0) if jump_strips: for i in range(n_notch): p.lineTo( (n_notch * delta) - ((i+1)* delta - (delta / 2)) + 5.1 * mm, 0) p.lineTo( (n_notch * delta) - ((i+1)* delta - (delta / 2)) + 5.1 * mm, 1 * mm) p.lineTo( (n_notch * delta) - ((i+1)* delta - (delta / 2)) - 5.1 * mm, 1 * mm) p.lineTo( (n_notch * delta) - ((i+1)* delta - (delta / 2)) - 5.1 * mm, 0) p.lineTo( (n_notch * delta) - ((i+1) * delta), 0) p.lineTo(0, 0) return p
def x30_h_baffle(baffle_height, baffle_thickness, n_notch, delta, overhangs=(0,0), overhang_heights=(None,None), overhang_tapers=(False, False), board_hooks=(False, False), board_hooks_up=False, margin=MARGIN, skip_notches=()): ''' delta = DX/DY overhangs = amount of extra plastic from center of last notch overhang_heights = height of overhang. if None, baffle_height overhang_tapers = straight~False, tapered~True, board_hooks = hooks to grab the board and hold the baffle in place. margin = extra gap for slots ''' overhang_heights = list(overhang_heights) for i in range(2): if overhang_heights[i] is None: overhang_heights[i] = baffle_height p = MyPath() p.moveTo(0, 0) if overhangs[0] > 0: if board_hooks[0]: if not board_hooks_up: ## h baffles p.lineTo(-0.25 * mm, 0) p.lineTo(-0.25 * mm, -BOARD_THICKNESS) p.lineTo( - board_hooks[0], -BOARD_THICKNESS) p.lineTo( - board_hooks[0], baffle_height) p.lineTo(-overhangs[0], baffle_height) else: p.lineTo(-overhangs[0], overhang_heights[0]) p.lineTo(-baffle_thickness / 2. - margin, overhang_heights[0]) for i in range(n_notch - 1): if i in skip_notches: p.lineTo((i + 0) * delta, baffle_height) else: p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) if n_notch - 1 not in skip_notches: ## do last notch i = n_notch - 1 p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) if overhangs[1] > 0: p.lineTo((n_notch - 1) * delta + baffle_thickness / 2 + margin, baffle_height / 2 - margin) p.lineTo((n_notch - 1) * delta + baffle_thickness / 2 + margin, overhang_heights[1]) if overhang_tapers[1]: p.lineTo((n_notch - 1) * delta + overhangs[1], overhang_heights[1]/2) elif board_hooks[1]: x0 = (n_notch - 1) * delta if not board_hooks_up: p.lineTo(x0 + board_hooks[1], baffle_height) p.lineTo(x0 + board_hooks[1], -BOARD_THICKNESS) p.lineTo(x0 + 0.25 * mm, -BOARD_THICKNESS) p.lineTo(x0 + 0.25 * mm, 0) p.lineTo((n_notch - 1) * delta + MARGIN, 0) p.lineTo((n_notch - 1) * delta + MARGIN, 0) p.lineTo(0, 0) return p
def asym_baffle(baffle_height, baffle_thickness, n_notch, delta, overhangs=(0,0), overhang_heights=(None,None), overhang_tapers=(False, False), board_catches=(False, False), margin=MARGIN): ''' delta = DX/DY overhangs = amount of extra plastic from center of last notch overhang_heights = height of overhang. if None, baffle_height overhang_tapers = straight~False, tapered~True, board_catches = hooks to grab the board and hold the baffle in place. margin = extra gap for slots ''' overhang_heights = list(overhang_heights) for i in range(2): if overhang_heights[i] is None: overhang_heights[i] = baffle_height p = MyPath() p.moveTo(0, 0) if overhangs[0] > 0: p.lineTo(-overhangs[0], 0) if overhang_tapers[0]: p.lineTo(-overhangs[0], overhang_heights[0]/2.) else: p.lineTo(-overhangs[0], overhang_heights[0]) p.lineTo(-baffle_thickness / 2. - margin, overhang_heights[0]) p.lineTo(-baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo(0, baffle_height / 2 - margin) for i in range(n_notch): p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height / 2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo((i + 1) * delta, baffle_height / 2 - margin) if overhangs[1] > 0: p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, baffle_height / 2 - margin) p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, overhang_heights[1]) if overhang_tapers[1]: p.lineTo(n_notch * delta + overhangs[1], overhang_heights[1]/2) else: p.lineTo(n_notch * delta + overhangs[1], overhang_heights[1]) p.lineTo(n_notch * delta + overhangs[1], 0) p.lineTo(n_notch * delta, 0) p.lineTo(0, 0) return p
def c3jr_v_baffle(baffle_height, baffle_thickness, n_notch, delta, overhangs=(0,0), overhang_heights=(None,None), overhang_tapers=(False, False), margin=MARGIN, skip_notches=()): ''' delta = DX/DY overhangs = amount of extra plastic from center of last notch overhang_heights = height of overhang. if None, baffle_height overhang_tapers = straight~False, tapered~True, margin = extra gap for slots ''' overhang_heights = list(overhang_heights) for i in range(2): if overhang_heights[i] is None: overhang_heights[i] = baffle_height p = MyPath() p.moveTo(0, 0) p.lineTo(-overhangs[0], 0) p.lineTo(-overhangs[0], overhang_heights[0]/2.) p.lineTo(-baffle_thickness / 2. - margin, overhang_heights[0] * 3/4.) for i in range(n_notch - 1): p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) ## do last notch i = n_notch - 1 p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) # do last taper p.lineTo(i * delta + baffle_thickness / 2 + margin, overhang_heights[1] * 3 / 4.) if overhang_tapers[1]: p.lineTo((n_notch - 1) * delta + overhangs[1], overhang_heights[1]/2) else: p.lineTo((n_notch - 1) * delta + overhangs[1], overhang_heights[1]) p.lineTo((n_notch - 1) * delta + overhangs[1], 0) p.lineTo((n_notch - 1) * delta, 0) p.lineTo(0, 0) return p
def c3jr_h_baffle(baffle_height, baffle_thickness, n_notch, delta, overhangs=(0,0), overhang_heights=(None,None), overhang_tapers=(False, False), board_hooks=(False, False), board_hooks_up=False, margin=MARGIN, skip_notches=()): ''' delta = DX/DY overhangs = amount of extra plastic from center of last notch overhang_heights = height of overhang. if None, baffle_height overhang_tapers = straight~False, tapered~True, board_hooks = hooks to grab the board and hold the baffle in place. margin = extra gap for slots ''' overhang_heights = list(overhang_heights) for i in range(2): if overhang_heights[i] is None: overhang_heights[i] = baffle_height p = MyPath() p.moveTo(0, 0) if overhangs[0] > 0: if board_hooks[0]: if not board_hooks_up: ## h baffles p.lineTo(-0.25 * mm, 0) p.lineTo(-0.25 * mm, -BOARD_THICKNESS) p.lineTo( - board_hooks[0], -BOARD_THICKNESS) p.lineTo( - board_hooks[0], baffle_height) p.lineTo(-overhangs[0], baffle_height) else: p.lineTo(-overhangs[0], overhang_heights[0]) p.lineTo(-baffle_thickness / 2. - margin, overhang_heights[0]) for i in range(n_notch - 1): if i in skip_notches: p.lineTo((i + 0) * delta, baffle_height) else: p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) if n_notch - 1 not in skip_notches: ## do last notch i = n_notch - 1 p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo(i * delta - baffle_thickness / 2. - margin, baffle_height/2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height/2 - margin) if overhangs[1] > 0: p.lineTo((n_notch - 1) * delta + baffle_thickness / 2 + margin, baffle_height / 2 - margin) p.lineTo((n_notch - 1) * delta + baffle_thickness / 2 + margin, overhang_heights[1]) if overhang_tapers[1]: p.lineTo((n_notch - 1) * delta + overhangs[1], overhang_heights[1]/2) elif board_hooks[1]: x0 = (n_notch - 1) * delta if not board_hooks_up: p.lineTo(x0 + board_hooks[1], baffle_height) p.lineTo(x0 + board_hooks[1], -BOARD_THICKNESS) p.lineTo(x0 + 0.25 * mm, -BOARD_THICKNESS) p.lineTo(x0 + 0.25 * mm, 0) p.lineTo((n_notch - 1) * delta + MARGIN, 0) p.lineTo((n_notch - 1) * delta + MARGIN, 0) p.lineTo(0, 0) return p
def create_baffle(baffle_height, baffle_thickness, n_notch, delta, overhang=0, overhang_height=None, overhang_taper=False, margin=MARGIN): ''' delta = DX/DY overhang = amount of extra plastic from center of last notch overhang_height = height of overhang. if None, baffle_height margin = extra gap for slots ''' if overhang_height is None: overhang_height = baffle_height p = MyPath() p.moveTo(0, 0) if overhang > 0: p.lineTo(-overhang, 0) if overhang_taper: p.lineTo(-overhang, overhang_height / 2) else: p.lineTo(-overhang, overhang_height) p.lineTo(-baffle_thickness / 2. - margin, overhang_height) p.lineTo(-baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo(0, baffle_height / 2 - margin) for i in range(n_notch): p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height / 2 - margin) p.lineTo(i * delta + baffle_thickness / 2. + margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height) p.lineTo((i + 1) * delta - baffle_thickness / 2. - margin, baffle_height / 2 - margin) p.lineTo((i + 1) * delta, baffle_height / 2 - margin) if overhang > 0: p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, baffle_height / 2 - margin) p.lineTo(n_notch * delta + baffle_thickness / 2 + margin, overhang_height) if overhang_taper: p.lineTo(n_notch * delta + overhang, overhang_height / 2) else: p.lineTo(n_notch * delta + overhang, overhang_height) p.lineTo(n_notch * delta + overhang, 0) p.lineTo(n_notch * delta, 0) p.lineTo(0, 0) return p