Example #1
0
def load_text2(z):
    s = 0.3
    t1 = GCode.from_file('text/Home is where.nc').depth(G0Z, z)
    t2 = GCode.from_file('text/your stop is.nc').depth(G0Z, z)
    t1 = t1.scale(s, s)
    t2 = t2.scale(s, s)
    t1 = t1.move(3, 2.75, 0.5, 0.5)
    t2 = t2.move(3, 2.25, 0.5, 0.5)
    return t1 + t2
Example #2
0
def load_text1(z):
    s = 0.3
    t1 = GCode.from_file('text/TransLoc.nc').depth(G0Z, z)
    t2 = GCode.from_file('text/OnDemand.nc').depth(G0Z, z)
    t1 = t1.scale(s, s)
    t2 = t2.scale(s, s)
    t1 = t1.move(3 - 0.125, 6.75, 1, 0.5)
    t2 = t2.move(3 + 0.125, 6.75, 0, 0.5)
    return t1 + t2
Example #3
0
def generate_text(name, x, y, scale, angle):
    g = GCode.from_file('text/%s.nc' % name)
    g = g.depth(G0Z, G1Z_TEXT)
    g = g.scale(scale, scale)
    g = g.rotate(angle)
    g = g.move(x, y, 0.5, 0.5)
    return g
Example #4
0
def main():
    g0z = 0.2
    g1z = -0.01
    w = 32
    h = 6
    g = GCode()
    for i, (name, au, radius) in enumerate(PLANETS):
        p = (au + 0.25) / (PLANETS[-1][1] + 1)
        x = w * p
        t = GCode.from_file('text/%s.nc' % name)
        t = t.depth(0.2, -0.01)
        t = t.rotate(90).scale(0.2, 0.2)
        t = t.move(x, 0.75, 0.5, 0.5)
        _, ty1, _, ty2 = t.bounds
        g += t
        if i > 0:
            r = 1.2 * radius / 71492.68
            y1 = h / 2 - r
            y2 = h / 2 + r
            g += GCode(['G0 X%f Y%f' % (x, y1), 'G3 X%f Y%f I%f J%f' % (x, y2, 0, r), 'G3 X%f Y%f I%f J%f' % (x, y1, 0, -r)])
            g += GCode.from_points([(x, 0), (x, ty1 - 0.1)], g0z, g1z)
            g += GCode.from_points([(x, ty2 + 0.1), (x, y1-0.1)], g0z, g1z)
            g += GCode.from_points([(x, y2+0.1), (x, h)], g0z, g1z)
        else:
            g += GCode.from_points([(x, 0), (x, ty1 - 0.1)], g0z, g1z)
            g += GCode.from_points([(x, ty2 + 0.1), (x, h)], g0z, g1z)
    im = g.render(0, 0, 32, 6, 96)
    im.write_to_png('planets.png')
Example #5
0
def main():
    sep = GCode.from_points([(3, 0), (3, 8)], 0.2, -0.05)

    t1 = GCode.from_file('text/Planet Earth.nc')
    t2 = GCode.from_file('text/Lambert Azimuthal Equal-Area.nc')
    t3 = GCode.from_file('text/0 N 110 W.nc')
    t4 = GCode.from_file('text/Michael Fogleman.nc')
    t5 = GCode.from_file('text/July 2015.nc')

    t1 = t1.scale(1.25, 1.25)
    t2 = t2.scale(0.55, 0.55)
    t3 = t3.scale(0.55, 0.55)

    t1 = t1.move(0, 0, 0.5, 0.5).depth(0.2, -0.07)
    t2 = t2.move(0, 0, 0.5, 0.5).depth(0.2, -0.03)
    t3 = t3.move(0, 0, 0.5, 0.5).depth(0.2, -0.03)
    t4 = t4.move(0, 0, 0.5, 0.5).depth(0.2, -0.05)
    t5 = t5.move(0, 0, 0.5, 0.5).depth(0.2, -0.05)

    t1 = t1.translate(0, 6.5)
    t2 = t2.translate(0, 5)
    t3 = t3.translate(0, 4)
    t4 = t4.translate(0, 2)
    t5 = t5.translate(0, 0)

    t = t1 + t2 + t3
    b = t4 + t5
    s = 2.0 / 3.0
    t = t.scale(s, s)
    b = b.scale(s, s)
    t = t.rotate(90)
    b = b.rotate(90)
    t = t.move(1.5, 4, 0.5, 0.5)
    b = b.move(4.5, 4, 0.5, 0.5)
    t = t + b
    t = t + sep
    t = HEADER + t + FOOTER
    p = 0.25
    im = t.render(0-p, 0-p, 6+p, 8+p, 96)
    im.write_to_png('engrave.png')
    t.save('engrave.nc')