Przeglądaj źródła

Clear area and mouse coordinates

Juan Pablo Caram 12 lat temu
rodzic
commit
e0d93910a6
7 zmienionych plików z 979 dodań i 2 usunięć
  1. 29 0
      camlib.py
  2. BIN
      camlib.pyc
  3. 11 2
      cirkuix.py
  4. 31 0
      cirkuix.ui
  5. 783 0
      tests/KiCad_Squarer-F_Cu.gtl
  6. 77 0
      tests/KiCad_Squarer.drl
  7. 48 0
      tests/test_excellon_1.py

+ 29 - 0
camlib.py

@@ -52,6 +52,31 @@ class Geometry:
             return 0
             return 0
         bounds = self.bounds()
         bounds = self.bounds()
         return (bounds[2]-bounds[0], bounds[3]-bounds[1])
         return (bounds[2]-bounds[0], bounds[3]-bounds[1])
+        
+    def get_empty_area(self, boundary=None):
+        '''
+        Returns the complement of self.solid_geometry within
+        the given boundary polygon. If not specified, it defaults to
+        the rectangular bounding box of self.solid_geometry.
+        '''
+        if boundary == None:
+            boundary = self.solid_geometry.envelope
+        return boundary.difference(g.solid_geometry)
+        
+    def clear_polygon(self, polygon, tooldia, overlap = 0.15):
+        '''
+        Creates geometry inside a polygon for a tool to cover
+        the whole area.
+        '''
+        poly_cuts = [polygon.buffer(-tooldia/2.0)]
+        while(1):
+            polygon = poly_cuts[-1].buffer(-tooldia*(1-overlap))
+            if polygon.area > 0:
+                poly_cuts.append(polygon)
+            else:
+                break
+        return poly_cuts
+        
 
 
 class Gerber (Geometry):
 class Gerber (Geometry):
     def __init__(self):
     def __init__(self):
@@ -131,6 +156,10 @@ class Gerber (Geometry):
         return None
         return None
         
         
     def parse_file(self, filename):
     def parse_file(self, filename):
+        '''
+        Calls Gerber.parse_lines() with array of lines
+        read from the given file.
+        '''
         gfile = open(filename, 'r')
         gfile = open(filename, 'r')
         gstr = gfile.readlines()
         gstr = gfile.readlines()
         gfile.close()
         gfile.close()

BIN
camlib.pyc


+ 11 - 2
cirkuix.py

@@ -19,7 +19,7 @@ class App:
         self.builder = Gtk.Builder()
         self.builder = Gtk.Builder()
         self.builder.add_from_file(self.gladefile)
         self.builder.add_from_file(self.gladefile)
         self.window = self.builder.get_object("window1")
         self.window = self.builder.get_object("window1")
-
+        self.positionLabel = self.builder.get_object("label3")
         #self.drawingarea = self.builder.get_object("drawingarea1")
         #self.drawingarea = self.builder.get_object("drawingarea1")
         #self.drawingarea.connect("draw", self.cairopaint)        
         #self.drawingarea.connect("draw", self.cairopaint)        
         
         
@@ -46,6 +46,8 @@ class App:
         
         
         canvas = FigureCanvas(f)  # a Gtk.DrawingArea
         canvas = FigureCanvas(f)  # a Gtk.DrawingArea
         canvas.set_size_request(600,400)
         canvas.set_size_request(600,400)
+        canvas.mpl_connect('button_press_event', self.on_click_over_plot)
+        canvas.mpl_connect('motion_notify_event', self.on_mouse_move_over_plot)
         self.grid.attach(canvas,1,1,600,400)
         self.grid.attach(canvas,1,1,600,400)
     
     
     def cairopaint(self, da, cr):
     def cairopaint(self, da, cr):
@@ -123,6 +125,13 @@ class App:
         canvas.set_size_request(600,400)
         canvas.set_size_request(600,400)
         self.grid.attach(canvas,1,1,600,400)
         self.grid.attach(canvas,1,1,600,400)
         self.window.show_all()
         self.window.show_all()
-
+        
+    def on_mouse_move_over_plot(self, event):
+        self.positionLabel.set_label("X: %.4f   Y: %.4f"%(event.xdata, event.ydata))
+        
+    def on_click_over_plot(self, event):
+        print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
+        event.button, event.x, event.y, event.xdata, event.ydata)
+        
 
 
 app = App()
 app = App()

+ 31 - 0
cirkuix.ui

@@ -320,6 +320,21 @@
                         <child>
                         <child>
                           <placeholder/>
                           <placeholder/>
                         </child>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
                       </object>
                     </child>
                     </child>
                   </object>
                   </object>
@@ -369,6 +384,22 @@
                 <property name="position">1</property>
                 <property name="position">1</property>
               </packing>
               </packing>
             </child>
             </child>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="width_request">200</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">5</property>
+                <property name="margin_right">5</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">X: 0.0    Y: 0.0</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
           </object>
           </object>
           <packing>
           <packing>
             <property name="expand">False</property>
             <property name="expand">False</property>

+ 783 - 0
tests/KiCad_Squarer-F_Cu.gtl

@@ -0,0 +1,783 @@
+G04 (created by PCBNEW (2013-07-07 BZR 4022)-stable) date 11/20/2013 5:37:08 PM*
+%MOIN*%
+G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
+%FSLAX34Y34*%
+G01*
+G70*
+G90*
+G04 APERTURE LIST*
+%ADD10C,0.00590551*%
+%ADD11C,0.015*%
+%ADD12R,0.0393X0.0629*%
+%ADD13R,0.2125X0.244*%
+%ADD14R,0.02X0.03*%
+%ADD15R,0.144X0.08*%
+%ADD16R,0.04X0.08*%
+%ADD17R,0.0394X0.0354*%
+%ADD18R,0.0354X0.0394*%
+%ADD19R,0.063X0.071*%
+%ADD20R,0.071X0.063*%
+%ADD21C,0.1*%
+%ADD22R,0.08X0.08*%
+%ADD23C,0.08*%
+%ADD24C,0.04*%
+%ADD25C,0.02*%
+G04 APERTURE END LIST*
+G54D10*
+G54D11*
+X27233Y12376D02*
+X27728Y12376D01*
+X27461Y12071D01*
+X27576Y12071D01*
+X27652Y12033D01*
+X27690Y11995D01*
+X27728Y11919D01*
+X27728Y11728D01*
+X27690Y11652D01*
+X27652Y11614D01*
+X27576Y11576D01*
+X27347Y11576D01*
+X27271Y11614D01*
+X27233Y11652D01*
+X24021Y12300D02*
+X24059Y12338D01*
+X24135Y12376D01*
+X24326Y12376D01*
+X24402Y12338D01*
+X24440Y12300D01*
+X24478Y12223D01*
+X24478Y12147D01*
+X24440Y12033D01*
+X23983Y11576D01*
+X24478Y11576D01*
+X4578Y11701D02*
+X4121Y11701D01*
+X4350Y11701D02*
+X4350Y12501D01*
+X4273Y12386D01*
+X4197Y12310D01*
+X4121Y12272D01*
+X569Y1526D02*
+X1064Y1526D01*
+X797Y1221D01*
+X911Y1221D01*
+X988Y1183D01*
+X1026Y1145D01*
+X1064Y1069D01*
+X1064Y878D01*
+X1026Y802D01*
+X988Y764D01*
+X911Y726D01*
+X683Y726D01*
+X607Y764D01*
+X569Y802D01*
+X1407Y802D02*
+X1445Y764D01*
+X1407Y726D01*
+X1369Y764D01*
+X1407Y802D01*
+X1407Y726D01*
+X1711Y1526D02*
+X2207Y1526D01*
+X1940Y1221D01*
+X2054Y1221D01*
+X2130Y1183D01*
+X2169Y1145D01*
+X2207Y1069D01*
+X2207Y878D01*
+X2169Y802D01*
+X2130Y764D01*
+X2054Y726D01*
+X1826Y726D01*
+X1750Y764D01*
+X1711Y802D01*
+X2435Y1526D02*
+X2702Y726D01*
+X2969Y1526D01*
+X1672Y14551D02*
+X1291Y14551D01*
+X1253Y14170D01*
+X1291Y14208D01*
+X1367Y14246D01*
+X1558Y14246D01*
+X1634Y14208D01*
+X1672Y14170D01*
+X1710Y14094D01*
+X1710Y13903D01*
+X1672Y13827D01*
+X1634Y13789D01*
+X1558Y13751D01*
+X1367Y13751D01*
+X1291Y13789D01*
+X1253Y13827D01*
+X1939Y14551D02*
+X2205Y13751D01*
+X2472Y14551D01*
+X26525Y14651D02*
+X26677Y14651D01*
+X26753Y14613D01*
+X26829Y14536D01*
+X26867Y14384D01*
+X26867Y14117D01*
+X26829Y13965D01*
+X26753Y13889D01*
+X26677Y13851D01*
+X26525Y13851D01*
+X26448Y13889D01*
+X26372Y13965D01*
+X26334Y14117D01*
+X26334Y14384D01*
+X26372Y14536D01*
+X26448Y14613D01*
+X26525Y14651D01*
+X27210Y14651D02*
+X27210Y14003D01*
+X27248Y13927D01*
+X27286Y13889D01*
+X27363Y13851D01*
+X27515Y13851D01*
+X27591Y13889D01*
+X27629Y13927D01*
+X27667Y14003D01*
+X27667Y14651D01*
+X27934Y14651D02*
+X28391Y14651D01*
+X28163Y13851D02*
+X28163Y14651D01*
+X17800Y13451D02*
+X17952Y13451D01*
+X18028Y13413D01*
+X18104Y13336D01*
+X18142Y13184D01*
+X18142Y12917D01*
+X18104Y12765D01*
+X18028Y12689D01*
+X17952Y12651D01*
+X17800Y12651D01*
+X17723Y12689D01*
+X17647Y12765D01*
+X17609Y12917D01*
+X17609Y13184D01*
+X17647Y13336D01*
+X17723Y13413D01*
+X17800Y13451D01*
+X18485Y13451D02*
+X18485Y12803D01*
+X18523Y12727D01*
+X18561Y12689D01*
+X18638Y12651D01*
+X18790Y12651D01*
+X18866Y12689D01*
+X18904Y12727D01*
+X18942Y12803D01*
+X18942Y13451D01*
+X19209Y13451D02*
+X19666Y13451D01*
+X19438Y12651D02*
+X19438Y13451D01*
+X8900Y13326D02*
+X9052Y13326D01*
+X9128Y13288D01*
+X9204Y13211D01*
+X9242Y13059D01*
+X9242Y12792D01*
+X9204Y12640D01*
+X9128Y12564D01*
+X9052Y12526D01*
+X8900Y12526D01*
+X8823Y12564D01*
+X8747Y12640D01*
+X8709Y12792D01*
+X8709Y13059D01*
+X8747Y13211D01*
+X8823Y13288D01*
+X8900Y13326D01*
+X9585Y13326D02*
+X9585Y12678D01*
+X9623Y12602D01*
+X9661Y12564D01*
+X9738Y12526D01*
+X9890Y12526D01*
+X9966Y12564D01*
+X10004Y12602D01*
+X10042Y12678D01*
+X10042Y13326D01*
+X10309Y13326D02*
+X10766Y13326D01*
+X10538Y12526D02*
+X10538Y13326D01*
+X28880Y726D02*
+X28880Y1526D01*
+X29261Y726D02*
+X29261Y1526D01*
+X29719Y726D01*
+X29719Y1526D01*
+X23705Y2126D02*
+X23705Y2926D01*
+X24086Y2126D02*
+X24086Y2926D01*
+X24544Y2126D01*
+X24544Y2926D01*
+X3355Y3126D02*
+X3355Y3926D01*
+X3736Y3126D02*
+X3736Y3926D01*
+X4194Y3126D01*
+X4194Y3926D01*
+G54D12*
+X12278Y8961D03*
+X14072Y8961D03*
+G54D13*
+X13175Y11834D03*
+G54D14*
+X5850Y7450D03*
+X6600Y7450D03*
+X5850Y8450D03*
+X6225Y7450D03*
+X6600Y8450D03*
+X21075Y7400D03*
+X21825Y7400D03*
+X21075Y8400D03*
+X21450Y7400D03*
+X21825Y8400D03*
+G54D15*
+X15962Y2837D03*
+G54D16*
+X15962Y5437D03*
+X15062Y5437D03*
+X16862Y5437D03*
+G54D17*
+X23150Y6429D03*
+X23150Y7021D03*
+G54D18*
+X20546Y5800D03*
+X19954Y5800D03*
+G54D17*
+X22825Y7829D03*
+X22825Y8421D03*
+X21825Y9404D03*
+X21825Y9996D03*
+G54D18*
+X19579Y9325D03*
+X20171Y9325D03*
+X4454Y9325D03*
+X5046Y9325D03*
+G54D17*
+X6600Y9629D03*
+X6600Y10221D03*
+X7600Y8004D03*
+X7600Y8596D03*
+X8000Y6429D03*
+X8000Y7021D03*
+G54D18*
+X5171Y5850D03*
+X4579Y5850D03*
+G54D19*
+X12650Y7900D03*
+X13750Y7900D03*
+G54D20*
+X11025Y9750D03*
+X11025Y10850D03*
+X13737Y4387D03*
+X13737Y5487D03*
+G54D19*
+X16962Y6787D03*
+X15862Y6787D03*
+G54D17*
+X20175Y7804D03*
+X20175Y8396D03*
+X6225Y5854D03*
+X6225Y6446D03*
+G54D18*
+X16608Y7712D03*
+X16016Y7712D03*
+X23421Y9375D03*
+X22829Y9375D03*
+X24296Y7850D03*
+X23704Y7850D03*
+G54D17*
+X21450Y5804D03*
+X21450Y6396D03*
+G54D18*
+X9146Y8000D03*
+X8554Y8000D03*
+X8196Y9625D03*
+X7604Y9625D03*
+G54D17*
+X10100Y10104D03*
+X10100Y10696D03*
+X5050Y7854D03*
+X5050Y8446D03*
+G54D14*
+X28950Y6850D03*
+X29700Y6850D03*
+X28950Y7850D03*
+X29325Y6850D03*
+X29700Y7850D03*
+G54D21*
+X21825Y11925D03*
+X22825Y12925D03*
+X20825Y12925D03*
+X20825Y10925D03*
+X22825Y10925D03*
+X21450Y3475D03*
+X22450Y4475D03*
+X20450Y4475D03*
+X20450Y2475D03*
+X22450Y2475D03*
+X29325Y3475D03*
+X30325Y4475D03*
+X28325Y4475D03*
+X28325Y2475D03*
+X30325Y2475D03*
+X29700Y11925D03*
+X30700Y12925D03*
+X28700Y12925D03*
+X28700Y10925D03*
+X30700Y10925D03*
+G54D17*
+X27425Y8571D03*
+X27425Y7979D03*
+G54D22*
+X1375Y8325D03*
+G54D23*
+X1375Y9325D03*
+X1375Y10325D03*
+G54D22*
+X16375Y9625D03*
+G54D23*
+X16375Y10625D03*
+X16375Y11625D03*
+G54D22*
+X26375Y8425D03*
+G54D23*
+X26375Y9425D03*
+X26375Y10425D03*
+G54D22*
+X10225Y2475D03*
+G54D23*
+X11225Y2475D03*
+G54D22*
+X28375Y8850D03*
+G54D21*
+X10400Y6275D03*
+X25125Y5450D03*
+X6600Y11925D03*
+X7600Y12925D03*
+X5600Y12925D03*
+X5600Y10925D03*
+X7600Y10925D03*
+X6225Y3475D03*
+X7225Y4475D03*
+X5225Y4475D03*
+X5225Y2475D03*
+X7225Y2475D03*
+G54D17*
+X28225Y7254D03*
+X28225Y7846D03*
+G54D23*
+X12375Y2475D03*
+X30075Y6475D03*
+X28225Y6775D03*
+X20350Y7075D03*
+X22300Y6950D03*
+X7100Y6900D03*
+X19475Y5175D03*
+X24325Y9375D03*
+X25175Y7850D03*
+X17525Y7600D03*
+X13625Y3325D03*
+X11025Y8900D03*
+X10000Y8000D03*
+X8875Y9625D03*
+X4950Y7275D03*
+X3825Y5850D03*
+G54D24*
+X15962Y2837D02*
+X15962Y1162D01*
+X15962Y1162D02*
+X15975Y1150D01*
+X16375Y9625D02*
+X17450Y9625D01*
+X18650Y8425D02*
+X18650Y1150D01*
+X17450Y9625D02*
+X18650Y8425D01*
+X26375Y8425D02*
+X26375Y7775D01*
+X26350Y7800D02*
+X26375Y7775D01*
+X26375Y7775D02*
+X26975Y7175D01*
+X25700Y1150D02*
+X18650Y1150D01*
+X18650Y1150D02*
+X16925Y1150D01*
+X15975Y1150D02*
+X16925Y1150D01*
+X26975Y2425D02*
+X25700Y1150D01*
+X26975Y7175D02*
+X26975Y2425D01*
+X15962Y2837D02*
+X15962Y5437D01*
+X13175Y1150D02*
+X13550Y1150D01*
+X1375Y8325D02*
+X1375Y3774D01*
+X4000Y1150D02*
+X13175Y1150D01*
+X1375Y3774D02*
+X4000Y1150D01*
+X13550Y1150D02*
+X15975Y1150D01*
+G54D25*
+X16016Y7712D02*
+X15862Y7558D01*
+X15862Y7558D02*
+X15862Y6787D01*
+G54D24*
+X15962Y5437D02*
+X15962Y6112D01*
+X15862Y6212D02*
+X15862Y6787D01*
+X15962Y6112D02*
+X15862Y6212D01*
+X13175Y11834D02*
+X13175Y14200D01*
+X13150Y14225D02*
+X13150Y14200D01*
+X13175Y14200D02*
+X13150Y14225D01*
+X16375Y11625D02*
+X16400Y11650D01*
+X16400Y14175D02*
+X16400Y14200D01*
+X16400Y11650D02*
+X16400Y14175D01*
+X26375Y10425D02*
+X26375Y12750D01*
+X9775Y14200D02*
+X13150Y14200D01*
+X1375Y11475D02*
+X4100Y14200D01*
+X4100Y14200D02*
+X9775Y14200D01*
+X1375Y10325D02*
+X1375Y11475D01*
+X13150Y14200D02*
+X15025Y14200D01*
+X26375Y12750D02*
+X24925Y14200D01*
+X24925Y14200D02*
+X16400Y14200D01*
+X16400Y14200D02*
+X14825Y14200D01*
+X11025Y10850D02*
+X12191Y10850D01*
+X12191Y10850D02*
+X13175Y11834D01*
+G54D25*
+X10100Y10696D02*
+X10871Y10696D01*
+X10871Y10696D02*
+X11025Y10850D01*
+X6225Y3399D02*
+X6225Y5854D01*
+X6225Y5854D02*
+X5175Y5854D01*
+X5175Y5854D02*
+X5171Y5850D01*
+X21450Y3799D02*
+X21450Y5804D01*
+X20546Y5800D02*
+X21446Y5800D01*
+X21446Y5800D02*
+X21450Y5804D01*
+X6600Y10221D02*
+X6600Y11575D01*
+X21825Y11525D02*
+X21825Y9996D01*
+X8000Y7021D02*
+X8000Y7200D01*
+X7600Y7600D02*
+X7600Y8004D01*
+X8000Y7200D02*
+X7600Y7600D01*
+X7600Y8004D02*
+X8550Y8004D01*
+X8550Y8004D02*
+X8554Y8000D01*
+X10400Y6275D02*
+X9875Y6275D01*
+X9721Y6429D02*
+X9875Y6275D01*
+X9721Y6429D02*
+X8000Y6429D01*
+X6225Y6446D02*
+X6554Y6446D01*
+X7579Y6429D02*
+X8000Y6429D01*
+X7375Y6225D02*
+X7579Y6429D01*
+X6775Y6225D02*
+X7375Y6225D01*
+X6554Y6446D02*
+X6775Y6225D01*
+X8000Y6429D02*
+X8000Y6275D01*
+X8000Y6275D02*
+X8000Y6429D01*
+X6225Y6446D02*
+X6225Y7450D01*
+X6600Y9629D02*
+X6600Y8450D01*
+X7604Y9625D02*
+X6604Y9625D01*
+X6604Y9625D02*
+X6600Y9629D01*
+X7600Y8596D02*
+X7600Y9621D01*
+X7600Y9621D02*
+X7604Y9625D01*
+X23150Y7021D02*
+X23150Y7275D01*
+X22825Y7600D02*
+X22825Y7829D01*
+X23150Y7275D02*
+X22825Y7600D01*
+X22825Y7829D02*
+X23683Y7829D01*
+X23683Y7829D02*
+X23704Y7850D01*
+X24725Y6050D02*
+X25125Y5650D01*
+X24346Y6429D02*
+X24725Y6050D01*
+X23150Y6429D02*
+X24346Y6429D01*
+X25125Y5650D02*
+X25125Y5450D01*
+X21450Y6396D02*
+X21679Y6396D01*
+X23150Y6425D02*
+X23150Y6429D01*
+X22775Y6425D02*
+X23150Y6425D01*
+X22600Y6250D02*
+X22775Y6425D01*
+X21825Y6250D02*
+X22600Y6250D01*
+X21679Y6396D02*
+X21825Y6250D01*
+X21450Y7400D02*
+X21450Y6396D01*
+X21825Y8400D02*
+X21825Y9404D01*
+X21825Y9404D02*
+X21854Y9375D01*
+X21854Y9375D02*
+X22829Y9375D01*
+X22829Y9375D02*
+X22825Y9371D01*
+X22825Y9371D02*
+X22825Y8421D01*
+G54D24*
+X1375Y9325D02*
+X4454Y9325D01*
+X5050Y8725D02*
+X5050Y9321D01*
+X5050Y9321D02*
+X5046Y9325D01*
+X5050Y8446D02*
+X5050Y8725D01*
+X5850Y8725D02*
+X5850Y8450D01*
+X5050Y8725D02*
+X5850Y8725D01*
+X19579Y9325D02*
+X19400Y9325D01*
+X18100Y10625D02*
+X19400Y9325D01*
+X18100Y10625D02*
+X16375Y10625D01*
+X20171Y9325D02*
+X20171Y8400D01*
+X20171Y8400D02*
+X21075Y8400D01*
+X26375Y9425D02*
+X27050Y9425D01*
+X27425Y8625D02*
+X27425Y8571D01*
+X27425Y9050D02*
+X27425Y8625D01*
+X27050Y9425D02*
+X27425Y9050D01*
+G54D25*
+X28375Y8850D02*
+X28375Y7925D01*
+X28375Y7925D02*
+X28225Y7846D01*
+G54D24*
+X28225Y7846D02*
+X28921Y7846D01*
+X28925Y7850D02*
+X28950Y7850D01*
+X28921Y7846D02*
+X28925Y7850D01*
+X28225Y7846D02*
+X27454Y7846D01*
+X27425Y7875D02*
+X27425Y7979D01*
+X27454Y7846D02*
+X27425Y7875D01*
+X10225Y2475D02*
+X10225Y2950D01*
+X12175Y5550D02*
+X12162Y5550D01*
+X12175Y4900D02*
+X12175Y5550D01*
+X10225Y2950D02*
+X12175Y4900D01*
+X13750Y7900D02*
+X14072Y8222D01*
+X12162Y5487D02*
+X12162Y5550D01*
+X12162Y5550D02*
+X12162Y6362D01*
+X14072Y7147D02*
+X14072Y8961D01*
+X13650Y6725D02*
+X14072Y7147D01*
+X12525Y6725D02*
+X13650Y6725D01*
+X12162Y6362D02*
+X12525Y6725D01*
+X12162Y5487D02*
+X13737Y5487D01*
+X15062Y5437D02*
+X13787Y5437D01*
+X13787Y5437D02*
+X13737Y5487D01*
+X14072Y8222D02*
+X14072Y8961D01*
+X11225Y2475D02*
+X12375Y2475D01*
+G54D25*
+X29700Y6850D02*
+X29800Y6750D01*
+X29800Y6750D02*
+X29700Y6850D01*
+G54D24*
+X29825Y6725D02*
+X30100Y6450D01*
+X28225Y6800D02*
+X28800Y6800D01*
+X28850Y6800D02*
+X28825Y6775D01*
+X28800Y6800D02*
+X28850Y6800D01*
+X28225Y7254D02*
+X28225Y6800D01*
+X28225Y6800D02*
+X28225Y6800D01*
+X28225Y6800D02*
+X28225Y6775D01*
+G54D25*
+X21075Y7400D02*
+X20900Y7400D01*
+G54D24*
+X20900Y7400D02*
+X20625Y7400D01*
+G54D25*
+X5850Y7450D02*
+X5725Y7450D01*
+G54D24*
+X5050Y7475D02*
+X5075Y7450D01*
+X5075Y7450D02*
+X5725Y7450D01*
+X5050Y7475D02*
+X5050Y7854D01*
+X20625Y7400D02*
+X20350Y7125D01*
+X20350Y7125D02*
+X20350Y7075D01*
+G54D25*
+X21825Y7400D02*
+X21850Y7400D01*
+X21850Y7400D02*
+X22300Y6950D01*
+X6600Y7450D02*
+X6625Y7450D01*
+X7125Y6925D02*
+X7100Y6900D01*
+X7150Y6925D02*
+X7125Y6925D01*
+X6625Y7450D02*
+X7150Y6925D01*
+G54D24*
+X19954Y5800D02*
+X19479Y5179D01*
+X19479Y5179D02*
+X19475Y5175D01*
+X23421Y9375D02*
+X24325Y9375D01*
+X24296Y7850D02*
+X25175Y7850D01*
+X16962Y6787D02*
+X16962Y7037D01*
+X16962Y7037D02*
+X17525Y7600D01*
+X13737Y4387D02*
+X13737Y3437D01*
+X13737Y3437D02*
+X13625Y3325D01*
+X11025Y9750D02*
+X11025Y8900D01*
+X9146Y8000D02*
+X10000Y8000D01*
+X8196Y9625D02*
+X8875Y9625D01*
+X5050Y7854D02*
+X5050Y7375D01*
+X5050Y7375D02*
+X4950Y7275D01*
+X4579Y5850D02*
+X3825Y5850D01*
+G54D25*
+X16608Y7712D02*
+X16962Y7358D01*
+X16962Y7358D02*
+X16962Y6787D01*
+G54D24*
+X16862Y5437D02*
+X16962Y5537D01*
+X16962Y5537D02*
+X16962Y6787D01*
+X12278Y8961D02*
+X12278Y8272D01*
+X12278Y8272D02*
+X12650Y7900D01*
+X11025Y9750D02*
+X11489Y9750D01*
+X11489Y9750D02*
+X12278Y8961D01*
+G54D25*
+X10100Y10104D02*
+X10454Y9750D01*
+X10454Y9750D02*
+X11025Y9750D01*
+G54D24*
+X20175Y7804D02*
+X20175Y7750D01*
+X20525Y7400D02*
+X20625Y7400D01*
+X20175Y7750D02*
+X20525Y7400D01*
+G54D25*
+X29325Y6850D02*
+X29325Y3475D01*
+X29700Y11925D02*
+X29700Y7850D01*
+M02*

+ 77 - 0
tests/KiCad_Squarer.drl

@@ -0,0 +1,77 @@
+M48
+;DRILL file {Pcbnew (2013-07-07 BZR 4022)-stable} date 11/20/2013 1:52:19 PM
+;FORMAT={2:4/ absolute / inch / keep zeros}
+FMAT,2
+INCH,TZ
+T1C0.030
+T2C0.040
+T3C0.060
+%
+G90
+G05
+M72
+T1
+X010400Y006275
+X025125Y005450
+T2
+X001375Y010325
+X001375Y009325
+X001375Y008325
+X003825Y005850
+X004950Y007275
+X007100Y006900
+X008875Y009625
+X010000Y008000
+X010225Y002475
+X011025Y008900
+X011225Y002475
+X012375Y002475
+X013625Y003325
+X016375Y011625
+X016375Y010625
+X016375Y009625
+X017525Y007600
+X019475Y005175
+X020350Y007075
+X022300Y006950
+X024325Y009375
+X025175Y007850
+X026375Y010425
+X026375Y009425
+X026375Y008425
+X028225Y006775
+X028375Y008850
+X030075Y006475
+T3
+X005225Y004475
+X005225Y002475
+X005600Y012925
+X005600Y010925
+X006225Y003475
+X006600Y011925
+X007225Y004475
+X007225Y002475
+X007600Y012925
+X007600Y010925
+X020450Y004475
+X020450Y002475
+X020825Y012925
+X020825Y010925
+X021450Y003475
+X021825Y011925
+X022450Y004475
+X022450Y002475
+X022825Y012925
+X022825Y010925
+X028325Y004475
+X028325Y002475
+X028700Y012925
+X028700Y010925
+X029325Y003475
+X029700Y011925
+X030325Y004475
+X030325Y002475
+X030700Y012925
+X030700Y010925
+T0
+M30

+ 48 - 0
tests/test_excellon_1.py

@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Sun Jan 05 13:30:47 2014
+
+@author: jpcaram
+"""
+
+import os
+os.chdir('../')
+
+from camlib import *
+#from matplotlib.figure import Figure
+from matplotlib import pyplot
+
+# Gerber. To see if the Excellon is correct
+project_dir = "tests/"
+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
+    plot(x, y, 'k-')
+    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
+    plot(x, y, 'r-')
+    for ints in geo.interiors:
+        x, y = ints.coords.xy
+        ax.plot(x, y, 'g-')
+        
+fig.show()