示例#1
0
文件: draw.py 项目: bradodarb/PyGRBL
def main(etch_file, args=None):
    start = datetime.now()
    name = etch_file if isinstance(etch_file, str) else etch_file.name
    puts(
        colored.blue('Visualizing the file: %s\n Started: %s' %
                     (name, datetime.now())))

    # Read in the gcode
    gcode = GCode(etch_file, limit=None)
    gcode.parse()

    # parse the code into an array of tool moves
    tool = Tool(gcode)
    box = tool.boundBox()

    # proces and save image
    outfile = os.path.splitext(etch_file.name)[0] + '.eps'
    print box
    print box[0:2]
    image = Drawing(outfile)  #, bbox=box)
    image.process(tool)
    image.save()

    # how long did this take?
    puts(colored.green('Time to completion: %s' % (deltaTime(start))))
    print
示例#2
0
def main(gfile, args=None):
    start = datetime.now()
    name = gfile if isinstance(gfile, str) else gfile.name
    puts(
        colored.blue('Visualizing the file: %s\n Started: %s' %
                     (name, datetime.now())))

    # Read in the gcode
    gcode = GCode(gfile, limit=None)
    gcode.parse()

    # parse the code into an array of tool moves
    tool = Tool(gcode)
    tool.uniq()
    box = tool.boundBox()

    # proces and save image
    ext = args.ext if args is not None else '.pdf'
    outfile = os.path.splitext(gfile.name)[0] + FILEENDING + ext
    print box
    print box[0:2]
    image = Image(outfile, gridsize=box[0:2])
    image.process(tool)
    image.save()

    # how long did this take?
    puts(colored.green('Time to completion: %s' % (deltaTime(start))))
    print
示例#3
0
def main(gfile, args=None):
	start = datetime.now()
	name = gfile if isinstance(gfile,str) else gfile.name
	puts(colored.blue('Visualizing the file: %s\n Started: %s'%(name,datetime.now())))

	# Read in the gcode
	gcode = GCode(gfile, limit=None)
	gcode.parse()
	
	# parse the code into an array of tool moves
	tool = Tool(gcode)
	tool.uniq()
	box = tool.boundBox()
	
	# proces and save image
	ext = args.ext if args is not None else '.pdf'
	outfile = os.path.splitext(gfile.name)[0] + FILEENDING + ext
	print box
	print box[0:2]
	image = Image(outfile, gridsize=box[0:2])
	image.process(tool)
	image.save()

	# how long did this take?
  	puts(colored.green('Time to completion: %s'%(deltaTime(start))))
  	print
示例#4
0
文件: draw.py 项目: ajmendez/PyGRBL
def main(etch_file, args=None):
	start = datetime.now()
	name = etch_file if isinstance(etch_file,str) else etch_file.name
	puts(colored.blue('Visualizing the file: %s\n Started: %s'%(name,datetime.now())))

	# Read in the gcode
	gcode = GCode(etch_file, limit=None)
	gcode.parse()
	
	# parse the code into an array of tool moves
	tool = Tool(gcode)
	box = tool.boundBox()
	
	# proces and save image
	outfile = os.path.splitext(etch_file.name)[0] + '.eps'
	print box
	print box[0:2]
	image = Drawing(outfile)#, bbox=box)
	image.process(tool)
	image.save()

	# how long did this take?
  	puts(colored.green('Time to completion: %s'%(deltaTime(start))))
  	print