- some fixes in Drilling Tool and in camlib.py file
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
|
||||
|
||||
=================================================
|
||||
|
||||
27.01.2021
|
||||
|
||||
- some fixes in Drilling Tool and in camlib.py file
|
||||
|
||||
21.01.2021
|
||||
|
||||
- added ability to see the verbose log when importing SVG's (if set in preferences)
|
||||
|
||||
@@ -306,17 +306,23 @@ class ToolDrilling(AppTool, Excellon):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
loaded_obj = self.app.collection.get_by_name(self.ui.object_combo.get_value())
|
||||
except Exception as err:
|
||||
self.app.log.error("ToolDrilling -> Loaded Excellon object error. %s" % str(err))
|
||||
return
|
||||
|
||||
# reset the Excellon preprocessor combo
|
||||
self.ui.pp_excellon_name_cb.clear()
|
||||
# populate Excellon preprocessor combobox list
|
||||
if loaded_obj.options['tools_drill_ppname_e'] == 'Check_points':
|
||||
pp_list = ['Check_points']
|
||||
else:
|
||||
pp_list = []
|
||||
for name in self.app.preprocessors.keys():
|
||||
# the HPGL preprocessor or Paste_ are not for Excellon job therefore don't add it
|
||||
if name in ['hpgl', 'Paste_1']:
|
||||
continue
|
||||
elif name == 'Check_points':
|
||||
pp_list = [name]
|
||||
break
|
||||
pp_list.append(name)
|
||||
pp_list.sort()
|
||||
if 'default' in pp_list:
|
||||
@@ -330,12 +336,6 @@ class ToolDrilling(AppTool, Excellon):
|
||||
|
||||
self.ui.order_radio.set_value(self.app.defaults["tools_drill_tool_order"])
|
||||
|
||||
try:
|
||||
loaded_obj = self.app.collection.get_by_name(self.ui.object_combo.get_value())
|
||||
except Exception as err:
|
||||
self.app.log.error("ToolDrilling -> Loaded Excellon object error. %s" % str(err))
|
||||
return
|
||||
|
||||
if loaded_obj:
|
||||
outname = loaded_obj.options['name']
|
||||
else:
|
||||
|
||||
18
camlib.py
18
camlib.py
@@ -612,7 +612,7 @@ class Geometry(object):
|
||||
self.options['xmax'] = xmax
|
||||
self.options['ymax'] = ymax
|
||||
except Exception as e:
|
||||
log.error("Failed. The object has no bounds properties. %s" % str(e))
|
||||
self.app.log.error("Failed. The object has no bounds properties. %s" % str(e))
|
||||
|
||||
def add_polygon(self, points, tool=None):
|
||||
"""
|
||||
@@ -653,7 +653,7 @@ class Geometry(object):
|
||||
self.options['xmax'] = xmax
|
||||
self.options['ymax'] = ymax
|
||||
except Exception as e:
|
||||
log.error("Failed. The object has no bounds properties. %s" % str(e))
|
||||
self.app.log.error("Failed. The object has no bounds properties. %s" % str(e))
|
||||
|
||||
def add_polyline(self, points, tool=None):
|
||||
"""
|
||||
@@ -677,7 +677,7 @@ class Geometry(object):
|
||||
try:
|
||||
self.solid_geometry = self.solid_geometry.union(new_line)
|
||||
except Exception as e:
|
||||
log.error("Failed to run union on polylines. %s" % str(e))
|
||||
self.app.log.error("Failed to run union on polylines. %s" % str(e))
|
||||
return "fail"
|
||||
|
||||
# add in tools solid_geometry
|
||||
@@ -694,7 +694,7 @@ class Geometry(object):
|
||||
self.options['xmax'] = xmax
|
||||
self.options['ymax'] = ymax
|
||||
except Exception as e:
|
||||
log.error("Failed. The object has no bounds properties. %s" % str(e))
|
||||
self.app.log.error("Failed. The object has no bounds properties. %s" % str(e))
|
||||
|
||||
def is_empty(self):
|
||||
if isinstance(self.solid_geometry, BaseGeometry) or isinstance(self.solid_geometry, Polygon) or \
|
||||
@@ -732,7 +732,7 @@ class Geometry(object):
|
||||
if isinstance(target, LineString) or isinstance(target, LineString) or isinstance(target, MultiLineString):
|
||||
diffs.append(target.difference(toolgeo))
|
||||
else:
|
||||
log.warning("Not implemented.")
|
||||
self.app.log.warning("Not implemented.")
|
||||
|
||||
self.solid_geometry = unary_union(diffs)
|
||||
|
||||
@@ -746,10 +746,10 @@ class Geometry(object):
|
||||
# fixed issue of getting bounds only for one level lists of objects
|
||||
# now it can get bounds for nested lists of objects
|
||||
|
||||
log.debug("camlib.Geometry.bounds()")
|
||||
self.app.log.debug("camlib.Geometry.bounds()")
|
||||
|
||||
if self.solid_geometry is None:
|
||||
log.debug("solid_geometry is None")
|
||||
self.app.log.debug("solid_geometry is None")
|
||||
return 0, 0, 0, 0
|
||||
|
||||
def bounds_rec(obj):
|
||||
@@ -7558,7 +7558,7 @@ class CNCjob(Geometry):
|
||||
:rtype: tuple
|
||||
"""
|
||||
|
||||
log.debug("camlib.CNCJob.bounds()")
|
||||
self.app.log.debug("camlib.CNCJob.bounds()")
|
||||
|
||||
def bounds_rec(obj):
|
||||
if type(obj) is list:
|
||||
@@ -7606,6 +7606,8 @@ class CNCjob(Geometry):
|
||||
maxy = -np.Inf
|
||||
try:
|
||||
for geo in v['solid_geometry']:
|
||||
if isinstance(geo, list):
|
||||
geo = unary_union(geo)
|
||||
if geo.is_empty:
|
||||
continue
|
||||
minx_, miny_, maxx_, maxy_ = bounds_rec(geo)
|
||||
|
||||
Reference in New Issue
Block a user