- fixed the Properties Project menu entry to work on the new way
- in Properties tool now the Gerber apertures show the number of polygons in 'solid_geometry' instead of listing the objects
This commit is contained in:
@@ -5266,7 +5266,7 @@ class App(QtCore.QObject):
|
||||
def obj_properties(self):
|
||||
self.report_usage("obj_properties()")
|
||||
|
||||
self.properties_tool.run()
|
||||
self.properties_tool.run(toggle=False)
|
||||
|
||||
def on_project_context_save(self):
|
||||
obj = self.collection.get_active()
|
||||
|
||||
@@ -26,6 +26,7 @@ import builtins
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class KeySensitiveListView(QtWidgets.QTreeView):
|
||||
"""
|
||||
QtGui.QListView extended to emit a signal on key press.
|
||||
|
||||
@@ -12,7 +12,8 @@ CAD program, and create G-Code for Isolation routing.
|
||||
11.03.2019
|
||||
|
||||
- changed some icons here and there
|
||||
|
||||
- fixed the Properties Project menu entry to work on the new way
|
||||
- in Properties tool now the Gerber apertures show the number of polygons in 'solid_geometry' instead of listing the objects
|
||||
|
||||
10.03.2019
|
||||
|
||||
|
||||
52
camlib.py
52
camlib.py
@@ -2553,8 +2553,8 @@ class Gerber (Geometry):
|
||||
else:
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
used_aperture = '0'
|
||||
|
||||
try:
|
||||
@@ -2590,18 +2590,6 @@ class Gerber (Geometry):
|
||||
# NOTE: Letting it continue allows it to react to the
|
||||
# operation code.
|
||||
|
||||
# we do this for the case that a region is done without having defined any aperture
|
||||
# Allegro does that
|
||||
if current_aperture:
|
||||
last_path_aperture = current_aperture
|
||||
|
||||
if last_path_aperture is None:
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
last_path_aperture = '0'
|
||||
|
||||
# Parse coordinates
|
||||
if match.group(2) is not None:
|
||||
linear_x = parse_gerber_number(match.group(2),
|
||||
@@ -2628,7 +2616,7 @@ class Gerber (Geometry):
|
||||
if path[-1] != [linear_x, linear_y]:
|
||||
path.append([linear_x, linear_y])
|
||||
|
||||
if making_region is False:
|
||||
if making_region is False:
|
||||
# if the aperture is rectangle then add a rectangular shape having as parameters the
|
||||
# coordinates of the start and end point and also the width and height
|
||||
# of the 'R' aperture
|
||||
@@ -2652,6 +2640,14 @@ class Gerber (Geometry):
|
||||
except:
|
||||
pass
|
||||
last_path_aperture = current_aperture
|
||||
# we do this for the case that a region is done without having defined any aperture
|
||||
# Allegro does that
|
||||
if last_path_aperture is None:
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
last_path_aperture = '0'
|
||||
else:
|
||||
self.app.inform.emit(_("[WARNING] Coordinates missing, line ignored: %s") % str(gline))
|
||||
self.app.inform.emit(_("[WARNING_NOTCL] GERBER file might be CORRUPT. Check the file !!!"))
|
||||
@@ -2660,21 +2656,40 @@ class Gerber (Geometry):
|
||||
if len(path) > 1:
|
||||
geo = None
|
||||
|
||||
## --- BUFFERED ---
|
||||
# --- BUFFERED ---
|
||||
# this treats the case when we are storing geometry as paths only
|
||||
if making_region:
|
||||
# we do this for the case that a region is done without having defined any aperture
|
||||
# Allegro does that
|
||||
if last_path_aperture is None:
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
last_path_aperture = '0'
|
||||
geo = Polygon()
|
||||
else:
|
||||
geo = LineString(path)
|
||||
|
||||
try:
|
||||
if self.apertures[last_path_aperture]["type"] != 'R':
|
||||
if not geo.is_empty:
|
||||
follow_buffer.append(geo)
|
||||
except:
|
||||
follow_buffer.append(geo)
|
||||
except Exception as e:
|
||||
log.debug("camlib.Gerber.parse_lines() --> %s" % str(e))
|
||||
if not geo.is_empty:
|
||||
follow_buffer.append(geo)
|
||||
|
||||
# this treats the case when we are storing geometry as solids
|
||||
if making_region:
|
||||
# we do this for the case that a region is done without having defined any aperture
|
||||
# Allegro does that
|
||||
if last_path_aperture is None:
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['solid_geometry'] = []
|
||||
last_path_aperture = '0'
|
||||
elem = [linear_x, linear_y]
|
||||
if elem != path[-1]:
|
||||
path.append([linear_x, linear_y])
|
||||
@@ -2701,7 +2716,8 @@ class Gerber (Geometry):
|
||||
except KeyError:
|
||||
self.apertures[last_path_aperture]['solid_geometry'] = []
|
||||
self.apertures[last_path_aperture]['solid_geometry'].append(geo)
|
||||
except:
|
||||
except Exception as e:
|
||||
log.debug("camlib.Gerber.parse_lines() --> %s" % str(e))
|
||||
poly_buffer.append(geo)
|
||||
try:
|
||||
self.apertures[last_path_aperture]['solid_geometry'].append(geo)
|
||||
|
||||
@@ -156,8 +156,14 @@ class Properties(FlatCAMTool):
|
||||
self.addChild(options, [str(option), str(obj.options[option])], True)
|
||||
|
||||
if obj.kind.lower() == 'gerber':
|
||||
temp_ap = {}
|
||||
for ap in obj.apertures:
|
||||
self.addChild(apertures, [str(ap), str(obj.apertures[ap])], True)
|
||||
temp_ap.clear()
|
||||
temp_ap = deepcopy(obj.apertures[ap])
|
||||
if obj.apertures[ap]['solid_geometry']:
|
||||
elems = len(obj.apertures[ap]['solid_geometry'])
|
||||
temp_ap['solid_geometry'] = '%s Polygons' % str(elems)
|
||||
self.addChild(apertures, [str(ap), str(temp_ap)], True)
|
||||
elif obj.kind.lower() == 'excellon':
|
||||
for tool, value in obj.tools.items():
|
||||
self.addChild(tools, [str(tool), str(value['C'])], True)
|
||||
|
||||
Reference in New Issue
Block a user