def expand_to_grid(sq, expand, grid): epsilon = D(0.00000000000000000001) expand -= epsilon return ((dmath.floor((sq[0][0] - expand) / grid) * grid, dmath.floor((sq[0][1] - expand) / grid) * grid), (dmath.ceil((sq[1][0] + expand) / grid) * grid, dmath.ceil((sq[1][1] + expand) / grid) * grid))
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 expand_to_grid(sq, expand, grid): return ((dmath.floor((sq[0][0] - expand) / grid) * grid, dmath.floor((sq[0][1] - expand) / grid) * grid), (dmath.ceil((sq[1][0] + expand) / grid) * grid, dmath.ceil((sq[1][1] + expand) / grid) * grid))