- soled bug in Gerber Editor: the '0' aperture (the region aperture) had no size which created errors. Made the size to be zero.
- solved bug in editors: the canvas selection shape was not deleted on mouse release if the grid snap was OFF - solved bug in Excellon Editor: when selecting a drill hole on canvas the selected row in the Tools Table was not the correct onw but the next highest row
This commit is contained in:
parent
43c539702e
commit
91e6cc0bff
|
@ -9,6 +9,12 @@ CAD program, and create G-Code for Isolation routing.
|
|||
|
||||
=================================================
|
||||
|
||||
29.04.2019
|
||||
|
||||
- soled bug in Gerber Editor: the '0' aperture (the region aperture) had no size which created errors. Made the size to be zero.
|
||||
- solved bug in editors: the canvas selection shape was not deleted on mouse release if the grid snap was OFF
|
||||
- solved bug in Excellon Editor: when selecting a drill hole on canvas the selected row in the Tools Table was not the correct onw but the next highest row
|
||||
|
||||
26.04.2019
|
||||
|
||||
- small changes in GUI; optimized contextual menu display
|
||||
|
|
|
@ -2554,6 +2554,7 @@ class Gerber (Geometry):
|
|||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
|
||||
# if D02 happened before G37 we now have a path with 1 element only so we have to add the current
|
||||
|
@ -2625,6 +2626,7 @@ class Gerber (Geometry):
|
|||
# else:
|
||||
# if '0' not in self.apertures:
|
||||
# self.apertures['0'] = {}
|
||||
# self.apertures['0']['size'] = 0.0
|
||||
# self.apertures['0']['type'] = 'REG'
|
||||
# self.apertures['0']['solid_geometry'] = []
|
||||
# used_aperture = '0'
|
||||
|
@ -2732,6 +2734,7 @@ class Gerber (Geometry):
|
|||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
last_path_aperture = '0'
|
||||
else:
|
||||
|
@ -2751,6 +2754,7 @@ class Gerber (Geometry):
|
|||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
last_path_aperture = '0'
|
||||
geo = Polygon()
|
||||
|
@ -2784,6 +2788,7 @@ class Gerber (Geometry):
|
|||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
last_path_aperture = '0'
|
||||
elem = [linear_x, linear_y]
|
||||
|
|
|
@ -643,7 +643,7 @@ class FCDrillSelect(DrawTool):
|
|||
sel_tools.add(storage)
|
||||
|
||||
for storage in sel_tools:
|
||||
self.exc_editor_app.tools_table_exc.selectRow(int(storage))
|
||||
self.exc_editor_app.tools_table_exc.selectRow(int(storage) - 1)
|
||||
self.draw_app.last_tool_selected = int(storage)
|
||||
|
||||
self.exc_editor_app.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
|
@ -2129,11 +2129,16 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||
"%.4f " % (0, 0))
|
||||
self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
|
||||
|
||||
### Snap coordinates
|
||||
x, y = self.app.geo_editor.snap(self.pos[0], self.pos[1])
|
||||
|
||||
self.pos = (x, y)
|
||||
# print(self.active_tool)
|
||||
# Snap coordinates
|
||||
if self.app.grid_status():
|
||||
self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
|
||||
self.app.app_cursor.enabled = True
|
||||
# Update cursor
|
||||
self.app.app_cursor.set_data(np.asarray([(self.pos[0], self.pos[1])]), symbol='++', edge_color='black',
|
||||
size=20)
|
||||
else:
|
||||
self.pos = (self.pos[0], self.pos[1])
|
||||
self.app.app_cursor.enabled = False
|
||||
|
||||
# Selection with left mouse button
|
||||
if self.active_tool is not None and event.button is 1:
|
||||
|
|
|
@ -3321,6 +3321,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
|||
self.app.app_cursor.set_data(np.asarray([(self.pos[0], self.pos[1])]), symbol='++', edge_color='black',
|
||||
size=20)
|
||||
else:
|
||||
self.pos = (self.pos[0], self.pos[1])
|
||||
self.app.app_cursor.enabled = False
|
||||
|
||||
if event.button is 1:
|
||||
|
|
|
@ -3245,9 +3245,9 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
self.app.app_cursor.set_data(np.asarray([(self.pos[0], self.pos[1])]), symbol='++', edge_color='black',
|
||||
size=20)
|
||||
else:
|
||||
self.pos = (self.pos[0], self.pos[1])
|
||||
self.app.app_cursor.enabled = False
|
||||
|
||||
|
||||
if event.button is 1:
|
||||
self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
||||
"%.4f " % (0, 0))
|
||||
|
@ -3377,6 +3377,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
:type Bool
|
||||
:return:
|
||||
"""
|
||||
|
||||
poly_selection = Polygon([start_pos, (end_pos[0], start_pos[1]), end_pos, (start_pos[0], end_pos[1])])
|
||||
sel_aperture = set()
|
||||
self.apertures_table.clearSelection()
|
||||
|
|
|
@ -181,32 +181,30 @@ class ToolSilk(FlatCAMTool):
|
|||
|
||||
# start the QTimer with 1 second period check
|
||||
self.periodic_check(1000)
|
||||
|
||||
for apid in self.silk_obj.apertures:
|
||||
ap_size = self.silk_obj.apertures[apid]['size']
|
||||
geo_list = self.silk_obj.apertures[apid]['solid_geometry']
|
||||
geo = self.silk_obj.apertures[apid]['solid_geometry']
|
||||
self.app.worker_task.emit({'fcn': self.aperture_intersection,
|
||||
'params': [apid, geo_list]})
|
||||
'params': [apid, geo]})
|
||||
|
||||
def aperture_intersection(self, apid, geo_list):
|
||||
def aperture_intersection(self, apid, geo):
|
||||
self.promises.append(apid)
|
||||
new_solid_geometry = []
|
||||
|
||||
with self.app.proc_container.new(_("Parsing aperture %s geometry ..." % str(apid))):
|
||||
for geo_silk in geo_list:
|
||||
for geo_silk in geo:
|
||||
for ap in self.sm_obj.apertures:
|
||||
for solder_poly in self.sm_obj.apertures[ap]['solid_geometry']:
|
||||
if geo_silk.exterior.intersects(solder_poly):
|
||||
if geo_silk.intersects(solder_poly):
|
||||
|
||||
new_geo = self.subtract_polygon(geo_silk, solder_poly.exterior)
|
||||
|
||||
new_geo = self.subtract_polygon(geo_silk, solder_poly)
|
||||
if not new_geo.is_empty:
|
||||
# if the resulting geometry is not empty add it to the new_apertures solid_geometry
|
||||
try:
|
||||
for g in new_geo:
|
||||
new_solid_geometry.append(g)
|
||||
except TypeError:
|
||||
new_solid_geometry.append(new_geo)
|
||||
# else:
|
||||
# new_solid_geometry.append(geo_silk)
|
||||
new_solid_geometry.append(new_geo)
|
||||
else:
|
||||
new_solid_geometry.append(geo)
|
||||
|
||||
if new_solid_geometry:
|
||||
while True:
|
||||
if self.new_apertures[apid]['solid_geometry']:
|
||||
|
@ -224,28 +222,19 @@ class ToolSilk(FlatCAMTool):
|
|||
|
||||
log.debug("Promise fulfilled: %s" % str(apid))
|
||||
|
||||
def subtract_polygon(self, geometry, polygon):
|
||||
def subtract_polygon(self, silk_geo, sm_exterior):
|
||||
"""
|
||||
Subtract polygon from the given object. This only operates on the paths in the original geometry, i.e.
|
||||
it converts polygons into paths.
|
||||
|
||||
:param geometry: The geometry from which to substract.
|
||||
:param polygon: The substractor geometry
|
||||
:param silk_geo: The geometry from which to substract.
|
||||
:param sm_exterior: The substractor geometry
|
||||
:return: none
|
||||
"""
|
||||
|
||||
# pathonly should be always True, otherwise polygons are not subtracted
|
||||
flat_geometry = self.flatten(geometry=geometry, pathonly=True)
|
||||
|
||||
toolgeo = cascaded_union(polygon)
|
||||
diffs = []
|
||||
for target in flat_geometry:
|
||||
if type(target) == LineString or type(target) == LinearRing:
|
||||
diffs.append(target.difference(toolgeo))
|
||||
else:
|
||||
log.warning("Not implemented.")
|
||||
|
||||
return cascaded_union(diffs)
|
||||
geo = cascaded_union(silk_geo)
|
||||
diff_geo = geo.difference(sm_exterior)
|
||||
return diff_geo
|
||||
|
||||
def flatten(self, geometry=None, reset=True, pathonly=False):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue