Fixed bug preventing from saving G-Code.
This commit is contained in:
parent
b44807d068
commit
97a1e17b0d
@ -858,7 +858,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(caption="Export G-Code ...",
|
filename = QtGui.QFileDialog.getSaveFileName(caption="Export G-Code ...",
|
||||||
directory=self.app.last_folder)
|
directory=self.app.defaults["last_folder"])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(caption="Export G-Code ...")
|
filename = QtGui.QFileDialog.getSaveFileName(caption="Export G-Code ...")
|
||||||
|
|
||||||
|
@ -4,8 +4,10 @@ import inspect # TODO: Remove
|
|||||||
import FlatCAMApp
|
import FlatCAMApp
|
||||||
from PyQt4 import Qt, QtGui, QtCore
|
from PyQt4 import Qt, QtGui, QtCore
|
||||||
|
|
||||||
|
|
||||||
class ObjectCollection(QtCore.QAbstractListModel):
|
class ObjectCollection(QtCore.QAbstractListModel):
|
||||||
|
"""
|
||||||
|
Object storage and management.
|
||||||
|
"""
|
||||||
|
|
||||||
classdict = {
|
classdict = {
|
||||||
"gerber": FlatCAMGerber,
|
"gerber": FlatCAMGerber,
|
||||||
@ -39,9 +41,13 @@ class ObjectCollection(QtCore.QAbstractListModel):
|
|||||||
|
|
||||||
self.click_modifier = None
|
self.click_modifier = None
|
||||||
|
|
||||||
|
## GUI Events
|
||||||
self.view.selectionModel().selectionChanged.connect(self.on_list_selection_change)
|
self.view.selectionModel().selectionChanged.connect(self.on_list_selection_change)
|
||||||
self.view.activated.connect(self.on_item_activated)
|
self.view.activated.connect(self.on_item_activated)
|
||||||
|
|
||||||
|
def on_key(self, event):
|
||||||
|
print event
|
||||||
|
|
||||||
def on_mouse_down(self, event):
|
def on_mouse_down(self, event):
|
||||||
print "Mouse button pressed on list"
|
print "Mouse button pressed on list"
|
||||||
|
|
||||||
|
33
camlib.py
33
camlib.py
@ -1470,13 +1470,6 @@ class Gerber (Geometry):
|
|||||||
# Example: %LPD*% or %LPC*%
|
# Example: %LPD*% or %LPC*%
|
||||||
# If polarity changes, creates geometry from current
|
# If polarity changes, creates geometry from current
|
||||||
# buffer, then adds or subtracts accordingly.
|
# buffer, then adds or subtracts accordingly.
|
||||||
|
|
||||||
## DEBUG
|
|
||||||
if line_num == 11:
|
|
||||||
print "LINE:", gline
|
|
||||||
print "RE:", self.lpol_re.pattern
|
|
||||||
print "MATCH:", self.lpol_re.search(gline)
|
|
||||||
|
|
||||||
match = self.lpol_re.search(gline)
|
match = self.lpol_re.search(gline)
|
||||||
if match:
|
if match:
|
||||||
if len(path) > 1 and current_polarity != match.group(1):
|
if len(path) > 1 and current_polarity != match.group(1):
|
||||||
@ -1489,12 +1482,10 @@ class Gerber (Geometry):
|
|||||||
path = [path[-1]]
|
path = [path[-1]]
|
||||||
|
|
||||||
# --- Apply buffer ---
|
# --- Apply buffer ---
|
||||||
print "current_polarity:", current_polarity
|
|
||||||
# If added for testing of bug #83
|
# If added for testing of bug #83
|
||||||
# TODO: Remove when bug fixed
|
# TODO: Remove when bug fixed
|
||||||
if len(poly_buffer) > 0:
|
if len(poly_buffer) > 0:
|
||||||
if current_polarity == 'D':
|
if current_polarity == 'D':
|
||||||
print "Union with Cascaded Union of:", poly_buffer
|
|
||||||
self.solid_geometry = self.solid_geometry.union(cascaded_union(poly_buffer))
|
self.solid_geometry = self.solid_geometry.union(cascaded_union(poly_buffer))
|
||||||
else:
|
else:
|
||||||
self.solid_geometry = self.solid_geometry.difference(cascaded_union(poly_buffer))
|
self.solid_geometry = self.solid_geometry.difference(cascaded_union(poly_buffer))
|
||||||
@ -1578,10 +1569,10 @@ class Gerber (Geometry):
|
|||||||
loc = location.coords[0]
|
loc = location.coords[0]
|
||||||
width = aperture['width']
|
width = aperture['width']
|
||||||
height = aperture['height']
|
height = aperture['height']
|
||||||
minx = loc[0] - width/2
|
minx = loc[0] - width / 2
|
||||||
maxx = loc[0] + width/2
|
maxx = loc[0] + width / 2
|
||||||
miny = loc[1] - height/2
|
miny = loc[1] - height / 2
|
||||||
maxy = loc[1] + height/2
|
maxy = loc[1] + height / 2
|
||||||
return shply_box(minx, miny, maxx, maxy)
|
return shply_box(minx, miny, maxx, maxy)
|
||||||
|
|
||||||
if aperture['type'] == 'O': # Obround
|
if aperture['type'] == 'O': # Obround
|
||||||
@ -1589,15 +1580,15 @@ class Gerber (Geometry):
|
|||||||
width = aperture['width']
|
width = aperture['width']
|
||||||
height = aperture['height']
|
height = aperture['height']
|
||||||
if width > height:
|
if width > height:
|
||||||
p1 = Point(loc[0] + 0.5*(width-height), loc[1])
|
p1 = Point(loc[0] + 0.5 * (width - height), loc[1])
|
||||||
p2 = Point(loc[0] - 0.5*(width-height), loc[1])
|
p2 = Point(loc[0] - 0.5 * (width - height), loc[1])
|
||||||
c1 = p1.buffer(height*0.5)
|
c1 = p1.buffer(height * 0.5)
|
||||||
c2 = p2.buffer(height*0.5)
|
c2 = p2.buffer(height * 0.5)
|
||||||
else:
|
else:
|
||||||
p1 = Point(loc[0], loc[1] + 0.5*(height-width))
|
p1 = Point(loc[0], loc[1] + 0.5 * (height - width))
|
||||||
p2 = Point(loc[0], loc[1] - 0.5*(height-width))
|
p2 = Point(loc[0], loc[1] - 0.5 * (height - width))
|
||||||
c1 = p1.buffer(width*0.5)
|
c1 = p1.buffer(width * 0.5)
|
||||||
c2 = p2.buffer(width*0.5)
|
c2 = p2.buffer(width * 0.5)
|
||||||
return cascaded_union([c1, c2]).convex_hull
|
return cascaded_union([c1, c2]).convex_hull
|
||||||
|
|
||||||
if aperture['type'] == 'P': # Regular polygon
|
if aperture['type'] == 'P': # Regular polygon
|
||||||
|
Loading…
Reference in New Issue
Block a user