def thermal_pad(pad, size, paste_fraction, max_paste_size): paste_x = size[0] * dmath.sqrt(paste_fraction) paste_y = size[1] * dmath.sqrt(paste_fraction) n_x = dmath.ceil(paste_x / max_paste_size) n_y = dmath.ceil(paste_y / max_paste_size) paste_pad = pscad.rounded_square([paste_y / n_y, paste_x / n_x], D("0.05"), center=True) return pscad.union() + ( pscad.row(pscad.rotate(90) + pscad.row(paste_pad, size[1] / n_y, n_y, center=True), size[0] / n_x, n_x, center=True), pscad.nopaste() + pad )
def part(m): m = pscad.wrapper(defaults.items() + m.items()) pad = pscad.square((D("0.70"), D("4.0")), center=True) key_pad = pscad.up(D("0.40")) + pscad.square((D("0.70"), D("3.20")), center=True) mask_dist = D("3.20") - D("2.40") + m.mask mask_pad = pscad.down(D("1.2") - mask_dist / D(2)) + pscad.square((D("0.70"), mask_dist), center=True) mask_pads = ( pscad.row(mask_pad, m.pitch, 11), pscad.right(m.pitch * 10 + D("3.0")) + pscad.row(mask_pad, m.pitch, m.n + 1) ) def names(l): return (l + str(i) for i in itertools.count(1)) all = pscad.pad(names('B'), m.clearance, m.mask) + ( pscad.row(pad, m.pitch, 11), pscad.right(m.pitch * 10 + D("3.0")) + pscad.row(pad, m.pitch, m.n - 1) + pscad.right(m.pitch * m.n - 1) + ( key_pad, pscad.right(m.pitch) + pad ) ), pscad.pad(names('A'), m.clearance, m.mask) + pscad.back() + ( key_pad, pscad.right(m.pitch) + pscad.row(pad, m.pitch, 10), pscad.right(m.pitch * 10 + D("3.0")) + pscad.row(pad, m.pitch, m.n + 1) ), ( pscad.pad(names('B'), m.clearance, D("2.40")) + mask_pads, pscad.back() + pscad.pad(names('A'), m.clearance, D("2.40")) + mask_pads ) return pscad.nopaste() + all
def part(m): m = pscad.wrapper(defaults.items() + m.items()) pin_names = (i for i in m.pins.split(',')) pad = pscad.rounded_square((m.pad_w, m.pad_l), m.round_off, center=True) if m.tri: tri = pscad.right(m.pitch) + pscad.nopaste() + pad else: tri = None all = pscad.pad(pin_names, m.clearance, m.mask) + ( pscad.left(m.pitch if m.tri else 0) + pscad.row(pad, m.pitch, 2, center=not m.tri), tri ) if 'body_y' in m: body_lines = pscad.rotate(90) + pscad.row(pscad.rotate(90) + pscad.line(m.pitch, center=True), m.body_y, 2, center=True) else: body_lines = pscad.empty() courtyard = pscad.expand_to_grid(pscad.bound((all, body_lines)), m.placement, m.grid) courtyard_sz = (courtyard[1][0] - courtyard[0][0], courtyard[1][1] - courtyard[0][1]) if m.polarized: mark = ( pscad.right(courtyard[0][0]) + pscad.rotate(90) + pscad.circle(courtyard_sz[1] / D(6), sweep=180) ) else: mark = pscad.empty() silk = pscad.silk(m.silk) + ( pscad.translate(courtyard[0]) + patterns.brackets(courtyard_sz, m.pad_w), mark, body_lines ) return all, silk
def open(m): return pscad.nopaste() + closed(m)