Procházet zdrojové kódy

- made sure that if using an negative Gerber isolation diameter, the resulting Geometry object will use a tool with positive diameter
- fixed bug that when isolating a Gerber file made out of a single polygon, an Recurrsion Exception was issued together with inability to create tbe isolation

Marius Stanciu před 6 roky
rodič
revize
afdff59aff
3 změnil soubory, kde provedl 20 přidání a 5 odebrání
  1. 4 2
      FlatCAMObj.py
  2. 5 0
      README.md
  3. 11 3
      camlib.py

+ 4 - 2
FlatCAMObj.py

@@ -841,7 +841,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         :param outname: Base name of the output object
         :return: None
         """
-
         if dia is None:
             dia = float(self.options["isotooldia"])
         if passes is None:
@@ -872,7 +871,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
             try:
                 geom = self.isolation_geometry(offset, iso_type=envelope_iso_type, follow=follow)
             except Exception as e:
-                log.debug(str(e))
+                log.debug('FlatCAMGerber.isolate().generate_envelope() --> %s' % str(e))
                 return 'fail'
 
             if invert:
@@ -890,6 +889,9 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
                     log.debug("FlatCAMGerber.isolate().generate_envelope() Error --> %s" % str(e))
             return geom
 
+        if float(self.options["isotooldia"]) < 0:
+            self.options["isotooldia"] = -self.options["isotooldia"]
+
         if combine:
             if self.iso_type == 0:
                 iso_name = self.options["name"] + "_ext_iso"

+ 5 - 0
README.md

@@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+5.08.2019
+
+- made sure that if using an negative Gerber isolation diameter, the resulting Geometry object will use a tool with positive diameter
+- fixed bug that when isolating a Gerber file made out of a single polygon, an Recurrsion Exception was issued together with inability to create tbe isolation
+
 3.08.2019
 
 - added project name to the window title

+ 11 - 3
camlib.py

@@ -543,6 +543,7 @@ class Geometry(object):
 
         # the previously commented block is replaced with this block - regression - to solve the bug with multiple
         # isolation passes cutting from the copper features
+
         if offset == 0:
             if follow:
                 geo_iso = self.follow_geometry
@@ -553,10 +554,17 @@ class Geometry(object):
                 geo_iso = self.follow_geometry
             else:
                 if corner is None:
-                    geo_iso = self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4))
+                    if type(self.solid_geometry) is list and len(self.solid_geometry) == 1:
+                        geo_iso = self.solid_geometry[0].buffer(offset, int(int(self.geo_steps_per_circle) / 4))
+                    else:
+                        geo_iso = self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4))
                 else:
-                    geo_iso = self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
-                                                         join_style=corner)
+                    if type(self.solid_geometry) is list and len(self.solid_geometry) == 1:
+                        geo_iso = self.solid_geometry.buffer[0](offset, int(int(self.geo_steps_per_circle) / 4),
+                                                                join_style=corner)
+                    else:
+                        geo_iso = self.solid_geometry.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
+                                                             join_style=corner)
 
         # end of replaced block
         if follow: