- fixed issue in NCC Tool when using area option
This commit is contained in:
@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
2.09.2019
|
||||||
|
|
||||||
|
- fixed issue in NCC Tool when using area option
|
||||||
|
|
||||||
1.09.2019
|
1.09.2019
|
||||||
|
|
||||||
- fixed open handlers
|
- fixed open handlers
|
||||||
|
|||||||
@@ -1178,31 +1178,49 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
ncc_sel_obj = ncc_obj
|
ncc_sel_obj = ncc_obj
|
||||||
else:
|
else:
|
||||||
ncc_sel_obj = sel_obj
|
ncc_sel_obj = sel_obj
|
||||||
|
except Exception as e:
|
||||||
|
log.debug("NonCopperClear.clear_copper() --> %s" % str(e))
|
||||||
|
return 'fail'
|
||||||
|
|
||||||
bounding_box = None
|
bounding_box = None
|
||||||
if ncc_select == 'itself':
|
if ncc_select == 'itself':
|
||||||
geo_n = ncc_sel_obj.solid_geometry
|
geo_n = ncc_sel_obj.solid_geometry
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if isinstance(geo_n, MultiPolygon):
|
if isinstance(geo_n, MultiPolygon):
|
||||||
env_obj = geo_n.convex_hull
|
env_obj = geo_n.convex_hull
|
||||||
elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
|
elif (isinstance(geo_n, MultiPolygon) and len(geo_n) == 1) or \
|
||||||
(isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
|
(isinstance(geo_n, list) and len(geo_n) == 1) and isinstance(geo_n[0], Polygon):
|
||||||
env_obj = cascaded_union(geo_n)
|
env_obj = cascaded_union(geo_n)
|
||||||
else:
|
else:
|
||||||
env_obj = cascaded_union(geo_n)
|
env_obj = cascaded_union(geo_n)
|
||||||
env_obj = env_obj.convex_hull
|
env_obj = env_obj.convex_hull
|
||||||
|
|
||||||
bounding_box = env_obj.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
|
bounding_box = env_obj.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("NonCopperClear.on_ncc() --> %s" % str(e))
|
log.debug("NonCopperClear.clear_copper() 'itself' --> %s" % str(e))
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] No object available."))
|
self.app.inform.emit(_("[ERROR_NOTCL] No object available."))
|
||||||
return
|
return 'fail'
|
||||||
elif ncc_select == 'area':
|
elif ncc_select == 'area':
|
||||||
geo_n = MultiPolygon(self.sel_rect)
|
geo_n = cascaded_union(self.sel_rect)
|
||||||
|
try:
|
||||||
|
__ = iter(geo_n)
|
||||||
|
except Exception as e:
|
||||||
|
log.debug("NonCopperClear.clear_copper() 'area' --> %s" % str(e))
|
||||||
|
geo_n = [geo_n]
|
||||||
|
|
||||||
|
geo_buff_list = []
|
||||||
|
for poly in geo_n:
|
||||||
|
geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
|
||||||
|
|
||||||
|
bounding_box = cascaded_union(geo_buff_list)
|
||||||
|
elif ncc_select == 'box':
|
||||||
|
geo_n = ncc_sel_obj.solid_geometry
|
||||||
|
if isinstance(ncc_sel_obj, FlatCAMGeometry):
|
||||||
try:
|
try:
|
||||||
__ = iter(geo_n)
|
__ = iter(geo_n)
|
||||||
except TypeError:
|
except Exception as e:
|
||||||
|
log.debug("NonCopperClear.clear_copper() 'box' --> %s" % str(e))
|
||||||
geo_n = [geo_n]
|
geo_n = [geo_n]
|
||||||
|
|
||||||
geo_buff_list = []
|
geo_buff_list = []
|
||||||
@@ -1210,29 +1228,13 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
|
geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
|
||||||
|
|
||||||
bounding_box = cascaded_union(geo_buff_list)
|
bounding_box = cascaded_union(geo_buff_list)
|
||||||
elif ncc_select == 'box':
|
elif isinstance(ncc_sel_obj, FlatCAMGerber):
|
||||||
geo_n = ncc_sel_obj.solid_geometry
|
geo_n = cascaded_union(geo_n).convex_hull
|
||||||
if isinstance(ncc_sel_obj, FlatCAMGeometry):
|
bounding_box = cascaded_union(self.ncc_obj.solid_geometry).convex_hull.intersection(geo_n)
|
||||||
try:
|
bounding_box = bounding_box.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
|
||||||
__ = iter(geo_n)
|
else:
|
||||||
except TypeError:
|
self.app.inform.emit(_("[ERROR_NOTCL] The reference object type is not supported."))
|
||||||
geo_n = [geo_n]
|
return 'fail'
|
||||||
|
|
||||||
geo_buff_list = []
|
|
||||||
for poly in geo_n:
|
|
||||||
geo_buff_list.append(poly.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre))
|
|
||||||
|
|
||||||
bounding_box = cascaded_union(geo_buff_list)
|
|
||||||
elif isinstance(ncc_sel_obj, FlatCAMGerber):
|
|
||||||
geo_n = cascaded_union(geo_n).convex_hull
|
|
||||||
bounding_box = cascaded_union(self.ncc_obj.solid_geometry).convex_hull.intersection(geo_n)
|
|
||||||
bounding_box = bounding_box.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
|
|
||||||
else:
|
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] The reference object type is not supported."))
|
|
||||||
return 'fail'
|
|
||||||
except Exception as e:
|
|
||||||
log.debug("NonCopperClear.clear_copper() --> %s" % str(e))
|
|
||||||
return 'fail'
|
|
||||||
|
|
||||||
# ########################################################################################################
|
# ########################################################################################################
|
||||||
# set the name for the future Geometry object
|
# set the name for the future Geometry object
|
||||||
|
|||||||
Reference in New Issue
Block a user