Exemplo n.º 1
0
def plunge_hole(radius, tool_radius, depth):
    cut_radius = radius - tool_radius
    hole = gc.Aggregate()
    hole.add(gc.Rapid(-cut_radius, 0, SAFE_HEIGHT))  #go to start point
    hole.add(gc.Line(z=-depth))  # go to surface
    hole.add(gc.Arc(z=-depth, i=cut_radius))
    hole.add(gc.Rapid(z=SAFE_HEIGHT))
    return hole
Exemplo n.º 2
0
def drill_hole(radius, tool_radius, step, depth):
    cut_radius = radius - tool_radius
    hole = gc.Aggregate()
    hole.add(gc.Rapid(-cut_radius, 0, SAFE_HEIGHT))  #go to start point
    hole.add(gc.Line(z=0))  # go to surface
    i = 0
    while (i > -depth):
        i = max(i - 2, -depth)
        hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Rapid(z=SAFE_HEIGHT))
    return hole
Exemplo n.º 3
0
def rectangle(x, y, z, tool_radius):
    x -= tool_radius * 2
    y -= tool_radius * 2
    result = gc.Aggregate()
    result.add(gc.Rapid(-x / 2, y / 2, SAFE_HEIGHT, f=RAPID))
    result.add(gc.Line(-x / 2, y / 2, z, f=SLOW))
    result.add(gc.Line(x / 2, y / 2))
    result.add(gc.Line(x / 2, -y / 2))
    result.add(gc.Line(-x / 2, -y / 2))
    result.add(gc.Line(-x / 2, y / 2))
    result.add(gc.Rapid(z=SAFE_HEIGHT))
    return result
Exemplo n.º 4
0
def drill_hole(radius, depth):
    cut_radius = radius - TOOL
    hole = gc.Aggregate()
    hole.add(gc.Rapid(-cut_radius, 0, SAFE_HEIGHT,
                      f=RAPID))  #go to start point
    hole.add(gc.Line(z=0, f=SLOW))  # go to surface
    i = 0
    while (i > -depth):
        i = max(i - INCREMENT, -depth)
        hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Rapid(z=SAFE_HEIGHT))
    return hole
Exemplo n.º 5
0
def rectangle(x, y, depth):
    x += TOOL / 2
    y += TOOL / 2
    z = 0
    result = gc.Aggregate()
    result.add(gc.Rapid(-x / 2, -y / 2, SAFE_HEIGHT, f=RAPID))
    while z > -depth:
        z = max(z - INCREMENT, -depth)
        result.add(gc.Line(z=z, f=SLOW))
        result.add(gc.Line(x=x / 2))
        result.add(gc.Line(y=y / 2))
        result.add(gc.Line(x=-x / 2))
        result.add(gc.Line(y=-y / 2))
    result.add(gc.Line(z=SAFE_HEIGHT))
    return result
Exemplo n.º 6
0
def rounded_hole(x, y, z, tool_radius):
    """returns a hole with semicircular ends on x-axis (x > y)"""
    x -= tool_radius * 2
    y -= tool_radius * 2
    r = y / 2
    x -= y
    result = gc.Aggregate()
    #go to top left
    result.add(gc.Rapid(-x / 2, y / 2, SAFE_HEIGHT, f=RAPID))
    result.add(gc.Line(-x / 2, y / 2, z, f=SLOW))
    result.add(gc.Line(x / 2, y / 2))
    result.add(gc.Arc(x / 2 + r, 0, r=r))
    result.add(gc.Arc(x / 2, -y / 2, r=r))
    result.add(gc.Line(-x / 2, -y / 2))
    result.add(gc.Arc(-x / 2 - r, 0, r=r))
    result.add(gc.Arc(-x / 2, y / 2, r=r))
    result.add(gc.Rapid(z=SAFE_HEIGHT))
    return result
Exemplo n.º 7
0
def drill_hole(radius, tool_radius, step, depth):
    cut_radius = radius - tool_radius
    hole = gc.Aggregate()
    hole.add(gc.Rapid(-cut_radius, 0, SAFE_HEIGHT))  #go to start point
    hole.add(gc.Line(z=0))  # go to surface
    i = 0
    while (i > -depth):
        i = max(i - 2, -depth)
        hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Rapid(z=SAFE_HEIGHT))
    return hole


ball_hole = gc.Aggregate(gc.Rapid(0, 0, SAFE_HEIGHT), gc.Line(0, 0, -2),
                         gc.Line(z=SAFE_HEIGHT))
all_ball_holes = [
    gc.Translate([i * 50 - 75, j * 50 - 25, 0], ball_hole) for i in range(4)
    for j in range(2)
]
mount_hole = drill_hole(MOUNT_HOLE_RADIUS, TOOL_RADIUS, 2, DEPTH + EXTRA_DEPTH)
all_mount_holes = [
    gc.Aggregate(gc.Line(0, 0, SAFE_HEIGHT),
                 gc.Translate([i, j, 0], mount_hole)) for i in [-95, 95]
    for j in [-45, 45]
]
divot = gc.Aggregate(gc.Rapid(-DIVOT_LENGTH / 2, 0, SAFE_HEIGHT),
                     gc.Line(z=-2), gc.Line(x=DIVOT_LENGTH / 2),
                     gc.Line(z=SAFE_HEIGHT))

all_divots = gc.Aggregate(
Exemplo n.º 8
0
def plunge(depth):
    return gc.Aggregate(gc.Rapid(0, 0, SAFE_HEIGHT), gc.Line(z=-depth),
                        gc.Line(z=SAFE_HEIGHT))
Exemplo n.º 9
0
    hole.add(gc.Line(z=-depth))  # go to surface
    hole.add(gc.Arc(z=-depth, i=cut_radius))
    hole.add(gc.Rapid(z=SAFE_HEIGHT))
    return hole


def plunge(depth):
    return gc.Aggregate(gc.Rapid(0, 0, SAFE_HEIGHT), gc.Line(z=-depth),
                        gc.Line(z=SAFE_HEIGHT))


def ball_drill():
    return gc.Grid(2, 9, plunge(DRILL_DEPTH))


def ball_carve():
    return plunge_hole(8, TOOL_RADIUS, DRILL_DEPTH)


all_ball_drills = gc.Grid([4, 2], 50, ball_drill(), align="bottomleft")
all_ball_carves = gc.Grid([4, 2], 50, ball_carve(), align="bottomleft")

everything = gc.Aggregate(gc.Rapid(0, 0, SAFE_HEIGHT, f=800),
                          gc.Line(0, 0, SAFE_HEIGHT, f=800))
everything.add(all_ball_drills)
#everything.add(all_ball_carves)
everything.add(gc.Rapid(x=100, y=100))
print("M03 S750\n")
print(everything)
print("M05\n")
Exemplo n.º 10
0
        result.add(gc.Line(x=x / 2))
        result.add(gc.Line(y=y / 2))
        result.add(gc.Line(x=-x / 2))
        result.add(gc.Line(y=-y / 2))
    result.add(gc.Line(z=SAFE_HEIGHT))
    return result


def drill_hole(radius, depth):
    cut_radius = radius - TOOL
    hole = gc.Aggregate()
    hole.add(gc.Rapid(-cut_radius, 0, SAFE_HEIGHT,
                      f=RAPID))  #go to start point
    hole.add(gc.Line(z=0, f=SLOW))  # go to surface
    i = 0
    while (i > -depth):
        i = max(i - INCREMENT, -depth)
        hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Arc(z=i, i=cut_radius))
    hole.add(gc.Rapid(z=SAFE_HEIGHT))
    return hole


ensemble = gc.Aggregate(
    gc.Translate([+0.8, 15.5 - OUTER[1] / 2, 0], drill_hole(2.3, 1.3),
                 drill_hole(1.6, 3.6)), rectangle(*INNER), rectangle(*OUTER))

print("M03 S750\n")
print(gc.Translate([OUTER[0] / 2, OUTER[1] / 2, 0], ensemble))
print("M05\n")
Exemplo n.º 11
0
    result.add(gc.Arc(x / 2, -y / 2, r=r))
    result.add(gc.Line(-x / 2, -y / 2))
    result.add(gc.Arc(-x / 2 - r, 0, r=r))
    result.add(gc.Arc(-x / 2, y / 2, r=r))
    result.add(gc.Rapid(z=SAFE_HEIGHT))
    return result


def rectangle(x, y, z, tool_radius):
    x -= tool_radius * 2
    y -= tool_radius * 2
    result = gc.Aggregate()
    result.add(gc.Rapid(-x / 2, y / 2, SAFE_HEIGHT, f=RAPID))
    result.add(gc.Line(-x / 2, y / 2, z, f=SLOW))
    result.add(gc.Line(x / 2, y / 2))
    result.add(gc.Line(x / 2, -y / 2))
    result.add(gc.Line(-x / 2, -y / 2))
    result.add(gc.Line(-x / 2, y / 2))
    result.add(gc.Rapid(z=SAFE_HEIGHT))
    return result


ensemble = gc.Aggregate(rounded_hole(8.7, 3.6, -2.0, 0.75),
                        rounded_hole(8.7, 3.6, -4.0, 0.75),
                        rounded_hole(9.7, 4.6, -1.4, 0.75),
                        rectangle(11, 5, -0.8, 0.75))

print("M03 S750\n")
print(gc.Translate([-0.8, 10.5, 0], ensemble))
print("M05\n")