示例#1
0
def pocket_rectangle(x, y, z0, z1, a, b, theta, dogbone, tool):
    """ x """
    assert tool.diameter < a
    assert tool.diameter < b

    zs = z_steps(z0, z1, tool.stepdown)

    temp = []
    temp.append(C("Pocket rectangle routine at x=%.2f y=%.2f" % (x, y)))
    temp.append(C("a=%.2f b=%.2f z=%.2f" % (a, b, z1)))
    temp.append(G0(z=tool.safety_z))
    temp.append(G0(x=x, y=y))

    for z in zs:
        temp.append(G1(z=z))
        temp += fill_rectangle(tool.diameter, tool.stepover, x, y, a, b, theta)

    if dogbone:
        temp.append(C("--- START of drill dogbone routine ---"))
        corners = get_corners(x, y, a, b, theta)
        for c in corners:
            temp.append(G0(z=tool.safety_z))
            temp.append(G0(x=c[0], y=c[1]))
            temp.append(G1(z=z1))

        temp.append(C("--- END of drill dogbone routine ---"))
    temp.append(G0(z=tool.safety_z))
    return temp
示例#2
0
def profile_rectangle(x, y, z0, z1, a, b, theta, tool):
    """ x """
    corners = get_corners(x, y, a, b, theta)
    start_corner = corners[-1]

    temp.append(G0(z=tool.safety_z))
    temp.append(G0(x=start_corner[0], y=start_corner[1]))
    for z in zs:
        temp.append(G1(z=z))
        temp.append(G1(x=start_corner[0], y=start_corner[1]))
        # Do a lap
        for c in corners:
            temp.append(G1(x=c[0], y=c[1]))
    temp.append(G0(z=tool.safety_z))
    return temp
示例#3
0
def fill_rectangle(tool_diameter, stepover, x, y, a, b, theta):
    """ x """
    # Assume that the tool is on the right height and in the center of the rectangle
    # Move counter clockwise in a spiral.

    temp = []
    a -= tool_diameter
    b -= tool_diameter

    while a > 0 and b > 0:
        corners = get_corners(x, y, a, b, theta)
        start_corner = corners[-1]
        temp.append(G1(x=start_corner[0], y=start_corner[1]))
        # Do a lap
        for c in corners:
            temp.append(G1(x=c[0], y=c[1]))

        # Decrease the rectangle for the next lap
        a -= 2 * tool_diameter * stepover
        b -= 2 * tool_diameter * stepover

    return temp