- updated Copper Thieving Tool to work with the updated program

This commit is contained in:
Marius Stanciu 2020-10-23 01:53:34 +03:00 committed by Marius
parent baa67b1278
commit a39f3f7cac
2 changed files with 22 additions and 12 deletions

View File

@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
=================================================
23.10.2020
- updated Copper Thieving Tool to work with the updated program
22.10.2020
- added a message to show if voronoi_diagram method can be used (require Shapely >= 1.8)

View File

@ -519,9 +519,9 @@ class ToolCopperThieving(AppTool):
ref_selected = self.ui.reference_radio.get_value()
if c_val is None:
c_val = float(self.app.defaults["tools_copperfill_clearance"])
c_val = float(self.app.defaults["tools_copper_thieving_clearance"])
if margin is None:
margin = float(self.app.defaults["tools_copperfill_margin"])
margin = float(self.app.defaults["tools_copper_thieving_margin"])
fill_type = self.ui.fill_type_radio.get_value()
dot_dia = self.ui.dot_dia_entry.get_value()
@ -543,10 +543,8 @@ class ToolCopperThieving(AppTool):
app_obj.app.inform.emit(_("Copper Thieving Tool. Preparing isolation polygons."))
# variables to display the percentage of work done
geo_len = 0
try:
for pol in app_obj.grb_object.solid_geometry:
geo_len += 1
geo_len = len(app_obj.grb_object.solid_geometry)
except TypeError:
geo_len = 1
@ -613,10 +611,12 @@ class ToolCopperThieving(AppTool):
bounding_box = env_obj.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
else:
if isinstance(geo_n, Polygon):
bounding_box = geo_n.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre).exterior
bounding_box = geo_n.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
elif isinstance(geo_n, list):
geo_n = unary_union(geo_n)
bounding_box = geo_n.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre).exterior
geo_n = MultiPolygon(geo_n)
x0, y0, x1, y1 = geo_n.bounds
geo = box(x0, y0, x1, y1)
bounding_box = geo.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
elif isinstance(geo_n, MultiPolygon):
x0, y0, x1, y1 = geo_n.bounds
geo = box(x0, y0, x1, y1)
@ -689,10 +689,16 @@ class ToolCopperThieving(AppTool):
# bounding_box = box(x0, y0, x1, y1)
app_obj.app.proc_container.update_view_text(' %s' % _("Create geometry"))
bounding_box = thieving_obj.solid_geometry.envelope.buffer(
distance=margin,
join_style=base.JOIN_STYLE.mitre
)
try:
bounding_box = thieving_obj.solid_geometry.envelope.buffer(
distance=margin,
join_style=base.JOIN_STYLE.mitre
)
except AttributeError:
bounding_box = MultiPolygon(thieving_obj.solid_geometry).envelope.buffer(
distance=margin,
join_style=base.JOIN_STYLE.mitre
)
x0, y0, x1, y1 = bounding_box.bounds
if fill_type == 'dot' or fill_type == 'square':