o.add_option("--son0", "--search-outline-nonzero", dest="search_outline_nonzero", default=False, action="store_true", help="Also look at non-zero lines when determining board outline [WARNING, SLOW]") (options, args) = o.parse_args() if (len(args) != 2): o.error("incorrect number of arguments") exit(1) if not options.rendermode in plot_modes.modes: o.error("MODE must be one of %s" % ", ".join(plot_modes.modes)) exit(1) path, outputfilename = args mode = options.rendermode GD.setDebugLevel(GD.debug_level_t(options.debuglevel)) plotmode = plot_modes.getPlotSettings(options.rendermode) def createCairoLineCenterLinePath(obj, cr): cr.move_to (obj.sx, obj.sy); cr.line_to (obj.ex, obj.ey); def renderGerberFile(rep, cr, layer, outlines): ps = plotmode.getPlotSettings(layer) cr.push_group() if not ps.drawinverted: cr.set_operator(cairo.OPERATOR_OVER)
#!/usr/bin/python import gerberDRC as GD import gerberDRC.util as GU import sys path = sys.argv[1] GD.setDebugLevel(GD.debug_level_t(0)) f = GD.parseFile(path) if not f: print "Could not parse file %s" % path exit(1) p = GD.runRS274XProgram(f) if not p: print "Could not run program" exit(1) for n, i in enumerate(p.layers): print "Layer %d: '%s'" % (n,i.name) print "\tpolarity: %s" %(i.polarity) import cairo._cairo as cairo def createCairoLineCenterLinePath(obj, cr): cr.move_to (obj.sx, obj.sy);
"Also look at non-zero lines when determining board outline [WARNING, SLOW]" ) (options, args) = o.parse_args() if (len(args) != 2): o.error("incorrect number of arguments") exit(1) if not options.rendermode in plot_modes.modes: o.error("MODE must be one of %s" % ", ".join(plot_modes.modes)) exit(1) path, outputfilename = args mode = options.rendermode GD.setDebugLevel(GD.debug_level_t(options.debuglevel)) plotmode = plot_modes.getPlotSettings(options.rendermode) def createCairoLineCenterLinePath(obj, cr): cr.move_to(obj.sx, obj.sy) cr.line_to(obj.ex, obj.ey) def renderGerberFile(rep, cr, layer, outlines): ps = plotmode.getPlotSettings(layer) cr.push_group() if not ps.drawinverted: cr.set_operator(cairo.OPERATOR_OVER)