예제 #1
0
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
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
    can.drawString(1.25 * inch, H + .25 * inch, fontname)

    if reverse:
        can.translate(9 * inch, 0 * inch)
        can.scale(-1, 1)

    ldr_x = 48.8 * mm + 1 * inch
    ldr_y = 9 * inch - 6.38 * mm
    ldr_r = 2.5 * mm
    # can.circle(ldr_x, ldr_y, ldr_r, fill=True) # ldr

    can.setLineWidth(1)
    margin = 10 * mm
    letter_bbox = (XS[0], YS[0], XS[-1] - XS[0] + DX, YS[-1] - YS[0] + DY)
    bbox = (0, 0, W, H)
    faceplate = MyPath()
    # faceplate.rect(bbox)

    backplate = MyPath()
    backplate.rect(bbox)
    keyhole = Keyhole()
    backplate.route(keyhole)
    keyhole.translate((9 - .75 - .75) * inch, 0 * inch)
    backplate.route(keyhole)

    pcb_bbox = (0, 0, PCB_W, PCB_H)
    pcb = MyPath()
    pcb.rect(pcb_bbox)

    W = DX * 12 + 2 * inch
    H = DY * 12 + 5 * inch