Selaa lähdekoodia

- fixed issue #347 - a Gerber generated by Sprint Layout with copper pour ON will not have rendered the copper pour

Marius S 6 vuotta sitten
vanhempi
commit
0b50734578
2 muutettua tiedostoa jossa 11 lisäystä ja 2 poistoa
  1. 1 0
      README.md
  2. 10 2
      flatcamParsers/ParseGerber.py

+ 1 - 0
README.md

@@ -21,6 +21,7 @@ CAD program, and create G-Code for Isolation routing.
 - added ability to save the Source File as PDF - fixed page size and added line breaks
 - added ability to save the Source File as PDF - fixed page size and added line breaks
 - more mods to generate_from_geometry_2() method
 - more mods to generate_from_geometry_2() method
 - fixed bug saving the FlatCAM project saying the file is used by another application
 - fixed bug saving the FlatCAM project saying the file is used by another application
+- fixed issue #347 - a Gerber generated by Sprint Layout with copper pour ON will not have rendered the copper pour
 
 
 16.12.2019
 16.12.2019
 
 

+ 10 - 2
flatcamParsers/ParseGerber.py

@@ -465,11 +465,12 @@ class Gerber(Geometry):
                             geo_dict['follow'] = geo_f
                             geo_dict['follow'] = geo_f
 
 
                         geo_s = LineString(path).buffer(width / 1.999, int(self.steps_per_circle / 4))
                         geo_s = LineString(path).buffer(width / 1.999, int(self.steps_per_circle / 4))
-                        if not geo_s.is_empty:
+                        if not geo_s.is_empty and geo_s.is_valid:
                             if self.app.defaults['gerber_simplification']:
                             if self.app.defaults['gerber_simplification']:
                                 poly_buffer.append(geo_s.simplify(s_tol))
                                 poly_buffer.append(geo_s.simplify(s_tol))
                             else:
                             else:
                                 poly_buffer.append(geo_s)
                                 poly_buffer.append(geo_s)
+
                             if self.is_lpc is True:
                             if self.is_lpc is True:
                                 geo_dict['clear'] = geo_s
                                 geo_dict['clear'] = geo_s
                             else:
                             else:
@@ -1411,7 +1412,14 @@ class Gerber(Geometry):
             if current_polarity == 'D':
             if current_polarity == 'D':
                 self.app.inform.emit('%s' % _("Gerber processing. Applying Gerber polarity."))
                 self.app.inform.emit('%s' % _("Gerber processing. Applying Gerber polarity."))
                 if new_poly.is_valid:
                 if new_poly.is_valid:
-                    self.solid_geometry = self.solid_geometry.union(new_poly)
+                    # self.solid_geometry = self.solid_geometry.union(new_poly)
+                    # FIX for issue #347 - Sprint Layout generate strange Gerber files when the copper pour is enabled
+                    # it use a filled bounding box polygon to which add clear polygons (negative) to isolate the copper
+                    # features
+                    candidate_geo = list()
+                    for p in self.solid_geometry.union(new_poly):
+                        candidate_geo.append(p.buffer(-0.0000001))
+                    self.solid_geometry = candidate_geo
                 else:
                 else:
                     # I do this so whenever the parsed geometry of the file is not valid (intersections) it is still
                     # I do this so whenever the parsed geometry of the file is not valid (intersections) it is still
                     # loaded. Instead of applying a union I add to a list of polygons.
                     # loaded. Instead of applying a union I add to a list of polygons.