Просмотр исходного кода

- fixed issue #302 where a copied object lost all the tools

Marius Stanciu 6 лет назад
Родитель
Сommit
7af96faef6
2 измененных файлов с 12 добавлено и 11 удалено
  1. 11 11
      FlatCAMApp.py
  2. 1 0
      README.md

+ 11 - 11
FlatCAMApp.py

@@ -5880,24 +5880,24 @@ class App(QtCore.QObject):
         self.report_usage("on_copy_object()")
 
         def initialize(obj_init, app):
-            obj_init.solid_geometry = obj.solid_geometry
+            obj_init.solid_geometry = deepcopy(obj.solid_geometry)
             try:
-                obj_init.follow_geometry = obj.follow_geometry
+                obj_init.follow_geometry = deepcopy(obj.follow_geometry)
             except AttributeError:
                 pass
             try:
-                obj_init.apertures = obj.apertures
+                obj_init.apertures = deepcopy(obj.apertures)
             except AttributeError:
                 pass
 
             try:
                 if obj.tools:
-                    obj_init.tools = obj.tools
+                    obj_init.tools = deepcopy(obj.tools)
             except Exception as e:
                 log.debug("App.on_copy_object() --> %s" % str(e))
 
         def initialize_excellon(obj_init, app):
-            obj_init.tools = obj.tools
+            obj_init.tools = deepcopy(obj.tools)
 
             # drills are offset, so they need to be deep copied
             obj_init.drills = deepcopy(obj.drills)
@@ -5921,29 +5921,29 @@ class App(QtCore.QObject):
     def on_copy_object2(self, custom_name):
 
         def initialize_geometry(obj_init, app):
-            obj_init.solid_geometry = obj.solid_geometry
+            obj_init.solid_geometry = deepcopy(obj.solid_geometry)
             try:
-                obj_init.follow_geometry = obj.follow_geometry
+                obj_init.follow_geometry = deepcopy(obj.follow_geometry)
             except AttributeError:
                 pass
             try:
-                obj_init.apertures = obj.apertures
+                obj_init.apertures = deepcopy(obj.apertures)
             except AttributeError:
                 pass
 
             try:
                 if obj.tools:
-                    obj_init.tools = obj.tools
+                    obj_init.tools = deepcopy(obj.tools)
             except Exception as e:
                 log.debug("on_copy_object2() --> %s" % str(e))
 
         def initialize_gerber(obj_init, app):
-            obj_init.solid_geometry = obj.solid_geometry
+            obj_init.solid_geometry = deepcopy(obj.solid_geometry)
             obj_init.apertures = deepcopy(obj.apertures)
             obj_init.aperture_macros = deepcopy(obj.aperture_macros)
 
         def initialize_excellon(obj_init, app):
-            obj_init.tools = obj.tools
+            obj_init.tools = deepcopy(obj.tools)
             # drills are offset, so they need to be deep copied
             obj_init.drills = deepcopy(obj.drills)
             # slots are offset, so they need to be deep copied

+ 1 - 0
README.md

@@ -18,6 +18,7 @@ CAD program, and create G-Code for Isolation routing.
 - fixed the TclCommand MillHoles
 - changed the name of TclCommand MillHoles to MillDrills and added a new TclCommand named MillSlots
 - modified the MillDrills and MillSlots TclCommands to accept as parameter a list of tool diameters to be milled instead of tool indexes
+- fixed issue #302 where a copied object lost all the tools
 
 10.09.2019