Пример #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 pocket_circle(x, y, z0, z1, d, tool):
    """ x """
    assert tool.diameter < d
    #assert tool.length > (z0 - z1)

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

    temp = []
    temp.append(C("Circle pocket routine at x=%.2f y=%.2f" % (x, y)))
    temp.append(C("d=%.2f z=%.2f" % (d, 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_circle(tool.diameter, tool.stepover, x, y, d)

    temp.append(G0(z=tool.safety_z))
    return temp
Пример #3
0
def profile_arb(profile, z0, z1, x, y, theta, scale, tool):
    """ x """
    profile = copy.deepcopy(profile)

    for point in profile:
        if isinstance(point, Point):
            scaled(point, scale)
            rotated(point, theta)
            translated(point, x, y)

    zs = z_steps(z0, z1, tool.stepdown)
    temp = []

    # Go to the start point of the profile
    temp.append(G0(z=tool.safety_z))
    temp.append(G0(x=profile[0].x, y=profile[0].y))

    # Create a reverse copy of the profile
    rev_profile = profile[::-1]

    for n, z in enumerate(zs):
        curr_z_level = G1(z=z)
        temp.append(curr_z_level)
        if n % 2 == 0:
            temp_prof = profile
        else:
            temp_prof = rev_profile
        for i, p in enumerate(temp_prof):
            if isinstance(p, Gap):
                temp.append(G0(z=tool.safety_z))
                temp.append(G0(x=temp_prof[i+1].x, y=temp_prof[i+1].y))
                temp.append(curr_z_level)
            else:
                temp.append(G1(x=p.x, y=p.y))

    temp.append(G0(z=tool.safety_z))
    return temp