Explorar o código

- fixed the geometry adding to the self.apertures in the case when regions are done without declaring any aperture first (Allegro does that). Now, that geometry will be stored in the '0' aperture with type REG

Marius Stanciu %!s(int64=7) %!d(string=hai) anos
pai
achega
00340287a4
Modificáronse 2 ficheiros con 18 adicións e 3 borrados
  1. 1 0
      README.md
  2. 17 3
      camlib.py

+ 1 - 0
README.md

@@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
 26.02.2019
 26.02.2019
 
 
 - added a function to read the parameters from ToolChange macro Text Box (I need to move it from CNCJob to Excellon and Geometry)
 - added a function to read the parameters from ToolChange macro Text Box (I need to move it from CNCJob to Excellon and Geometry)
+- fixed the geometry adding to the self.apertures in the case when regions are done without declaring any aperture first (Allegro does that). Now, that geometry will be stored in the '0' aperture with type REG
 
 
 25.02.2019
 25.02.2019
 
 

+ 17 - 3
camlib.py

@@ -2538,11 +2538,25 @@ class Gerber (Geometry):
 
 
                     if not region.is_empty:
                     if not region.is_empty:
                         poly_buffer.append(region)
                         poly_buffer.append(region)
+
+                        # we do this for the case that a region is done without having defined any aperture
+                        # Allegro does that
+                        if current_aperture:
+                            used_aperture = current_aperture
+                        elif last_path_aperture:
+                            used_aperture = last_path_aperture
+                        else:
+                            if '0' not in self.apertures:
+                                self.apertures['0'] = {}
+                                self.apertures['0']['solid_geometry'] = []
+                                self.apertures['0']['type'] = 'REG'
+                            used_aperture = '0'
+
                         try:
                         try:
-                            self.apertures[current_aperture]['solid_geometry'].append(region)
+                            self.apertures[used_aperture]['solid_geometry'].append(region)
                         except KeyError:
                         except KeyError:
-                            self.apertures[current_aperture]['solid_geometry'] = []
-                            self.apertures[current_aperture]['solid_geometry'].append(region)
+                            self.apertures[used_aperture]['solid_geometry'] = []
+                            self.apertures[used_aperture]['solid_geometry'].append(region)
 
 
                     path = [[current_x, current_y]]  # Start new path
                     path = [[current_x, current_y]]  # Start new path
                     continue
                     continue