def mlp_pad(m): return pscad.union() + ( pscad.down(m.pad_l / D(2) - m.round_off) + pscad.square((m.pad_w, m.round_off * D(2)), rounded=True, center=True), pscad.up((m.pad_l - m.pad_w) / D(2)) + pscad.circle(m.pad_w / D(2)) + pscad.left(m.pad_w / D(2)) + pscad.square((m.pad_w, m.pad_l - m.round_off - m.pad_w / D(2))) )
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 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 mlp_pad(m): pad = pscad.union() + ( pscad.down(m.pad_l / 2 - m.rounding) + pscad.square((m.pad_w, m.rounding * 2), rounded=True, center=True), pscad.up((m.pad_l - m.pad_w) / 2) + pscad.circle(m.pad_w / 2) + pscad.left(m.pad_w / 2) + pscad.square((m.pad_w, m.pad_l - m.rounding - m.pad_w / 2)) ) if 'pad_paste_fraction' in m: return pscad.paste_fraction(pad, (1,m.pad_paste_fraction)) else: return pad