def __init__(self): MyPath.__init__(self) Center = 0.75 * inch, 7.5 * inch # larger keyhole circle center center = 0.75 * inch, 7.875 * inch # smaller keyhole circle center r = .125 * inch # smaller keyhole circle radius R = .25 * inch # larger keyhole circle radius phi = arcsin(r/R) start = Center[0] + R * cos(pi/2 + phi), Center[1] + R * sin(pi/2 + phi) self.moveTo(*start) for theta in arange(pi/2 + phi, 2 * pi + pi / 2 - phi +DTHETA*DEG/2, DTHETA * DEG): next = Center[0] + R * cos(theta), Center[1] + R * sin(theta) self.lineTo(*next) for theta in arange(0, pi, DTHETA * DEG): next = center[0] + r * cos(theta), center[1] + r * sin(theta) self.lineTo(*next) self.lineTo(*start)
def __init__(self): MyPath.__init__(self) Center = 0.75 * inch, 7.5 * inch # larger keyhole circle center center = 0.75 * inch, 7.875 * inch # smaller keyhole circle center r = .125 * inch # smaller keyhole circle radius R = .25 * inch # larger keyhole circle radius phi = arcsin(r / R) start = Center[0] + R * cos(pi / 2 + phi), Center[1] + R * sin(pi / 2 + phi) self.moveTo(*start) for theta in arange(pi / 2 + phi, 2 * pi + pi / 2 - phi + DTHETA * DEG / 2, DTHETA * DEG): next = Center[0] + R * cos(theta), Center[1] + R * sin(theta) self.lineTo(*next) for theta in arange(0, pi, DTHETA * DEG): next = center[0] + r * cos(theta), center[1] + r * sin(theta) self.lineTo(*next) self.lineTo(*start)
def draw(filename, data, fontname='Times-Roman', images=[], fontsize= DEFAULT_FONT_SIZE, reverse=False, case=string.upper, seven_seg=False, ): PCB_W = (11.3) * inch PCB_H = (14 + 7./8) *inch H = 16 * inch W = 11.75 * inch W = 11.324 * inch H = 16 * inch W = 16 * inch PAGE_MARGIN = 1*inch can = canvas.Canvas(filename, pagesize=(W + 2 * PAGE_MARGIN, H + 2 * PAGE_MARGIN)) can.translate(1.5 * inch + dx, 1 * inch) ## PCB Lower left is origen data = [[case(char) for char in line] for line in data] YS = arange(N_ROW) * DY + (3 + 7/16.) * inch + dy / 4 XS = arange(N_COL) * DX ys = arange(n_row) * dy + (3 + 7/16.) * inch xs = arange(n_col) * dx + dx/2 for x in xs[:-1]: for y in ys[:1]: # can.circle(x, y, 2.5 * mm, fill=False) pass for x in xs: for y in ys: # can.circle(x, y, 2.5 * mm, fill=False) pass led_xs = XS + DX / 2. led_ys = YS + DY / 2. can.setTitle("Peggy2 Faceplate: %s" % fontname) can.setFont(fontname, 15) can.drawCentredString(4.5 * inch, -.75* inch, 'Peggy2 Faceplate, %s, 0.25" Painted/Etched Acrylic' % fontname) # can.setFont(fontname, 80) # can.drawCentredString(PCB_W/2, 1.5 * inch, 'Peggy2.0') can.setFont(fontname, fontsize) # label font 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 # can.circle(XS[-1] + 1 * DX + 1 * inch, YS[0], DX * 1.3) # can.circle(XS[0] - 1 * inch, YS[0], DX * 1.3) # can.circle(W / 2, H, 1 * inch) # can.circle(W / 2, H -.5 * inch, 1 * inch) # can.circle(W / 2, -.5 * inch, 4 * inch) bbox = (XS[0] - 1 * inch, 0 * inch, W, H) edge = MyPath() edge.rect(bbox) edge.drawOn(can, 1) ################################################################################ encName = 'winansi' decoder = codecs.lookup(encName)[1] def decodeFunc(txt): if txt is None: return ' ' else: return case(decoder(txt, errors='replace')[0]) data = [[decodeFunc(case(char)) for char in line] for line in data] ################################################################################ for y, l in zip(YS + DY * .27, data[::-1]): for x, c in zip(XS + DX / 2., l): can.drawCentredString(x, y, c) can.drawCentredString(XS[-2] + DX/2, YS[1] + DY/4, decodeFunc(chr(186) + 'C')) can.drawCentredString(XS[-1] + DX/2, YS[1] + DY/4, decodeFunc(chr(186) + 'F')) can.drawCentredString(XS[6] + DX * .6, YS[4] + DY * .3, "o'") for x in xs[:-1]: can.drawCentredString(x, ys[0] - .41* inch, decodeFunc(chr(186))) mount_r = 1.8 * mm magnet_r = 6 * mm pcb_mounts = array([[ 1. * inch / 4, 1. * inch / 4], [PCB_W - 1. * inch / 4, 1. * inch / 4], [PCB_W - 1. * inch / 4, PCB_H - 1. * inch / 4], [ 1. * inch / 4, PCB_H - 1. * inch / 4] ]) fp_mounts = array([[ - 1. * inch / 2, 1. * inch / 4], [PCB_W - 1. * inch / 4, 1. * inch / 4], [PCB_W - 1. * inch / 4, H - 1. * inch / 2], [ 1. * inch / 4, H - 1. * inch / 2] ]) for x, y in fp_mounts: pcb.drill(x, y, mount_r) pcb.drill(x, y, magnet_r) backplate.drill(x, y, mount_r) for x, y in pcb_mounts: pcb.drill(x, y, mount_r) backplate.drill(x, y, mount_r) pcb.drawOn(can, 1) faceplate.drawOn(can) can.showPage() can.save() print 'wrote', filename
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 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_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 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
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