2014-01-06 02:45:08 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Created on Sun Jan 05 13:30:47 2014
|
|
|
|
|
|
|
|
@author: jpcaram
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
os.chdir('../')
|
|
|
|
|
2019-10-06 12:56:41 +00:00
|
|
|
from flatcamParsers.ParseGerber import *
|
|
|
|
from flatcamParsers.ParseExcellon import *
|
|
|
|
|
2014-01-06 02:45:08 +00:00
|
|
|
from matplotlib import pyplot
|
|
|
|
|
|
|
|
# Gerber. To see if the Excellon is correct
|
2019-10-06 12:56:41 +00:00
|
|
|
project_dir = "tests/gerber_files"
|
2014-01-06 02:45:08 +00:00
|
|
|
gerber_filename = project_dir + "KiCad_Squarer-F_Cu.gtl"
|
|
|
|
g = Gerber()
|
|
|
|
g.parse_file(gerber_filename)
|
|
|
|
g.create_geometry()
|
|
|
|
|
|
|
|
excellon_filename = project_dir + "KiCad_Squarer.drl"
|
|
|
|
ex = Excellon()
|
|
|
|
ex.parse_file(excellon_filename)
|
|
|
|
ex.create_geometry()
|
|
|
|
|
|
|
|
#fig = Figure()
|
|
|
|
fig = pyplot.figure()
|
|
|
|
ax = fig.add_subplot(111)
|
|
|
|
ax.set_aspect(1)
|
|
|
|
|
|
|
|
# Plot gerber
|
|
|
|
for geo in g.solid_geometry:
|
|
|
|
x, y = geo.exterior.coords.xy
|
2019-10-06 12:56:41 +00:00
|
|
|
pyplot.plot(x, y, 'k-')
|
2014-01-06 02:45:08 +00:00
|
|
|
for ints in geo.interiors:
|
|
|
|
x, y = ints.coords.xy
|
|
|
|
ax.plot(x, y, 'k-')
|
|
|
|
|
|
|
|
# Plot excellon
|
|
|
|
for geo in ex.solid_geometry:
|
|
|
|
x, y = geo.exterior.coords.xy
|
2019-10-06 12:56:41 +00:00
|
|
|
pyplot.plot(x, y, 'r-')
|
2014-01-06 02:45:08 +00:00
|
|
|
for ints in geo.interiors:
|
|
|
|
x, y = ints.coords.xy
|
|
|
|
ax.plot(x, y, 'g-')
|
|
|
|
|
|
|
|
fig.show()
|