コード例 #1
0
ファイル: end_panel_drill.py プロジェクト: furbrain/SAP5
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
コード例 #2
0
ファイル: ball_driller.py プロジェクト: furbrain/gcodelib
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
コード例 #3
0
ファイル: end_panel_drill.py プロジェクト: furbrain/SAP5
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
コード例 #4
0
ファイル: ball_holder.py プロジェクト: furbrain/gcodelib
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
コード例 #5
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
コード例 #6
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
コード例 #7
0
ファイル: ball_holder.py プロジェクト: furbrain/gcodelib
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))
コード例 #8
0
ファイル: ball_driller.py プロジェクト: furbrain/gcodelib
def plunge(depth):
    return gc.Aggregate(gc.Rapid(0, 0, SAFE_HEIGHT), gc.Line(z=-depth),
                        gc.Line(z=SAFE_HEIGHT))
コード例 #9
0
ファイル: ball_driller.py プロジェクト: furbrain/gcodelib
    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")