def pulley_arms(height=40, through_screw='m4', arm_width=15, arm_thickness=7.5, pully_width=10, base_width=30, base_thickness=10, spin_clearance=0.5): arm_base = so.translate((0,-arm_width/2.0,0))(so.cube((arm_thickness, arm_width, 1))) arm = so.hull()(so.translate((0,0,height-arm_width/2.0))(so.rotate((0,90,0))(so.cylinder(r=arm_width/2.0, h=arm_thickness))) + arm_base) def arms_xf_left(obj): return so.translate(((pully_width + spin_clearance)/2.0,0,0))(obj) def arms_xf_right(obj): return so.translate((-(pully_width + spin_clearance)/2.0,0,0))(so.rotate((0,0,180))(obj)) arms = arms_xf_left(arm) + arms_xf_right(arm) plate_orig = so.translate((-base_width/2.0,-base_width/2.0,-base_thickness))(so.cube((base_width, base_width, base_thickness))) plate = so.hull()(plate_orig, so.translate((0,0,base_thickness/2.0))(arms_xf_left(arm_base))) plate += so.hull()(plate_orig, so.translate((0,0,base_thickness/2.0))(arms_xf_right(arm_base))) # add mount holes spacing = arm_thickness*2.0+pully_width bolt_hole = so.rotate((0,90,0))(so.translate((0,0,-spacing))(so.cylinder(r=screw_clearance[through_screw]/2.0, h=spacing*2.0))) nut_recess = so.translate((-spacing/2.0,0,0))(so.rotate((0,90,0))(hex(screw_nut[through_screw]['width'], screw_nut[through_screw]['depth']))) bolt_hole += nut_recess head_recess = so.translate((spacing/2.0,0,0))(so.rotate((0,-90,0))(so.cylinder(r=screw_head_sink[through_screw]['diameter']/2.0, h=screw_head_sink[through_screw]['h']))) bolt_hole += head_recess arms -= so.translate((0,0,height-arm_width/2.0))(bolt_hole) # add base mount hole head_recess = so.translate((0,0,-5))(so.cylinder(r=screw_head_sink[through_screw]['diameter']/2.0, h=screw_head_sink[through_screw]['h']*base_thickness)) bolt_hole = so.translate((0,0,-base_thickness))(so.cylinder(r=screw_clearance[through_screw]/2.0, h=base_thickness*2.0)) bolt_hole += head_recess return arms + plate - bolt_hole
def sizedipad(x, y, height): """Returns an iPad x,y size, with fixed size corners""" o = hull()( (ipadcorner(height)), translate([0, y, 0])(rotate([0, 0, -90])((ipadcorner(height)))), translate([x, y, 0])(rotate([0, 0, 180])((ipadcorner(height)))), translate([x, 0, 0])(rotate([0, 0, 90])((ipadcorner(height)))), translate([15, 15, 0])(cube([x - 30, y - 30, height])), ) return o
def impl(scad): body = None for p in ps: for o in ps[p]: a = so.translate(([0]*p + [o * chamfer] + [0]*2)[:3])(scad) if body is None: body = a else: body += a return so.hull()(body)
def hex(width, h, fillet_radius = 0.1): """ width is the distance between opposing flat sides """ r = width/2.0/cos(pi/6.0) # magic so that we have the width b/w flat faces instead of corners pole = so.translate((r - fillet_radius, 0, 0))(so.cylinder(r=fillet_radius, h=h)) body = pole for i in range(1,6): body += so.rotate((0,0,60 * i))(pole) return so.hull()(body)
def carraige_plate_install_holes(length = 200, angle=15, diameter=screw_head_sink['m3']['diameter']): l = diameter cut = so.cylinder(r=l/2.0, h=1) off1 = length * sin(angle*pi/180) off2 = length * cos(angle*pi/180) body = None for m in [1,-1]: for t in [True, False]: x,y = (m,0) if t: x,y=y,x p1 = so.translate((y*41.0/2,x*34.5/2,0))(cut) p2 = so.translate((y*(41.0/2+off1),x*(34.5/2+off1),off2))(cut) p = so.hull()(p1,p2) if body is None: body = p else: body += p return body
def hull(self) -> "SolidBuilder": self._oso = hull()(self._oso) return self