def brackets(sz, n, center=False): bracket = pscad.translate([sz[0] / 2, sz[1] / 2]) + ( pscad.line([-n / 2, 0]), pscad.line([0, -sz[1]]), pscad.up(sz[1]) + pscad.line([-n / 2, 0]) ) bracket = bracket, pscad.mirror([1, 0]) + bracket if not center: bracket = pscad.translate([sz[0] / 2, sz[1] / 2]) + bracket return bracket,
def part(m): m = pscad.wrapper(defaults.items() + m.items()) pin_names = (i for i in m.pins.split(',')) all = pscad.pad(pin_names, m.clearance, m.mask) + ( pscad.row(pscad.rounded_square((m.pad_w, m.pad_l), m.round_off, center=True), m.pitch, 2, center=True) ) 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 part(m): m = pscad.wrapper(defaults.items() + m.items()) if 'skip' in m: skip = lambda name: re.match(m.skip, name) else: skip = None bga_pad = pscad.paste_fraction( pscad.circle(m.pad_size / 2), m.paste_fraction) row = pscad.row(bga_pad, m.pitch, m.n_x, center=True) all = (pscad.pad( bga_names(m.n_x, m.no_letter), m.clearance, m.mask, skip=skip) + pscad.rotate(270) + pscad.row( pscad.rotate(90) + row, m.pitch, m.n_y, center=True), pscad.silk(m.silk) + pscad.square( (m.body_x, m.body_y), center=True)) silk = pscad.silk(m.silk) + ( patterns.placement_courtyard(all, m.placement, m.grid, 1), pscad.translate([-m.body_x / 2, -m.pitch * (m.n_y - 1) / 2]) + pscad.left(m.silk * 2) + pscad.line([0, m.pitch * 2], center=True)) if m.invert: return pscad.mirror([1, 0]) + pscad.rotate(270) + (all, silk) return all, silk
def corners(sz, n, center=False): corner = pscad.translate([sz[0] / 2, sz[1] / 2]) + ( pscad.line([-n / 2, 0]), pscad.line([0, -n / 2]) ) corners = ( corner, pscad.mirror([0, 1]) + corner, pscad.mirror([1, 0]) + ( corner, pscad.mirror([0, 1]) + corner ) ) if not center: corners = pscad.translate([sz[0] / 2, sz[1] / 2]) + corners return corners,
def part(m): m = pscad.wrapper(defaults.items() + m.items()) thermal_size = (m.thermal_x, m.thermal_y) row = mlp_row(m, m.n / (4 if m.quad else 2)) if m.quad: pads = ( row, pscad.rotate(90) + row, pscad.rotate(180) + row, pscad.rotate(270) + row ) else: pads = row, pscad.rotate(180) + row all = pscad.pad(itertools.count(1), m.clearance, m.mask) + ( pads, patterns.thermal_pad(patterns.indent_pad(thermal_size, m.indent), thermal_size, m.paste_fraction, m.paste_max) ), pscad.silk(m.silk) + patterns.corners((m.body_x, m.body_y), m.pad_l, center=True) silk = pscad.silk(m.silk) + ( patterns.placement_courtyard(all, m.placement, m.grid, m.pad_w * D(2)), pscad.translate([-m.body_x / D(2), m.body_y / D(2)]) + pscad.down(m.silk * D(2)) + pscad.line(m.pad_l * D("0.7")) ) return all, silk
def indent_pad(size, indent): return pscad.union() + ( pscad.translate([-size[0] / 2, -size[1] / 2]) + ( pscad.square([size[0], size[1] - indent]), pscad.right(indent) + pscad.square([size[0] - indent, size[1]]), pscad.down(size[1] - indent) + pscad.rotate(45) + pscad.square(indent * dmath.sqrt(D(2))) ) )
def part(m): m = pscad.wrapper(defaults.items() + m.items()) row = pscad.row(pscad.rounded_square([m.l, m.w], m.round_off, center=True), m.a + m.l, 2, center=True) all = pscad.pad(itertools.count(1), m.clearance, m.mask) + ( pscad.rotate(270) + pscad.row(pscad.rotate(90) + row, m.b + m.w, 2, center=True) ) courtyard = pscad.expand_to_grid(pscad.bound(all), m.placement, m.grid) courtyard_sz = (courtyard[1][0] - courtyard[0][0], courtyard[1][1] - courtyard[0][1]) silk = pscad.silk(m.silk) + ( pscad.translate(courtyard[0]) + patterns.brackets(courtyard_sz, m.l) ) return all, silk
def ptd08a0x0w_template(m): all = ( ptd08a0x0w_pins(m), pscad.right(m.d) + common_pins(m), pscad.silk(m.silk) + pscad.translate([m.d / 2, m.a / 2]) + pscad.square([m.e, m.f], center=True) ) silk = pscad.silk(m.silk) + ( patterns.placement_courtyard(all, m.placement, m.grid, 1), ) return all, silk
def part(m): m = pscad.wrapper(defaults.items() + m.items()) if 'pads_x' in m: pads_x = m.pads_x elif m.quad: pads_x = m.n / 4 else: pads_x = 0 pads_y = m.n / 2 - pads_x if 'width' in m: width = m.width else: width = m.height thermal_size = (m.thermal_x, m.thermal_y) row_y = mlp_row(m, pads_y, m.height) if m.quad: row_x = mlp_row(m, pads_x, width) pads = ( row_y, pscad.rotate(90) + row_x, pscad.rotate(180) + row_y, pscad.rotate(270) + row_x ) else: pads = row_y, pscad.rotate(180) + row_y pin_list = range(m.start_pin, m.n - m.start_pin + 3) + range(1, m.start_pin) + [int(m.n) + 1] all = pscad.pad(itertools.cycle(pin_list), m.clearance, m.mask) + ( pads, patterns.thermal_pad(patterns.indent_pad(thermal_size, m.indent), thermal_size, m.paste_fraction, m.paste_max) ), pscad.silk(m.silk) + patterns.corners((m.body_x, m.body_y), m.pad_l, center=True) silk = pscad.silk(m.silk) + ( patterns.placement_courtyard(all, m.placement, m.grid, m.pad_w * 2), pscad.translate([-m.body_x / 2, m.body_y / 2]) + pscad.down(m.silk * 2) + pscad.line(m.pad_l * D("0.7")) ) return all, silk
def ptd08a0x0w(m): m = pscad.wrapper(defaults.items() + m.items()) m10w = pscad.wrapper(defaults.items() + M10W_defaults.items() + m.items()) m20w = pscad.wrapper(defaults.items() + M20W_defaults.items() + m.items()) all = ( ptd08a0x0w_pins(m20w), pscad.right(m20w.d - m10w.d) + ptd08a0x0w_pins(m10w), pscad.right(m20w.d) + common_pins(m), pscad.silk(m.silk) + pscad.translate([m20w.d / 2, m20w.a / 2]) + pscad.square([m20w.e, m20w.f], center=True) ) silk = pscad.silk(m.silk) + ( patterns.placement_courtyard(all, m.placement, m.grid, 1), ) return all, silk
def placement_courtyard(obj, placement, grid, sz): courtyard = pscad.expand_to_grid(pscad.bound(obj), placement, grid) courtyard_sz = (courtyard[1][0] - courtyard[0][0], courtyard[1][1] - courtyard[0][1]) return pscad.translate(courtyard[0]) + corners(courtyard_sz, sz),