diff --git a/ObjectCollection.py b/ObjectCollection.py index 4dfcaac1..dc60edec 100644 --- a/ObjectCollection.py +++ b/ObjectCollection.py @@ -902,6 +902,20 @@ class ObjectCollection(QtCore.QAbstractItemModel): try: obj = current.indexes()[0].internalPointer().obj + + if obj.kind == 'gerber': + self.app.inform.emit('[selected]%s selected' % + ('green', str(obj.options['name']))) + elif obj.kind == 'excellon': + self.app.inform.emit('[selected]%s selected' % + ('brown', str(obj.options['name']))) + elif obj.kind == 'cncjob': + self.app.inform.emit('[selected]%s selected' % + ('blue', str(obj.options['name']))) + elif obj.kind == 'geometry': + self.app.inform.emit('[selected]%s selected' % + ('red', str(obj.options['name']))) + except IndexError: FlatCAMApp.App.log.debug("on_list_selection_change(): Index Error (Nothing selected?)") diff --git a/README.md b/README.md index 49d678fc..06707812 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ CAD program, and create G-Code for Isolation routing. 16.02.2019 - added the 'Save' menu entry to the Project context menu, for CNCJob: it will export the GCode. +- added messages in info bar when selecting objects in the Project View list +- fixed DblSided Tool so it correctly creates the Alignment Drills Excellon file using the new structure +- fixed DblSided Tool so it will not crash the app if the user tries to make a mirror using no coordinates +- added some relevant status bar messages in DblSided Tool +- fixed DblSided Tool to correctly use the Box object (until now it used as reference only Gerber object in spite of Excellon or Geometry objects being available) +- fixed DblSided Tool crash when trying to create Alignment Drills object without a Tool diameter specified 15.02.2019 diff --git a/flatcamTools/ToolDblSided.py b/flatcamTools/ToolDblSided.py index f7828618..3f04b19d 100644 --- a/flatcamTools/ToolDblSided.py +++ b/flatcamTools/ToolDblSided.py @@ -128,7 +128,7 @@ class DblSidedTool(FlatCAMTool): ## Point/Box self.point_box_container = QtWidgets.QVBoxLayout() - self.pb_label = QtWidgets.QLabel("Point/Box:") + self.pb_label = QtWidgets.QLabel("Point/Box Reference:") self.pb_label.setToolTip( "If 'Point' is selected above it store the coordinates (x, y) through which\n" "the mirroring axis passes.\n" @@ -210,7 +210,7 @@ class DblSidedTool(FlatCAMTool): grid_lay2 = QtWidgets.QGridLayout() self.layout.addLayout(grid_lay2) - self.drill_dia = LengthEntry() + self.drill_dia = FCEntry() self.dd_label = QtWidgets.QLabel("Drill diam.:") self.dd_label.setToolTip( "Diameter of the drill for the " @@ -295,7 +295,22 @@ class DblSidedTool(FlatCAMTool): else: selection_index = self.box_combo.currentIndex() model_index = self.app.collection.index(selection_index, 0, self.gerber_object_combo.rootModelIndex()) - bb_obj = model_index.internalPointer().obj + try: + bb_obj = model_index.internalPointer().obj + except AttributeError: + model_index = self.app.collection.index(selection_index, 0, self.exc_object_combo.rootModelIndex()) + try: + bb_obj = model_index.internalPointer().obj + except AttributeError: + model_index = self.app.collection.index(selection_index, 0, + self.geo_object_combo.rootModelIndex()) + try: + bb_obj = model_index.internalPointer().obj + except AttributeError: + self.app.inform.emit( + "[WARNING_NOTCL] There is no Box reference object loaded. Load one and retry.") + return + xmin, ymin, xmax, ymax = bb_obj.bounds() px = 0.5 * (xmin + xmax) py = 0.5 * (ymin + ymax) @@ -303,7 +318,7 @@ class DblSidedTool(FlatCAMTool): xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis] dia = self.drill_dia.get_value() - if dia is None: + if dia is '': self.app.inform.emit("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry.") return tools = {"1": {"C": dia}} @@ -321,6 +336,10 @@ class DblSidedTool(FlatCAMTool): point_mirror = affinity.scale(point, xscale, yscale, origin=(px, py)) drills.append({"point": point, "tool": "1"}) drills.append({"point": point_mirror, "tool": "1"}) + if 'solid_geometry' not in tools: + tools["1"]['solid_geometry'] = [] + else: + tools["1"]['solid_geometry'].append(point_mirror) def obj_init(obj_inst, app_inst): obj_inst.tools = tools @@ -329,6 +348,7 @@ class DblSidedTool(FlatCAMTool): self.app.new_object("excellon", "Alignment Drills", obj_init) self.drill_values = '' + self.app.inform.emit("[success] Excellon object with alignment drills created...") def on_mirror_gerber(self): selection_index = self.gerber_object_combo.currentIndex() @@ -371,6 +391,7 @@ class DblSidedTool(FlatCAMTool): fcobj.mirror(axis, [px, py]) self.app.object_changed.emit(fcobj) fcobj.plot() + self.app.inform.emit("[success] Gerber %s was mirrored..." % str(fcobj.options['name'])) def on_mirror_exc(self): selection_index = self.exc_object_combo.currentIndex() @@ -390,13 +411,20 @@ class DblSidedTool(FlatCAMTool): mode = self.axis_location.get_value() if mode == "point": - px, py = self.point_entry.get_value() + try: + px, py = self.point_entry.get_value() + except Exception as e: + log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e)) + self.app.inform.emit("[WARNING_NOTCL] There are no Point coordinates in the Point field. " + "Add coords and try again ...") + return else: selection_index_box = self.box_combo.currentIndex() model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex()) try: bb_obj = model_index_box.internalPointer().obj except Exception as e: + log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e)) self.app.inform.emit("[WARNING_NOTCL] There is no Box object loaded ...") return @@ -407,6 +435,7 @@ class DblSidedTool(FlatCAMTool): fcobj.mirror(axis, [px, py]) self.app.object_changed.emit(fcobj) fcobj.plot() + self.app.inform.emit("[success] Excellon %s was mirrored..." % str(fcobj.options['name'])) def on_mirror_geo(self): selection_index = self.geo_object_combo.currentIndex() @@ -443,6 +472,7 @@ class DblSidedTool(FlatCAMTool): fcobj.mirror(axis, [px, py]) self.app.object_changed.emit(fcobj) fcobj.plot() + self.app.inform.emit("[success] Geometry %s was mirrored..." % str(fcobj.options['name'])) def on_point_add(self): val = self.app.defaults["global_point_clipboard_format"] % (self.app.pos[0], self.app.pos[1])