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

- finished the Silkscreen Tool but there are some limitations (some wires fragments from silkscreen are lost)

Marius Stanciu 6 лет назад
Родитель
Сommit
0e94a2bd11
2 измененных файлов с 11 добавлено и 6 удалено
  1. 1 1
      README.md
  2. 10 5
      flatcamTools/ToolSilk.py

+ 1 - 1
README.md

@@ -14,7 +14,7 @@ CAD program, and create G-Code for Isolation routing.
 - solved bug in Gerber Editor: the '0' aperture (the region aperture) had no size which created errors. Made the size to be zero.
 - solved bug in Gerber Editor: the '0' aperture (the region aperture) had no size which created errors. Made the size to be zero.
 - solved bug in editors: the canvas selection shape was not deleted on mouse release if the grid snap was OFF
 - solved bug in editors: the canvas selection shape was not deleted on mouse release if the grid snap was OFF
 - solved bug in Excellon Editor: when selecting a drill hole on canvas the selected row in the Tools Table was not the correct onw but the next highest row
 - solved bug in Excellon Editor: when selecting a drill hole on canvas the selected row in the Tools Table was not the correct onw but the next highest row
-- finished the Silkscreen Tool
+- finished the Silkscreen Tool but there are some limitations (some wires fragments from silkscreen are lost)
 
 
 26.04.2019
 26.04.2019
 
 

+ 10 - 5
flatcamTools/ToolSilk.py

@@ -182,23 +182,27 @@ class ToolSilk(FlatCAMTool):
             geo_union_list += self.sm_obj.apertures[apid1]['solid_geometry']
             geo_union_list += self.sm_obj.apertures[apid1]['solid_geometry']
         self.solder_union = cascaded_union(geo_union_list)
         self.solder_union = cascaded_union(geo_union_list)
 
 
-        # start the QTimer with 1 second period check
+        # add the promises
+        for apid in self.silk_obj.apertures:
+            self.promises.append(apid)
+
+        # start the QTimer to check for promises with 1 second period check
         self.periodic_check(1000, reset=True)
         self.periodic_check(1000, reset=True)
 
 
         for apid in self.silk_obj.apertures:
         for apid in self.silk_obj.apertures:
             geo = self.silk_obj.apertures[apid]['solid_geometry']
             geo = self.silk_obj.apertures[apid]['solid_geometry']
-            while apid not in self.promises:
-                self.promises.append(apid)
             self.app.worker_task.emit({'fcn': self.aperture_intersection,
             self.app.worker_task.emit({'fcn': self.aperture_intersection,
                                        'params': [apid, geo]})
                                        'params': [apid, geo]})
 
 
     def aperture_intersection(self, apid, geo):
     def aperture_intersection(self, apid, geo):
         new_solid_geometry = []
         new_solid_geometry = []
+        log.debug("Working on promise: %s" % str(apid))
 
 
         with self.app.proc_container.new(_("Parsing aperture %s geometry ..." % str(apid))):
         with self.app.proc_container.new(_("Parsing aperture %s geometry ..." % str(apid))):
             for geo_silk in geo:
             for geo_silk in geo:
                 if geo_silk.intersects(self.solder_union):
                 if geo_silk.intersects(self.solder_union):
                     new_geo = geo_silk.difference(self.solder_union)
                     new_geo = geo_silk.difference(self.solder_union)
+                    new_geo = new_geo.buffer(0)
                     if new_geo:
                     if new_geo:
                         if not new_geo.is_empty:
                         if not new_geo.is_empty:
                             new_solid_geometry.append(new_geo)
                             new_solid_geometry.append(new_geo)
@@ -225,6 +229,7 @@ class ToolSilk(FlatCAMTool):
 
 
         log.debug("Promise fulfilled: %s" % str(apid))
         log.debug("Promise fulfilled: %s" % str(apid))
 
 
+
     def periodic_check(self, check_period, reset=False):
     def periodic_check(self, check_period, reset=False):
         """
         """
         This function starts an QTimer and it will periodically check if intersections are done
         This function starts an QTimer and it will periodically check if intersections are done
@@ -282,9 +287,9 @@ class ToolSilk(FlatCAMTool):
                 for poly in self.new_apertures[ap]['solid_geometry']:
                 for poly in self.new_apertures[ap]['solid_geometry']:
                     poly_buff.append(poly)
                     poly_buff.append(poly)
 
 
-            poly_buff = MultiPolygon(poly_buff)
+            work_poly_buff = MultiPolygon(poly_buff)
             try:
             try:
-                poly_buff = poly_buff.buffer(0.0000001)
+                poly_buff = work_poly_buff.buffer(0.0000001)
             except ValueError:
             except ValueError:
                 pass
                 pass
             try:
             try: