예제 #1
0
#!/usr/bin/env python
from __future__ import division
from pcbwriter import PCBWriter
import sys

if len(sys.argv) < 2 or sys.argv[1] not in ("a", "r", "h") \
    or (sys.argv[1] == "h" and len(sys.argv) != 2) \
    or (sys.argv[1] != "h" and len(sys.argv) != 3):
    print "Usage: %s a|r|h [<pos>]" % sys.argv[0]
    sys.exit(1)

pcb = PCBWriter()

print "Absolute position before move: %d%s" % (pcb.get_stepper_status().pos,
    " [HOMED]" if pcb.get_stepper_homed() else "")

if sys.argv[1] == "h":
    pcb.home_stepper(wait=True)
elif sys.argv[1] == "a":
    pcb.move_stepper(int(sys.argv[2]), relative=False, wait=True)
elif sys.argv[1] == "r":
    pcb.move_stepper(int(sys.argv[2]), relative=True, wait=True)

print "Absolute position after move: %d%s" % (pcb.get_stepper_status().pos,
    " [HOMED]" if pcb.get_stepper_homed() else "")
예제 #2
0
xres = 2540   # dpi, i.e 10um per pixel
yres = 600

bbox_width = bbox[2] - bbox[0]
bbox_height = bbox[3] - bbox[1]

width_px = 11000 # Render 110 mm strip
height_px = int(math.ceil((yres*bbox_height)/72))

bytes_per_line = int(math.ceil(width_px / 8))

print "Loading image (%dx%d pixels):" % (width_px, height_px)
img = ghostscript.load_image(args.fname, bbox, xres, yres, width_px, height_px)

print "Setting up device"
pcb = PCBWriter()

pcb.set_n_scans(n_scans)
pcb.set_autostep(True)

print "%d bytes/line" % bytes_per_line

print "Transferring image: "

for line in range(0, height_px):
    print "Transferring line %d/%d" % (line, height_px)
    
    # line_data = array.array("B", [255]*2000)
    line_data = transform_line(img[line*bytes_per_line:(line+1)*bytes_per_line])
    
    pcb.put_line(line_data, fill=False, wait=True)
예제 #3
0
xres = 2540  # dpi, i.e 10um per pixel
yres = 600

bbox_width = bbox[2] - bbox[0]
bbox_height = bbox[3] - bbox[1]

width_px = 11000  # Render 110 mm strip
height_px = int(math.ceil((yres * bbox_height) / 72))

bytes_per_line = int(math.ceil(width_px / 8))

print "Loading image (%dx%d pixels):" % (width_px, height_px)
img = ghostscript.load_image(args.fname, bbox, xres, yres, width_px, height_px)

print "Setting up device"
pcb = PCBWriter()

pcb.set_n_scans(n_scans)
pcb.set_autostep(True)

print "%d bytes/line" % bytes_per_line

print "Transferring image: "

for line in range(0, height_px):
    print "Transferring line %d/%d" % (line, height_px)

    # line_data = array.array("B", [255]*2000)
    line_data = transform_line(img[line * bytes_per_line:(line + 1) *
                                   bytes_per_line])