- 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):
|
def obj_properties(self):
|
||||||
self.report_usage("obj_properties()")
|
self.report_usage("obj_properties()")
|
||||||
|
|
||||||
self.properties_tool.run()
|
self.properties_tool.run(toggle=False)
|
||||||
|
|
||||||
def on_project_context_save(self):
|
def on_project_context_save(self):
|
||||||
obj = self.collection.get_active()
|
obj = self.collection.get_active()
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import builtins
|
|||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
|
|
||||||
class KeySensitiveListView(QtWidgets.QTreeView):
|
class KeySensitiveListView(QtWidgets.QTreeView):
|
||||||
"""
|
"""
|
||||||
QtGui.QListView extended to emit a signal on key press.
|
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
|
11.03.2019
|
||||||
|
|
||||||
- changed some icons here and there
|
- 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
|
10.03.2019
|
||||||
|
|
||||||
|
|||||||
48
camlib.py
48
camlib.py
@@ -2553,8 +2553,8 @@ class Gerber (Geometry):
|
|||||||
else:
|
else:
|
||||||
if '0' not in self.apertures:
|
if '0' not in self.apertures:
|
||||||
self.apertures['0'] = {}
|
self.apertures['0'] = {}
|
||||||
self.apertures['0']['solid_geometry'] = []
|
|
||||||
self.apertures['0']['type'] = 'REG'
|
self.apertures['0']['type'] = 'REG'
|
||||||
|
self.apertures['0']['solid_geometry'] = []
|
||||||
used_aperture = '0'
|
used_aperture = '0'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -2590,18 +2590,6 @@ class Gerber (Geometry):
|
|||||||
# NOTE: Letting it continue allows it to react to the
|
# NOTE: Letting it continue allows it to react to the
|
||||||
# operation code.
|
# 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
|
# Parse coordinates
|
||||||
if match.group(2) is not None:
|
if match.group(2) is not None:
|
||||||
linear_x = parse_gerber_number(match.group(2),
|
linear_x = parse_gerber_number(match.group(2),
|
||||||
@@ -2652,6 +2640,14 @@ class Gerber (Geometry):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
last_path_aperture = current_aperture
|
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:
|
else:
|
||||||
self.app.inform.emit(_("[WARNING] Coordinates missing, line ignored: %s") % str(gline))
|
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 !!!"))
|
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:
|
if len(path) > 1:
|
||||||
geo = None
|
geo = None
|
||||||
|
|
||||||
## --- BUFFERED ---
|
# --- BUFFERED ---
|
||||||
# this treats the case when we are storing geometry as paths only
|
# this treats the case when we are storing geometry as paths only
|
||||||
if making_region:
|
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()
|
geo = Polygon()
|
||||||
else:
|
else:
|
||||||
geo = LineString(path)
|
geo = LineString(path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.apertures[last_path_aperture]["type"] != 'R':
|
if self.apertures[last_path_aperture]["type"] != 'R':
|
||||||
if not geo.is_empty:
|
if not geo.is_empty:
|
||||||
follow_buffer.append(geo)
|
follow_buffer.append(geo)
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("camlib.Gerber.parse_lines() --> %s" % str(e))
|
||||||
|
if not geo.is_empty:
|
||||||
follow_buffer.append(geo)
|
follow_buffer.append(geo)
|
||||||
|
|
||||||
# this treats the case when we are storing geometry as solids
|
# this treats the case when we are storing geometry as solids
|
||||||
if making_region:
|
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]
|
elem = [linear_x, linear_y]
|
||||||
if elem != path[-1]:
|
if elem != path[-1]:
|
||||||
path.append([linear_x, linear_y])
|
path.append([linear_x, linear_y])
|
||||||
@@ -2701,7 +2716,8 @@ class Gerber (Geometry):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
self.apertures[last_path_aperture]['solid_geometry'] = []
|
self.apertures[last_path_aperture]['solid_geometry'] = []
|
||||||
self.apertures[last_path_aperture]['solid_geometry'].append(geo)
|
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)
|
poly_buffer.append(geo)
|
||||||
try:
|
try:
|
||||||
self.apertures[last_path_aperture]['solid_geometry'].append(geo)
|
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)
|
self.addChild(options, [str(option), str(obj.options[option])], True)
|
||||||
|
|
||||||
if obj.kind.lower() == 'gerber':
|
if obj.kind.lower() == 'gerber':
|
||||||
|
temp_ap = {}
|
||||||
for ap in obj.apertures:
|
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':
|
elif obj.kind.lower() == 'excellon':
|
||||||
for tool, value in obj.tools.items():
|
for tool, value in obj.tools.items():
|
||||||
self.addChild(tools, [str(tool), str(value['C'])], True)
|
self.addChild(tools, [str(tool), str(value['C'])], True)
|
||||||
|
|||||||
Reference in New Issue
Block a user