- fixed the Defaults upgrade overwrting the new version number with the old one
- fixed issue with clear_polygon3() - the one who makes 'lines' and fixed the NCC Tool
This commit is contained in:
parent
414b96015c
commit
6c2d628c6c
|
@ -140,8 +140,8 @@ class App(QtCore.QObject):
|
|||
# ##########################################################################
|
||||
# ################## Version and VERSION DATE ##############################
|
||||
# ##########################################################################
|
||||
version = 8.99
|
||||
version_date = "2019/12/15"
|
||||
version = 8.991
|
||||
version_date = "2019/12/30"
|
||||
beta = True
|
||||
engine = '3D'
|
||||
|
||||
|
@ -3813,7 +3813,7 @@ class App(QtCore.QObject):
|
|||
|
||||
if 'version' not in defaults or defaults['version'] != self.defaults['version']:
|
||||
for k, v in defaults.items():
|
||||
if k in self.defaults:
|
||||
if k in self.defaults and k != 'version':
|
||||
self.defaults[k] = v
|
||||
|
||||
# delete old factory defaults
|
||||
|
|
|
@ -13,6 +13,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||
|
||||
- in Geometry Editor added support for Jump To function such as that it works within the Editor Tools themselves. For now it works only in absolute jumps
|
||||
- modified the Jump To method such that now allows relative jump from the current mouse location
|
||||
- fixed the Defaults upgrade overwrting the new version number with the old one
|
||||
- fixed issue with clear_polygon3() - the one who makes 'lines' and fixed the NCC Tool
|
||||
|
||||
15.12.2019
|
||||
|
||||
|
|
59
camlib.py
59
camlib.py
|
@ -1381,6 +1381,7 @@ class Geometry(object):
|
|||
inner_edges.append(y)
|
||||
# geoms += outer_edges + inner_edges
|
||||
for g in outer_edges + inner_edges:
|
||||
if g and not g.is_empty:
|
||||
geoms.insert(g)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(g)
|
||||
|
@ -1395,7 +1396,9 @@ class Geometry(object):
|
|||
# Optimization: Reduce lifts
|
||||
if connect:
|
||||
# log.debug("Reducing tool lifts...")
|
||||
geoms = Geometry.paint_connect(geoms, polygon_to_clear, tooldia, steps_per_circle)
|
||||
geoms_conn = Geometry.paint_connect(geoms, polygon_to_clear, tooldia, steps_per_circle)
|
||||
if geoms_conn:
|
||||
return geoms_conn
|
||||
|
||||
return geoms
|
||||
|
||||
|
@ -1419,6 +1422,9 @@ class Geometry(object):
|
|||
"""
|
||||
|
||||
# log.debug("camlib.clear_polygon3()")
|
||||
if not isinstance(polygon, Polygon):
|
||||
log.debug("camlib.Geometry.clear_polygon3() --> Not a Polygon but %s" % str(type(polygon)))
|
||||
return None
|
||||
|
||||
# ## The toolpaths
|
||||
# Index first and last points in paths
|
||||
|
@ -1433,9 +1439,14 @@ class Geometry(object):
|
|||
# Bounding box
|
||||
left, bot, right, top = polygon.bounds
|
||||
|
||||
try:
|
||||
margin_poly = polygon.buffer(-tooldia / 1.99999999, (int(steps_per_circle)))
|
||||
except Exception as e:
|
||||
log.debug("camlib.Geometry.clear_polygon3() --> Could not buffer the Polygon")
|
||||
return None
|
||||
|
||||
# First line
|
||||
try:
|
||||
y = top - tooldia / 1.99999999
|
||||
while y > bot + tooldia / 1.999999999:
|
||||
if self.app.abort_flag:
|
||||
|
@ -1457,17 +1468,14 @@ class Geometry(object):
|
|||
y = bot + tooldia / 2
|
||||
line = LineString([(left, y), (right, y)])
|
||||
line = line.intersection(margin_poly)
|
||||
|
||||
for ll in line:
|
||||
lines_trimmed.append(ll)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(line)
|
||||
|
||||
# Combine
|
||||
# linesgeo = unary_union(lines)
|
||||
|
||||
# Trim to the polygon
|
||||
# margin_poly = polygon.buffer(-tooldia / 1.99999999, (int(steps_per_circle)))
|
||||
# lines_trimmed = linesgeo.intersection(margin_poly)
|
||||
except Exception as e:
|
||||
log.debug('camlib.Geometry.clear_polygon3() Processing poly --> %s' % str(e))
|
||||
return None
|
||||
|
||||
if prog_plot:
|
||||
self.temp_shapes.redraw()
|
||||
|
@ -1477,23 +1485,19 @@ class Geometry(object):
|
|||
# Add lines to storage
|
||||
try:
|
||||
for line in lines_trimmed:
|
||||
if isinstance(line, LineString) or isinstance(line, LinearRing):
|
||||
geoms.insert(line)
|
||||
else:
|
||||
log.debug("camlib.Geometry.clear_polygon3(). Not a line: %s" % str(type(line)))
|
||||
except TypeError:
|
||||
# in case lines_trimmed are not iterable (Linestring, LinearRing)
|
||||
geoms.insert(lines_trimmed)
|
||||
|
||||
# Add margin (contour) to storage
|
||||
if contour:
|
||||
if isinstance(margin_poly, Polygon):
|
||||
geoms.insert(margin_poly.exterior)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(margin_poly.exterior)
|
||||
for ints in margin_poly.interiors:
|
||||
geoms.insert(ints)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(ints)
|
||||
elif isinstance(margin_poly, MultiPolygon):
|
||||
try:
|
||||
for poly in margin_poly:
|
||||
if isinstance(poly, Polygon) and not poly.is_empty:
|
||||
geoms.insert(poly.exterior)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(poly.exterior)
|
||||
|
@ -1501,6 +1505,16 @@ class Geometry(object):
|
|||
geoms.insert(ints)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(ints)
|
||||
except TypeError:
|
||||
if isinstance(margin_poly, Polygon) and not margin_poly.is_empty:
|
||||
marg_ext = margin_poly.exterior
|
||||
geoms.insert(marg_ext)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(margin_poly.exterior)
|
||||
for ints in margin_poly.interiors:
|
||||
geoms.insert(ints)
|
||||
if prog_plot:
|
||||
self.plot_temp_shapes(ints)
|
||||
|
||||
if prog_plot:
|
||||
self.temp_shapes.redraw()
|
||||
|
@ -1508,7 +1522,9 @@ class Geometry(object):
|
|||
# Optimization: Reduce lifts
|
||||
if connect:
|
||||
# log.debug("Reducing tool lifts...")
|
||||
geoms = Geometry.paint_connect(geoms, polygon, tooldia, steps_per_circle)
|
||||
geoms_conn = Geometry.paint_connect(geoms, polygon, tooldia, steps_per_circle)
|
||||
if geoms_conn:
|
||||
return geoms_conn
|
||||
|
||||
return geoms
|
||||
|
||||
|
@ -1581,8 +1597,14 @@ class Geometry(object):
|
|||
optimized_paths.get_points = get_pts
|
||||
path_count = 0
|
||||
current_pt = (0, 0)
|
||||
try:
|
||||
pt, geo = storage.nearest(current_pt)
|
||||
except StopIteration:
|
||||
log.debug("camlib.Geometry.paint_connect(). Storage empty")
|
||||
return None
|
||||
|
||||
storage.remove(geo)
|
||||
|
||||
geo = LineString(geo)
|
||||
current_pt = geo.coords[-1]
|
||||
try:
|
||||
|
@ -1592,6 +1614,7 @@ class Geometry(object):
|
|||
|
||||
pt, candidate = storage.nearest(current_pt)
|
||||
storage.remove(candidate)
|
||||
|
||||
candidate = LineString(candidate)
|
||||
|
||||
# If last point in geometry is the nearest
|
||||
|
|
|
@ -1811,25 +1811,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
# graceful abort requested by the user
|
||||
raise FlatCAMApp.GracefulException
|
||||
if p is not None:
|
||||
poly_processed = list()
|
||||
try:
|
||||
if isinstance(p, Polygon):
|
||||
if ncc_method == 'standard':
|
||||
cp = self.clear_polygon(p, tool, self.grb_circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=prog_plot)
|
||||
elif ncc_method == 'seed':
|
||||
cp = self.clear_polygon2(p, tool, self.grb_circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=prog_plot)
|
||||
else:
|
||||
cp = self.clear_polygon3(p, tool, self.grb_circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=prog_plot)
|
||||
if cp:
|
||||
cleared_geo += list(cp.get_objects())
|
||||
elif isinstance(p, MultiPolygon):
|
||||
for pol in p:
|
||||
if pol is not None:
|
||||
if pol is not None and isinstance(pol, Polygon):
|
||||
if ncc_method == 'standard':
|
||||
cp = self.clear_polygon(pol, tool,
|
||||
self.grb_circle_steps,
|
||||
|
@ -1850,9 +1835,43 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
prog_plot=prog_plot)
|
||||
if cp:
|
||||
cleared_geo += list(cp.get_objects())
|
||||
except Exception as e:
|
||||
log.warning("Polygon can not be cleared. %s" % str(e))
|
||||
poly_processed.append(True)
|
||||
else:
|
||||
poly_processed.append(False)
|
||||
log.warning("Polygon in MultiPolygon can not be cleared.")
|
||||
else:
|
||||
log.warning("Geo in Iterable can not be cleared beacuse it is not Polygon. "
|
||||
"It is: %s" % str(type(pol)))
|
||||
except TypeError:
|
||||
if isinstance(p, Polygon):
|
||||
if ncc_method == 'standard':
|
||||
cp = self.clear_polygon(p, tool, self.grb_circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=prog_plot)
|
||||
elif ncc_method == 'seed':
|
||||
cp = self.clear_polygon2(p, tool, self.grb_circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=prog_plot)
|
||||
else:
|
||||
cp = self.clear_polygon3(p, tool, self.grb_circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=prog_plot)
|
||||
if cp:
|
||||
cleared_geo += list(cp.get_objects())
|
||||
poly_processed.append(True)
|
||||
else:
|
||||
poly_processed.append(False)
|
||||
log.warning("Polygon can not be cleared.")
|
||||
else:
|
||||
log.warning("Geo can not be cleared because it is: %s" % str(type(p)))
|
||||
|
||||
p_cleared = poly_processed.count(True)
|
||||
p_not_cleared = poly_processed.count(False)
|
||||
|
||||
if p_not_cleared:
|
||||
app_obj.poly_not_cleared = True
|
||||
|
||||
if p_cleared == 0:
|
||||
continue
|
||||
|
||||
pol_nr += 1
|
||||
|
|
Loading…
Reference in New Issue