- fixed bug in camlib.parse_lines() in the clear_geometry processing section for self.apertures

This commit is contained in:
Marius Stanciu 2019-05-04 22:39:51 +03:00
parent e7a32c5c90
commit d7031bc89a
4 changed files with 42 additions and 12 deletions

View File

@ -94,8 +94,8 @@ class App(QtCore.QObject):
log.addHandler(handler)
# Version
version = 8.915
version_date = "2019/05/1"
version = 8.916
version_date = "2019/05/7"
beta = True
# current date now
@ -2169,6 +2169,9 @@ class App(QtCore.QObject):
# set call source to the Editor we go into
self.call_source = 'exc_editor'
if self.ui.splitter.sizes()[0] == 0:
self.ui.splitter.setSizes([1, 1])
elif isinstance(edited_object, FlatCAMGerber):
# store the Gerber Editor Toolbar visibility before entering in the Editor
self.grb_editor.toolbar_old_state = True if self.ui.grb_edit_toolbar.isVisible() else False
@ -2177,6 +2180,9 @@ class App(QtCore.QObject):
# set call source to the Editor we go into
self.call_source = 'grb_editor'
if self.ui.splitter.sizes()[0] == 0:
self.ui.splitter.setSizes([1, 1])
# # make sure that we can't select another object while in Editor Mode:
# self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.ui.project_frame.setDisabled(True)

View File

@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
=================================================
4.05.2019
- fixed bug in camlib.parse_lines() in the clear_geometry processing section for self.apertures
01.05.2019
- the project items color is now controlled from Foreground Role in ObjectCollection.data()

View File

@ -3200,24 +3200,42 @@ class Gerber (Geometry):
conversion_factor = 25.4 if file_units == 'IN' else (1/25.4) if file_units != app_units else 1
# first check if we have any clear_geometry (LPC) and if yes then we need to substract it
# from the apertures solid_geometry
# --- the following section is usefull for Gerber editor only --- #
# list of clear geos that are to be applied to the entire file
global_clear_geo = []
for apid in self.apertures:
# first check if we have any clear_geometry (LPC) and if yes added it to the global_clear_geo
if 'clear_geometry' in self.apertures[apid]:
for pol in self.apertures[apid]['clear_geometry']:
global_clear_geo.append(pol)
self.apertures[apid].pop('clear_geometry', None)
temp_geo = []
for apid in self.apertures:
if 'clear_geometry' in self.apertures[apid]:
clear_geo = MultiPolygon(self.apertures[apid]['clear_geometry'])
if 'solid_geometry' in self.apertures[apid]:
for solid_geo in self.apertures[apid]['solid_geometry']:
if clear_geo.intersects(solid_geo):
res_geo = solid_geo.difference(clear_geo)
temp_geo.append(res_geo)
else:
for clear_geo in global_clear_geo:
# Make sure that the solid_geo is not completely within the clear_geo otherwise we loose
# the solid_geometry. We want for clear_geometry just to cut into solid_geometry not to
# delete it
if not solid_geo.within(clear_geo):
solid_geo = solid_geo.difference(clear_geo)
try:
for poly in solid_geo:
temp_geo.append(poly)
except TypeError:
temp_geo.append(solid_geo)
self.apertures[apid]['solid_geometry'] = deepcopy(temp_geo)
self.apertures[apid].pop('clear_geometry', None)
self.apertures[apid]['solid_geometry'] = deepcopy(temp_geo)
temp_geo[:] = []
for apid in self.apertures:
# scale de aperture geometries according to the used units
for k, v in self.apertures[apid].items():
if k == 'size' or k == 'width' or k == 'height':
self.apertures[apid][k] = v * conversion_factor
# -------------------------------------------------------------
# --- Apply buffer ---
# this treats the case when we are storing geometry as paths

View File

@ -2947,6 +2947,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
if geo is not None:
self.add_gerber_shape(DrawToolShape(geo), follow_storage_elem)
self.storage_dict[apid][k] = follow_storage_elem
elif k == 'clear_geometry':
continue
else:
self.storage_dict[apid][k] = v
except Exception as e: