Explorar el Código

- fixed a bug in the new feature 'extra buffering'
- fixed the creation of CNCJob objects out of multigeo Geometry objects (objects with multiple tools)
- optimized the NCC Tool

Marius Stanciu hace 6 años
padre
commit
4efc453b84
Se han modificado 5 ficheros con 39 adiciones y 18 borrados
  1. 8 0
      FlatCAM.py
  2. 1 3
      FlatCAMObj.py
  3. 3 0
      README.md
  4. 5 2
      flatcamParsers/ParseGerber.py
  5. 22 13
      flatcamTools/ToolNonCopperClear.py

+ 8 - 0
FlatCAM.py

@@ -47,6 +47,14 @@ if __name__ == '__main__':
     else:
         os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "0"
 
+    # if hdpi_support == 2:
+    #     tst_screen = QtWidgets.QApplication(sys.argv)
+    #     if tst_screen.screens()[0].geometry().width() > 1930 or tst_screen.screens()[1].geometry().width() > 1930:
+    #         QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
+    #         del tst_screen
+    # else:
+    #     QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False)
+
     app = QtWidgets.QApplication(sys.argv)
 
     # apply style

+ 1 - 3
FlatCAMObj.py

@@ -5291,10 +5291,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
 
         if use_thread:
             # To be run in separate thread
-            # The idea is that if there is a solid_geometry in the file "root" then most likely thare are no
-            # separate solid_geometry in the self.tools dictionary
             def job_thread(app_obj):
-                if self.solid_geometry:
+                if self.multigeo is False:
                     with self.app.proc_container.new(_("Generating CNC Code")):
                         if app_obj.new_object("cncjob", outname, job_init_single_geometry, plot=plot) != 'fail':
                             app_obj.inform.emit('[success] %s: %s' % (_("CNCjob created"), outname))

+ 3 - 0
README.md

@@ -16,6 +16,9 @@ CAD program, and create G-Code for Isolation routing.
 - the Jump To function reference is now saving it's last used value
 - added the ability to use the Jump To method in the Gerber Editor
 - improved the loading of Config File by using the advanced code editor
+- fixed a bug in the new feature 'extra buffering'
+- fixed the creation of CNCJob objects out of multigeo Geometry objects (objects with multiple tools)
+- optimized the NCC Tool
 
 17.12.2019
 

+ 5 - 2
flatcamParsers/ParseGerber.py

@@ -1438,8 +1438,11 @@ class Gerber(Geometry):
                 # features
                 if self.app.defaults['gerber_extra_buffering']:
                     candidate_geo = list()
-                    for p in self.solid_geometry:
-                        candidate_geo.append(p.buffer(0.0000001))
+                    try:
+                        for p in self.solid_geometry:
+                            candidate_geo.append(p.buffer(0.0000001))
+                    except TypeError:
+                        candidate_geo.append(self.solid_geometry.buffer(0.0000001))
                     self.solid_geometry = candidate_geo
 
                 # try:

+ 22 - 13
flatcamTools/ToolNonCopperClear.py

@@ -1723,11 +1723,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
 
                 sol_geo = cascaded_union(isolated_geo)
                 if has_offset is True:
-                    app_obj.inform.emit('[WARNING_NOTCL] %s ...' %
-                                        _("Buffering"))
+                    app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit('[success] %s ...' %
-                                        _("Buffering finished"))
+                    app_obj.inform.emit('[success] %s ...' % _("Buffering finished"))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
                 if empty == 'fail':
                     return 'fail'
@@ -1760,6 +1758,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
             log.debug("NCC Tool. Finished calculation of 'empty' area.")
             self.app.inform.emit(_("NCC Tool. Finished calculation of 'empty' area."))
 
+            # COPPER CLEARING #
             cp = None
             for tool in sorted_tools:
                 log.debug("Starting geometry processing for tool: %s" % str(tool))
@@ -1916,17 +1915,27 @@ class NonCopperClear(FlatCAMTool, Gerber):
             if self.app.defaults["tools_ncc_plotting"] == 'progressive':
                 self.temp_shapes.clear(update=True)
 
+            # # delete tools with empty geometry
+            # keys_to_delete = []
+            # # look for keys in the tools_storage dict that have 'solid_geometry' values empty
+            # for uid in tools_storage:
+            #     # if the solid_geometry (type=list) is empty
+            #     if not tools_storage[uid]['solid_geometry']:
+            #         keys_to_delete.append(uid)
+            #
+            # # actual delete of keys from the tools_storage dict
+            # for k in keys_to_delete:
+            #     tools_storage.pop(k, None)
+
             # delete tools with empty geometry
-            keys_to_delete = []
             # look for keys in the tools_storage dict that have 'solid_geometry' values empty
-            for uid in tools_storage:
-                # if the solid_geometry (type=list) is empty
-                if not tools_storage[uid]['solid_geometry']:
-                    keys_to_delete.append(uid)
-
-            # actual delete of keys from the tools_storage dict
-            for k in keys_to_delete:
-                tools_storage.pop(k, None)
+            for uid, uid_val in list(tools_storage.items()):
+                try:
+                    # if the solid_geometry (type=list) is empty
+                    if not uid_val['solid_geometry']:
+                        tools_storage.pop(uid, None)
+                except KeyError:
+                    tools_storage.pop(uid, None)
 
             geo_obj.options["cnctooldia"] = str(tool)