Forráskód Böngészése

1. Issue when importing Vector from ezdxf module; 2. KeyError when clicking on Excellon Properties: format expects floating point not string; 3. KeyError when clicking 'Mill Drills': JSON stringified integer keys

Maksym Stetsyuk 5 éve
szülő
commit
d7acfee0ce
3 módosított fájl, 13 hozzáadás és 5 törlés
  1. 4 3
      appObjects/FlatCAMExcellon.py
  2. 6 1
      appObjects/FlatCAMObj.py
  3. 3 1
      appParsers/ParseDXF.py

+ 4 - 3
appObjects/FlatCAMExcellon.py

@@ -879,9 +879,11 @@ class ExcellonObject(FlatCAMObj, Excellon):
 
         for tool in tools:
             if tooldia > self.tools[tool]["tooldia"]:
-                mseg = '[ERROR_NOTCL] %s %s: %s' % (_("Milling tool for DRILLS is larger than hole size. Cancelled."),
+                mseg = '[ERROR_NOTCL] %s %s: %s (tool = %s, hole = %s)' % (_("Milling tool for DRILLS is larger than hole size. Cancelled."),
                                                     _("Tool"),
-                                                    str(tool))
+                                                    str(tool),
+						    str(tooldia),
+						    str(self.tools[tool]["tooldia"]))
                 self.app.inform.emit(mseg)
                 return False, "Error: Milling tool is larger than hole."
 
@@ -920,7 +922,6 @@ class ExcellonObject(FlatCAMObj, Excellon):
                         geo_obj.solid_geometry.append(drill.buffer(0.0000001).exterior)
                     else:
                         geo_obj.solid_geometry.append(drill.buffer(buffer_value).exterior)
-
         if use_thread:
             def geo_thread(a_obj):
                 a_obj.app_obj.new_object("geometry", outname, geo_init, plot=plot)

+ 6 - 1
appObjects/FlatCAMObj.py

@@ -148,6 +148,11 @@ class FlatCAMObj(QtCore.QObject):
 
             if attr == 'options':
                 self.options.update(d[attr])
+            elif attr == 'tools':
+	        #FIXME: JSON stringifies all keys however tools datastructure is indexed by integer not by string
+                if(d[attr] != None):
+                    d[attr] = {int(k):v for k,v in d[attr].items()}
+                setattr(self, attr, d[attr])
             else:
                 try:
                     setattr(self, attr, d[attr])
@@ -780,7 +785,7 @@ class FlatCAMObj(QtCore.QObject):
                     exc_tool,
                     [
                         _('Diameter'),
-                        '%.*f %s' % (self.decimals, tool_dia, self.app.defaults['units'].lower())
+                        '%.*f %s' % (self.decimals, float(tool_dia), self.app.defaults['units'].lower())
                     ],
                     True
                 )

+ 3 - 1
appParsers/ParseDXF.py

@@ -7,7 +7,9 @@
 
 from shapely.geometry import LineString
 from shapely.affinity import rotate
-from ezdxf.math import Vec3 as ezdxf_vector
+#FIXME: No such class as Vec3 in ezdxf.0.15.1, instead there is Vector "ImportError: cannot import name 'Vec3' from 'ezdxf.math" 
+#from ezdxf.math import Vec3 as ezdxf_vector
+from ezdxf.math import Vector as ezdxf_vector
 
 from appParsers.ParseFont import *
 from appParsers.ParseDXF_Spline import *