예제 #1
0
def main():
    config = configparser.ConfigParser()
    config.read('default_config.ini')

    #    intermediates_dir = Path(__file__).resolve().parent.parent / 'intermediates'
    intermediates_dir = Path(__file__).resolve().parent / 'intermediates'
    intermediates_dir.mkdir(exist_ok=True)

    # key switch socket
    socket = CherryMXSocket(config['socket'])
    socket.to_file(intermediates_dir / 'socket.scad')

    # keycap
    keycaps = []
    for r in range(1, 5):
        keycap = OEM(r, 1)
        keycap.translate(0, 19 * (4 - r), 0)
        keycaps.append(keycap)

    keycapsolid = sl.part()
    for key in keycaps:
        keycapsolid += key.solid()
    keycap_output = intermediates_dir / 'keycaps.scad'
    sl.scad_render_to_file(keycapsolid, keycap_output)

    # key_assy
    socket_aligned_keys = []
    face_aligned_keys = []
    for r in range(1, 5):
        socket_key = SocketAlignedKey(config['key_assy'], config['socket'], r)
        socket_key.translate(0, 19 * (4 - r), 0)
        socket_aligned_keys.append(socket_key)
        face_key = FaceAlignedKey(config['key_assy'], config['socket'], r)
        face_key.translate(0, 19 * (4 - r), 0)
        face_aligned_keys.append(face_key)

    key_solid = sl.part()
    for key in socket_aligned_keys:
        key_solid += key.solid()
    socket_aligned_keys_output = intermediates_dir / 'socket_aligned_keys.scad'
    sl.scad_render_to_file(key_solid, socket_aligned_keys_output)

    key_solid = sl.part()
    for key in face_aligned_keys:
        key_solid += key.solid()
    face_aligned_keys_output = intermediates_dir / 'face_aligned_keys.scad'
    sl.scad_render_to_file(key_solid, face_aligned_keys_output)

    curved_column = ConcaveOrtholinearColumn(config['column'],
                                             config['key_assy'],
                                             config['socket'])
    curved_column.to_file(intermediates_dir / 'curved_column.scad')

    keyboard = DactylManuform(config['keyboard'], config['column'],
                              config['key_assy'], config['socket'])
    keyboard.to_file(intermediates_dir / 'keyboard.scad')
예제 #2
0
def slat_end(matress_width, overhang):
    length = matress_width + overhang * 2
    half_cross = hole()(cube((3 / 2, 11 / 2, 1 / 4)) +
                        translate((0, 2, 0))(cube((3 / 2, 3 / 2, 3 / 4))))
    return part()(OneBySix(length) -
                  translate((length - 3 / 2 - overhang, 0, 0))(half_cross) -
                  translate((overhang, 0, 0))(half_cross))
예제 #3
0
def base_support(matress_length, overhang):
    half_cross = hole()(cube((3 / 2, 3 / 2, 11 / 8)))
    return color("tan")(
        part()(Board(matress_length + overhang * 2, 11 / 4, 3 / 2, (Y, Z, X)) -
               translate((0, overhang, 0))(half_cross) -
               translate((0, overhang + matress_length - 3 / 2,
                          0))(half_cross)))
예제 #4
0
def base_end(matress_width, overhang):
    half_cross = hole()(cube((3 / 2, 3 / 2, 11 / 8)))
    return color("saddlebrown")(
        part()(Board(matress_width + 2 * overhang, 11 / 4, 3 / 2, (X, Z, Y)) -
               union()(*[
                   translate((overhang + x, 0, 11 / 8))(half_cross)
                   for x in base_longitudinal_displacements(matress_width)
               ])))
예제 #5
0
파일: cc3d.py 프로젝트: daveansell/camcam
def plane_render_all3D(self,callmode,config):
     	"""Render all parts in the Plane"""
	self.modeconfig=milling.mode_config[callmode]
       	self.make_copies()
	config=copy.copy(self.modeconfig)
	if(self.modeconfig['overview']==False):
	     	for thepart in self.getParts(False):
			if not (hasattr(thepart, 'subpart') and thepart.subpart):
	        	 	self.render_part3D(thepart,config)
	else:
		scene = False
		for thepart in self.getParts(True):
			if not (hasattr(thepart, 'subpart') and thepart.subpart):

				self.make_part3D(thepart, config)
				if scene==False:
					scene = solid.part()(thepart.border3D)
				else:
					scene += solid.part()(thepart.border3D)
		solid.scad_render_to_file(scene, 'Overview.scad', include_orig_code=False)
예제 #6
0
파일: cc3d.py 프로젝트: davidbebb/camcam
def plane_render_all3D(self,callmode,config):
        """Render all parts in the Plane"""
        self.modeconfig=milling.mode_config[callmode]
        self.make_copies()
        config=copy.copy(self.modeconfig)
        if(self.modeconfig['overview']==False):
                for thepart in self.getParts(False):
                        if not (hasattr(thepart, 'subpart') and thepart.subpart):
                                self.render_part3D(thepart,config)
        else:
                scene = False
                for thepart in self.getParts(True):
                        if not (hasattr(thepart, 'subpart') and thepart.subpart):

                                self.make_part3D(thepart, config)
                                if hasattr(thepart,"border3D"):
                                        if scene==False:
                                                scene = solid.part()(thepart.border3D)
                                        else:
                                                scene += solid.part()(thepart.border3D)
                solid.scad_render_to_file(scene, 'Overview.scad', include_orig_code=False)
예제 #7
0
def base_side(matress_length, overhang):
    end_slat_half_cross = hole()(cube((3 / 2, 2, 1 / 2)) +
                                 translate((0, 7 / 2, 0))(cube((3 / 2, 2,
                                                                1 / 2))))
    slat_half_cross = hole()(cube((3 / 2, 7 / 2, 1 / 2)))
    base_half_cross = hole()(cube((3 / 2, 3 / 2, 11 / 8)))
    return color("tan")(
        part()(TwoByFour(matress_length + 2 * overhang, (Y, Z, X)) +
               translate((0, overhang, 0))(base_half_cross) +
               translate((0, overhang + matress_length - 3 / 2,
                          0))(base_half_cross) +
               translate((0, 0, 3))(end_slat_half_cross) +
               translate((0, 2 * overhang + matress_length - 11 / 2,
                          3))(end_slat_half_cross) - union()(*[
                              translate((0, overhang + y, 3))(slat_half_cross)
                              for y in slat_displacements(matress_length)
                          ])))
예제 #8
0
def cylinderAsm(dii, doo, hss):
    '''Produce an assembly of specified cylinders, given three lists that
       specify sequences of inner diameters, outer diameters, and
       heights.  Consecutive triples (of diameters and height) specify
       the ends of a cylindrical or conical portion of an assembly, in
       ascending order of heights; except if the next height in
       sequence isn't more than the current height, there is no output
       for that pair of triples.
    '''
    # Get inner and outer start and end diameters, and s & e heights
    asm = None
    for jointNum, dis, die, dos, doe, hs, he in zip(range(len(dii)), dii, dii[1:], doo, doo[1:], hss, hss[1:]):
        if hs >= he: # Skip rings that don't have positive thickness
            continue
        print '{:2}.  dis {:<5.2f}, die {:<5.2f}, dos {:<5.2f}, doe {:<5.2f}, ys {:<5.2f}, ye {:<5.2f}'.format(jointNum, dis, die, dos, doe, hs, he)
        co = cylinder(d1=dos, d2=doe, h=he-hs)
        ci = cylinder(d1=dis, d2=die, h=he-hs+0.002)
        cyl = part()(co - hole()(down(0.001)(ci)))
        asm = asm + up(hs)(cyl) if asm else cyl
    return asm
예제 #9
0
def box(width, height, depth, half=False, topbox=False):
    obj = sp.part()
    left = sp.cube([thickness, depth, height])
    right = left.copy()
    right = spu.right(width - thickness)(right)
    obj += left + right

    top = sp.cube([width - 2 * thickness, depth, thickness])
    top = spu.right(thickness)(top)
    if (half):
        ha = spu.up(height / 2 - thickness / 2)(top)
        obj += ha
    h = sp.cylinder(holes / 2, thickness + 10)
    top -= sp.translate([50, 50, 0])(h)
    top -= sp.translate([width - 50, 50, 0])(h)
    top -= sp.translate([width - 50, depth - 50, 0])(h)
    top -= sp.translate([50, depth - 50, 0])(h)
    bottom = top
    top = spu.up(height - thickness)(top)
    obj += top + bottom

    if (not topbox):
        sta = sp.cube([width * 3 / 4, thickness, 100])
        sta = sp.rotate([0, -45, 0])(sta)
        cutout = sp.cube([width, depth, height])
        cutout = spu.down(height / 4)(spu.left(width / 4)(cutout))
        cutout -= spu.back(5)(sp.cube(
            [width / 2 - thickness, depth + 10, height / 2 - thickness]))
        sta -= spu.back(depth / 2)(cutout)
        sta = spu.right(thickness)(sta)
        sta += spu.right(width)(sp.mirror([1, 0, 0])(sta))
        sta += sp.mirror([0, 0, 1])(sta)
        sta = spu.forward(depth - thickness)(sta)
        obj += (spu.up(height / 2)(sta) - ha)

    if (half and topbox):
        window = sp.cube(
            [width - 2 * thickness, thickness, height / 2 - 1.5 * thickness])
        window = sp.translate([thickness, 0, thickness])(window)
        obj += spu.up(height / 2 - thickness / 2)(window)
    return obj
예제 #10
0
def main():
    obj = sp.part()
    obj += box(600, 600, 200, True, False)
    return obj
예제 #11
0
def slat_middle(matress_width, overhang):
    length = matress_width + overhang * 2
    half_cross = hole()(cube((3 / 2, 7 / 2, 1 / 4)))
    return part()(OneByFour(length) -
                  translate((length - 3 / 2 - overhang, 0, 0))(half_cross) -
                  translate((overhang, 0, 0))(half_cross))
예제 #12
0
def foot(rise):
    notch_depth = 2
    return part()(
        FourByFour(notch_depth + rise, (Z, X, Y)) -
        hole()(translate((0, 1, rise))(cube((3.5, 1.5, notch_depth)))) -
        hole()(translate((1, 0, rise))(cube((1.5, 3.5, notch_depth)))))