Przeglądaj źródła

- fixed the Gerber.merge() function. When some of the Gerber files have apertures with same id, create a new aperture id for the object that is fused because each aperture id may hold different geometries.

Marius Stanciu 6 lat temu
rodzic
commit
789dcc5da5
2 zmienionych plików z 11 dodań i 4 usunięć
  1. 9 4
      FlatCAMObj.py
  2. 2 0
      README.md

+ 9 - 4
FlatCAMObj.py

@@ -423,10 +423,15 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
                     if ap not in grb_final.apertures:
                         grb_final.apertures[ap] = grb.apertures[ap]
                     else:
-                        if 'solid_geometry' not in grb_final.apertures[ap]:
-                            grb_final.apertures[ap]['solid_geometry'] = []
-                        for geo in grb.apertures[ap]['solid_geometry']:
-                            grb_final.apertures[ap]['solid_geometry'].append(geo)
+                        # create a list of integers out of the grb.apertures keys and find the max of that value
+                        # then, the aperture duplicate is assigned an id value incremented with 1,
+                        # and finally made string because the apertures dict keys are strings
+                        max_ap = str(max([int(k) for k in grb_final.apertures.keys()]) + 1)
+                        grb_final.apertures[max_ap] = {}
+                        grb_final.apertures[max_ap]['solid_geometry'] = []
+
+                        for k, v in grb.apertures[ap].items():
+                            grb_final.apertures[max_ap][k] = v
 
         grb_final.solid_geometry = MultiPolygon(grb_final.solid_geometry)
         grb_final.follow_geometry = MultiPolygon(grb_final.follow_geometry)

+ 2 - 0
README.md

@@ -12,6 +12,8 @@ CAD program, and create G-Code for Isolation routing.
 22.03.2019
 
 - fixed an error that created a situation that when saving a project with some of the CNCJob objects disabled, on project reload the CNCJob objects are no longer loaded
+- fixed the Gerber.merge() function. When some of the Gerber files have apertures with same id, create a new aperture id for the object that is fused because each aperture id may hold different geometries.
+
 
 20.03.2019