Browse Source

- upgraded the Tool Cutout when done from Gerber file to create a convex_hull around the Gerber file rather than trying to isolate it

Marius Stanciu 7 years ago
parent
commit
7635687d30
2 changed files with 8 additions and 14 deletions
  1. 1 1
      README.md
  2. 7 13
      flatcamTools/ToolCutOut.py

+ 1 - 1
README.md

@@ -15,7 +15,7 @@ CAD program, and create G-Code for Isolation routing.
 - added some parameters throughout camlib gcode generation functions; handled some possible errors (e.g like when attempting to use an empty Custom GCode Toolchange)
 - added some parameters throughout camlib gcode generation functions; handled some possible errors (e.g like when attempting to use an empty Custom GCode Toolchange)
 - added toggle effect for the tools in the toolbar.
 - added toggle effect for the tools in the toolbar.
 - enhanced the toggle effect for the tools in the Tools Toolbar and also for Notebook Tab selection: if the current tool is activated it will toggle the notebook side but only if the installed widget is itself. If coming from another tool, the notebook will stay visible
 - enhanced the toggle effect for the tools in the Tools Toolbar and also for Notebook Tab selection: if the current tool is activated it will toggle the notebook side but only if the installed widget is itself. If coming from another tool, the notebook will stay visible
--
+- upgraded the Tool Cutout when done from Gerber file to create a convex_hull around the Gerber file rather than trying to isolate it
 
 
 26.02.2019
 26.02.2019
 
 

+ 7 - 13
flatcamTools/ToolCutOut.py

@@ -200,9 +200,11 @@ class CutOut(FlatCAMTool):
         if self.app.ui.splitter.sizes()[0] == 0:
         if self.app.ui.splitter.sizes()[0] == 0:
             self.app.ui.splitter.setSizes([1, 1])
             self.app.ui.splitter.setSizes([1, 1])
         else:
         else:
-            if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
-                self.app.ui.splitter.setSizes([0, 1])
-
+            try:
+                if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
+                    self.app.ui.splitter.setSizes([0, 1])
+            except AttributeError:
+                pass
         FlatCAMTool.run(self)
         FlatCAMTool.run(self)
         self.set_tool_ui()
         self.set_tool_ui()
 
 
@@ -306,21 +308,13 @@ class CutOut(FlatCAMTool):
             # rename the obj name so it can be identified as cutout
             # rename the obj name so it can be identified as cutout
             cutout_obj.options["name"] += "_cutout"
             cutout_obj.options["name"] += "_cutout"
         else:
         else:
-            cutout_obj.isolate(dia=dia, passes=1, overlap=1, combine=False, outname="_temp")
-            ext_obj = self.app.collection.get_by_name("_temp")
-
             def geo_init(geo_obj, app_obj):
             def geo_init(geo_obj, app_obj):
-                geo_obj.solid_geometry = obj_exteriors
+                geo = cutout_obj.solid_geometry.convex_hull
+                geo_obj.solid_geometry = geo.buffer(margin + abs(dia / 2))
 
 
             outname = cutout_obj.options["name"] + "_cutout"
             outname = cutout_obj.options["name"] + "_cutout"
-
-            obj_exteriors = ext_obj.get_exteriors()
             self.app.new_object('geometry', outname, geo_init)
             self.app.new_object('geometry', outname, geo_init)
 
 
-            self.app.collection.set_all_inactive()
-            self.app.collection.set_active("_temp")
-            self.app.on_delete()
-
             cutout_obj = self.app.collection.get_by_name(outname)
             cutout_obj = self.app.collection.get_by_name(outname)
 
 
         if gaps == '8' or gaps == '2LR':
         if gaps == '8' or gaps == '2LR':