## Geometry header ## [(koko.prims.utils.Slider, {'name': 'shrink', 'min': '0', 'max': '0.1', 'value': '0.075', 'y': '27.63247654', 'x': '-58.3368682353', 'size': '40'}),(koko.prims.utils.Slider, {'name': 'skin', 'min': '0', 'max': '0.2', 'value': '0.15', 'y': '11.328014769', 'x': '-54.294673431', 'size': '40'}),(koko.prims.utils.Slider, {'name': 'border', 'min': '0', 'max': '0.5', 'value': '0.25', 'y': '40.8310304271', 'x': '-56.6965761672', 'size': '50'})] ## End of geometry header ## from math import sqrt from koko.lib.shapes import * mode = 'view' mode = 'inner' #mode = 'outer' L = 2.65 W = 1.25 T1 = 0.5 T2 = 0.25 cut = 0.1 # Pull values from sliders shrink = shrink.value skin = skin.value skin2 = skin/sqrt(2) border = border.value L -= shrink W -= 2*shrink # Create the PCB shape inner = rectangle(0, L, -W/2, W/2) tri1 = triangle(0, W/2, T1, W/2, 0, W/2-T1) tri2 = triangle(L-T2, W/2, L, W/2, L, W/2-T2) inner -= tri1 + reflect_y(tri1) + tri2 + reflect_y(tri2) # Cut off the tip and add alignment region inner -= (X - cut) inner += rectangle(cut - skin, cut, -W/2+T1-cut, W/2-T1+cut) inner += rectangle(cut - skin -0.25, cut - skin, -W/2, W/2) # Create the skin shape outer = rectangle(cut-skin, L+skin, -W/2-skin, W/2+skin) tri1 = triangle(-skin2, W/2+skin, T1-skin2+skin, W/2+skin2+skin, -skin2, W/2-T1+skin2) tri2 = triangle(L-T2+skin2-skin, W/2+skin2+skin, L+skin, W/2+skin, L+skin2+skin, W/2-T2+skin2-skin) outer -= tri1 + reflect_y(tri1) + tri2 + reflect_y(tri2) outer += rectangle(cut - skin -0.25, cut - skin, -W/2, W/2) # Spin both shapes about the y axis outer = revolve_x(outer) inner = revolve_x(inner) # Create a cube of way for the top mold top = cube(outer.xmin - border, outer.xmax + border, outer.ymin - border, outer.ymax + 3*border + outer.ymax - outer.ymin, outer.zmin - border, 0) top -= outer + move(outer, 0, outer.ymax - outer.ymin+2*border) # Create a cube of wax for the inner molds bottom = cube(inner.xmin - 3*border, inner.xmax + 3*border, inner.ymin - 3*border, inner.ymax + 6*border + inner.ymax - inner.ymin, -2*border, inner.zmax+border) # One of the molds has a border around it for alignment cutout = cube(inner.xmin - 2*border, inner.xmax + 2*border, inner.ymin - 2*border, inner.ymax + 2*border, -border, inner.zmax+border) bottom -= cutout bottom += cube(inner.xmin - border, inner.xmax + border, inner.ymin - border, inner.ymax + border, -2*border, 0) bottom += inner & cutout # The other just has the inner positive mold shape cutout = cube(inner.xmin - border, inner.xmax + border, inner.ymax + 3*border, inner.ymax+3*border + inner.ymax - inner.ymin+2*border, -border, inner.zmax + border) bottom -= cutout bottom += move(inner, 0, border*4+inner.ymax-inner.ymin) & cutout # Add pour holes to the top of the mold bottom += cylinder(cut-skin-0.125, border*4+inner.ymax-inner.ymin, 0, inner.zmax+border, 0.125) bottom += cylinder(L/3, border*4+inner.ymax-inner.ymin, 0, inner.zmax+border, 0.15) bottom += cylinder(0.8*L, border*4+inner.ymax-inner.ymin, 0, inner.zmax+border, 0.15) if mode == 'view': inner.color = (255, 255, 100) top.color = (255, 100, 100) bottom.color = (100, 120, 255) # Line everything up for pretty pictures cad.shapes = inner, top, move(bottom, top.xmax-bottom.xmin + border, top.ymin - bottom.ymin, top.zmin - bottom.zmin) elif mode == 'outer': cad.function = top cad.border = 0 elif mode == 'inner': cad.function = bottom cad.border = 0