Example #1
0
def index_holes(contours, thickness):
    # We put the index holes 1/2 between top and bottom, 160mm apart
    #    log(str(poly.right(face_c)))
    #    log(str(poly.left(face_c)))
    #    log(str(poly.right(face_c) - poly.left(face_c)))
    #    log(str((poly.right(face_c) - poly.left(face_c))/2))
    #    log(str(poly.right(face_c) - (poly.right(face_c) - poly.left(face_c))/2))

    rightmost = -1000000
    leftmost = 1000000
    for contour in contours:
        right = poly.right(contour)
        left = poly.left(contour)
        rightmost = max(right, rightmost)
        leftmost = min(left, leftmost)


#    x_offset = poly.right(face_c) - (poly.right(face_c) - poly.left(face_c))/2
    x_offset = rightmost - (rightmost - leftmost) / 2

    hole_radius = 4.85 / 2  # Measured from dowel pin
    tool_radius = 3.175 / 2
    helix_radius = hole_radius - tool_radius
    r_hole = [x_offset, 90]
    l_hole = [x_offset, -90]
    r = [
        cam.comment("Index Holes for secondary operations"),
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(15000),
        cam.feedrate(1000),
        cam.dwell(3),
        cam.rmh(r_hole + [-thickness - 1.0], helix_radius, 0.5, 1),
        cam.rmh(l_hole + [-thickness - 1.0], helix_radius, 0.5, 1),
    ]
    return r
Example #2
0
def lens_holes(left_c, right_c, thickness):
    """Generates the toolpath for the lens holes (holes, groove and tabs)."""
    if not poly.is_ccw(left_c):
        left_c = poly.reverse(left_c)
    if not poly.is_ccw(right_c):
        right_c = poly.reverse(right_c)

    lhole = poly.erode(3.175 / 2.0, left_c)[0]
    rhole = poly.erode(3.175 / 2.0, right_c)[0]

    right_rough = poly.erode(0.1, rhole)[0]
    left_rough = poly.erode(0.1, lhole)[0]

    lgroove = poly.erode(0.8, left_c)[0]
    rgroove = poly.erode(0.8, right_c)[0]

    left_entry = poly.erode(2.0, lhole)[0][0]
    right_entry = poly.erode(2.0, rhole)[0][0]

    lhole = poly.reverse(lhole)
    rhole = poly.reverse(rhole)

    r = [
        "(Lens Holes)",
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(20000),
        cam.feedrate(2000),
        cam.rmh(right_entry + [-thickness - 1.0], 1.5, 0.5, 1.0),
        cam.contour(right_rough, True),
        cam.contour(rhole, True),
        cam.rmh(left_entry + [-thickness - 1.0], 1.5, 0.5, 1.0),
        cam.contour(left_rough, True),
        cam.contour(lhole, True),
    ]
    return r
Example #3
0
def index_holes(contours, thickness):
# We put the index holes 1/2 between top and bottom, 160mm apart
#    log(str(poly.right(face_c)))
#    log(str(poly.left(face_c)))
#    log(str(poly.right(face_c) - poly.left(face_c)))
#    log(str((poly.right(face_c) - poly.left(face_c))/2))
#    log(str(poly.right(face_c) - (poly.right(face_c) - poly.left(face_c))/2))

    rightmost = -1000000
    leftmost = 1000000
    for contour in contours:
        right = poly.right(contour)
        left = poly.left(contour)
        rightmost = max(right, rightmost)
        leftmost = min(left, leftmost)

#    x_offset = poly.right(face_c) - (poly.right(face_c) - poly.left(face_c))/2
    x_offset = rightmost - (rightmost - leftmost)/2

    hole_radius = 4.85/2 # Measured from dowel pin
    tool_radius = 3.175/2
    helix_radius = hole_radius - tool_radius
    r_hole = [x_offset, 90]
    l_hole = [x_offset, -90]
    r = [
        cam.comment("Index Holes for secondary operations"),
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(15000),
        cam.feedrate(1000),
        cam.dwell(3),
        cam.rmh(r_hole + [-thickness - 1.0], helix_radius, 0.5, 1),
        cam.rmh(l_hole + [-thickness - 1.0], helix_radius, 0.5, 1),
    ]
    return r
Example #4
0
def lens_holes(left_c, right_c, thickness):
    """Generates the toolpath for the lens holes (holes, groove and tabs)."""
    print 'Calculating the lens holes'
    tool_radius = 3.175
    if not poly.is_ccw(left_c):
        left_c = poly.reverse(left_c)
    if not poly.is_ccw(right_c):
        right_c = poly.reverse(right_c)

#    drawing = dxf.drawing('test.dxf')
#    drawing.add_layer('OUTLINE', color=1)
#    polyline = dxf.polyline(layer="OUTLINE")
#    polyline.add_vertices(left_c)
#    drawing.add(polyline)


    lhole = poly.erode(tool_radius/2.0, left_c)[0]
    rhole = poly.erode(tool_radius/2.001, right_c);
    rhole = rhole[0]
#    polyline = dxf.polyline(layer="OUTLINE")
#    polyline.add_vertices(lhole)
#    drawing.add(polyline)


    right_rough = poly.erode((tool_radius + 0.3)/2, right_c)[0]
    left_rough = poly.erode((tool_radius+0.3)/2, left_c)[0]
    #lgroove = poly.erode(0.8, left_c)[0]
    #rgroove = poly.erode(0.8, right_c)[0]

    left_entry = poly.erode(5.0, left_c)[0][0];
    right_entry = poly.erode(5.0, right_c)[0][0];

    lhole = poly.reverse(lhole)
    rhole = poly.reverse(rhole)

    r = [
        "(Lens Holes)",
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(22000),
        cam.feedrate(2000),
        cam.rmh(right_entry + [-thickness - 1.0], 1.5, 0.5, 1.0),
        cam.contour(right_rough, True),
        cam.feedrate(1000),
        cam.contour(rhole, True),
        cam.feedrate(2000),
        cam.rmh(left_entry + [-thickness - 1.0], 1.5, 0.5, 1.0),
        cam.contour(left_rough, True),
        cam.feedrate(1000),
        cam.contour(lhole, True),

    ]
    return r
Example #5
0
def rough_temple_bevel(temple,  thinning):
    p1 = extendLine(temple[-1], temple[-2], 3.175/2 - 0.5)
    p2 = extendLine(temple[0], temple[1], 3.175/2 - 0.5)
    p3 = extendLine(temple[0], temple[1], 15)
    p4 = extendLine(temple[-1], temple[-2], 15) # room for dovetail
# p1 and p2 are just extensions of the temple - move them to the side a bit to
# clearance for when the dovetail cutter comes through
    p1 = extendLine(p1, p2, 3)
    p2 = extendLine(p2, p1, 3)
    p3 = extendLine(p3, p4, 3)
    p4 = extendLine(p4, p3, 3)


# Move to the dovetail cutter entry point, helix through stock.
# Cut a circle big enough to admit the dovetail cutter.
# Rough cut the end of the temple
# Clear a return path for the dovetail cutter.
    return [
        cam.change_tool("1/8in endmill"),
        cam.feedrate(1000),
        cam.rmh(p4 + [-5-thinning], 1, pitch=1),
        cam.move(p1),
        cam.move(p2),
        cam.move(p3),
        cam.move(p4),
        cam.rapid(p4 + [10])
        ]
Example #6
0
def generic_nose_contour(face_con, thickness, thin_back, centering_shift):
    """ Use the tapered endmill to create a nose relief along the curve of the
    glasses frame.
    First construct a path that is a simple, average shape for a nose: 8 mm nose radius, 34 degree
    splay.  Compare the curve to the spline of the glasses, if the spline crosses our naive curve, follow
    the glasses curve until it crosses the naive curve again, then keep following the naive curve.
    """
    curve_offset = 0 # Set so tapered endmill cuts about 1mm from front face of frame
    nose_sa = math.radians(34) # Experiment with this
    nose_rad = 9
    xfloor = -26 # set to avoid hitting clamp
    nose_height = 8 # again, experiment
    naive_poly = nose.nose_poly(nose_rad, nose_height, nose_sa, nose_sa, xfloor, curve_offset, 0)
    # close it
    #naive_poly = naive_poly + [naive_poly[0]]


    intersect = poly.difference(naive_poly, face_con)
    intersect = intersect[1:] + [intersect[0]]
    eroded = poly.erode(2, intersect)[0]
    finish = poly.erode(1.5, intersect)[0]

    hole_radius = 4.85/2 # Measured from dowel pin
    tool_radius = 3.175/2
    helix_radius = hole_radius - tool_radius


    return [
        cam.change_tool("tapered"),
        cam.start_spindle(20000),
        cam.feedrate(1000),
        cam.rmh(eroded[0] + [-thickness - 1.0], helix_radius, 0.5, 1),
        cam.contour(eroded, False),
        cam.contour(finish[::-1], False),
        ]
Example #7
0
def index_holes(thickness):
# We put the index holes 1/2 between top and bottom, 160mm apart
    hole_radius = 4.85/2 # Measured from dowel pin
    tool_radius = 3.175/2
    helix_radius = hole_radius - tool_radius
    r = [
        cam.comment("Index holes for secondary operations"),
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(22000),
        cam.feedrate(1000),
        cam.dwell(5),
        # Index holes should be at 90, -90 but are shifted a bit to compensate
        # for inaccuracy on laser fixture
        cam.rmh([0, 85.00, -thickness - 1.0], helix_radius, 0.5, 1),
        cam.rmh([0, -85.00, -thickness - 1.0], helix_radius, 0.5, 1),
        ]
    return r
Example #8
0
def lens_holes(left_c, right_c, thickness):
    """Generates the toolpath for the lens holes (holes, groove and tabs)."""
    if not poly.is_ccw(left_c):
        left_c = poly.reverse(left_c)
    if not poly.is_ccw(right_c):
        right_c = poly.reverse(right_c)

    lhole = poly.erode(3.175/2.0, left_c)[0]
    rhole = poly.erode(3.175/2.0, right_c)[0]

    right_rough = poly.erode(0.1, rhole)[0]
    left_rough = poly.erode(0.1, lhole)[0]

    lgroove = poly.erode(0.8, left_c)[0]
    rgroove = poly.erode(0.8, right_c)[0]

    left_entry = poly.erode(2.0, lhole)[0][0];
    right_entry = poly.erode(2.0, rhole)[0][0];

    lhole = poly.reverse(lhole)
    rhole = poly.reverse(rhole)

    r = [
        "(Lens Holes)",
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(20000),
        cam.feedrate(2000),
        cam.rmh(right_entry + [-thickness - 1.0], 1.5, 0.5, 1.0),
        cam.contour(right_rough, True),
        cam.contour(rhole, True),
        cam.rmh(left_entry + [-thickness - 1.0], 1.5, 0.5, 1.0),
        cam.contour(left_rough, True),
        cam.contour(lhole, True),

    ]
    return r
Example #9
0
def rough_nose_contour(nose_rad, nose_h, nose_sa, nose_ra, face_con, thickness, thin_back, centering_shift):
    sa = math.radians(nose_sa)
    ra = math.radians(nose_ra)
    h = nose_h + centering_shift
    h = nose_h
    xfloor = poly.left(face_con) - 3.175  # bottom most point minus tool radius
    xfloor = max(xfloor, -27.0) # miminum safe distance without hitting clamp
    cutter_offset = 1.5875 # radius of 1/8" cutter

    nosepoly = nose.nose_poly(nose_rad, h, sa, ra, xfloor, cutter_offset, thickness+thin_back)

    return [
        "(Rough nose contour)",
        cam.change_tool("1/8in endmill"),
        cam.start_spindle(20000),
        cam.feedrate(2000),
        cam.rmp(nosepoly[0] + [1.0]),
        cam.rmh([0, 85.00, -thickness - 1.0], helix_radius, 0.5, 1),
            ]