test_excellon_1.py 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sun Jan 05 13:30:47 2014
  4. @author: jpcaram
  5. """
  6. from camlib import *
  7. #from matplotlib.figure import Figure
  8. from matplotlib import pyplot
  9. # Gerber. To see if the Excellon is correct
  10. project_dir = "C:/Users/jpcaram/Dropbox/VNA/KiCad_Squarer/"
  11. gerber_filename = project_dir + "KiCad_Squarer-F_Cu.gtl"
  12. g = Gerber()
  13. g.parse_file(gerber_filename)
  14. g.create_geometry()
  15. excellon_filename = project_dir + "KiCad_Squarer.drl"
  16. ex = Excellon()
  17. ex.parse_file(excellon_filename)
  18. ex.create_geometry()
  19. #fig = Figure()
  20. fig = pyplot.figure()
  21. ax = fig.add_subplot(111)
  22. ax.set_aspect(1)
  23. # Plot gerber
  24. for geo in g.solid_geometry:
  25. x, y = geo.exterior.coords.xy
  26. plot(x, y, 'k-')
  27. for ints in geo.interiors:
  28. x, y = ints.coords.xy
  29. ax.plot(x, y, 'k-')
  30. # Plot excellon
  31. for geo in ex.solid_geometry:
  32. x, y = geo.exterior.coords.xy
  33. plot(x, y, 'r-')
  34. for ints in geo.interiors:
  35. x, y = ints.coords.xy
  36. ax.plot(x, y, 'g-')
  37. fig.show()