diff --git a/camlib.py b/camlib.py index b74a33e4..3d81060c 100644 --- a/camlib.py +++ b/camlib.py @@ -46,7 +46,20 @@ class Gerber(): self.flashes = [] # Final geometry: MultiPolygon - self.solid_geometry = None + self.solid_geometry = None + + def bounds(self): + if self.solid_geometry == None: + print "Warning: solid_geometry not computed yet." + return (0,0,0,0) + return self.solid_geometry.bounds + + def size(self): + if self.solid_geometry == None: + print "Warning: solid_geometry not computed yet." + return 0 + bounds = self.bounds() + return (bounds[2]-bounds[0], bounds[3]-bounds[1]) def fix_regions(self): ''' diff --git a/camlib.pyc b/camlib.pyc index 55cc6f2a..db626d70 100644 Binary files a/camlib.pyc and b/camlib.pyc differ diff --git a/cirkuix.py b/cirkuix.py index 1ec50eba..05028bed 100644 --- a/cirkuix.py +++ b/cirkuix.py @@ -33,11 +33,16 @@ class App: Gtk.main() def mplpaint(self): - f = Figure(figsize=(5,4), dpi=50) + f = Figure(dpi=50) a = f.add_subplot(111) - t = arange(0.0,3.0,0.01) + a.set_aspect(1) + t = arange(0.0,5.0,0.01) s = sin(2*pi*t) a.plot(t,s) + a.grid() + #a.patch.set_visible(False) Background of the axes + f.patch.set_visible(False) + f.tight_layout() canvas = FigureCanvas(f) # a Gtk.DrawingArea canvas.set_size_request(600,400) @@ -102,14 +107,18 @@ class App: dialog.destroy() def plot_gerber(self, gerber): - f = Figure(figsize=(5,4), dpi=200) + + f = Figure(dpi=75) a = f.add_subplot(111) + a.set_aspect(1) for poly in gerber.solid_geometry: x, y = poly.exterior.xy a.plot(x, y) for ints in poly.interiors: x, y = ints.coords.xy a.plot(x, y) + a.grid() + f.tight_layout() canvas = FigureCanvas(f) # a Gtk.DrawingArea canvas.set_size_request(600,400) self.grid.attach(canvas,1,1,600,400) diff --git a/cirkuix.ui b/cirkuix.ui index 5b794be4..a7d5408d 100644 --- a/cirkuix.ui +++ b/cirkuix.ui @@ -195,6 +195,36 @@ 3 3 vertical + + + Merge Geometry + True + True + False + 0 + True + + + False + True + 0 + + + + + Different Colors + True + True + False + 0 + True + + + False + True + 1 + + True @@ -203,7 +233,7 @@ True False - Tool dia.: + Scale (pix./unit): False @@ -212,10 +242,13 @@ - + True True + True + 10 + True False @@ -227,22 +260,16 @@ False True - 0 + 2 - - - - - - True False - Isolation Routing + Gerber False @@ -293,21 +320,6 @@ - - - - - - - - - - - - - - -