Merged Beta_8.995 into gerber_editor_upgrade
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM Evo beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
17.05.2020
|
||||||
|
|
||||||
|
- in Cutout Plugin added ability to use the margin (full range of values: negative, zero, positive) when applying the cutout over a Geometry source object
|
||||||
|
|
||||||
16.05.2022
|
16.05.2022
|
||||||
|
|
||||||
- finished upgrading the UI in Geometry Editor sub-tools
|
- finished upgrading the UI in Geometry Editor sub-tools
|
||||||
|
|||||||
@@ -734,7 +734,7 @@ class CutOut(AppTool):
|
|||||||
geo_buf = object_geo.buffer(margin + abs(cut_dia / 2))
|
geo_buf = object_geo.buffer(margin + abs(cut_dia / 2))
|
||||||
geo = geo_buf.exterior
|
geo = geo_buf.exterior
|
||||||
else:
|
else:
|
||||||
geo_buf = object_geo.buffer(- margin + abs(cut_dia / 2))
|
geo_buf = object_geo.buffer(-margin + abs(cut_dia / 2))
|
||||||
geo = unary_union(geo_buf.interiors)
|
geo = unary_union(geo_buf.interiors)
|
||||||
else:
|
else:
|
||||||
if isinstance(object_geo, (MultiPolygon, MultiLineString)):
|
if isinstance(object_geo, (MultiPolygon, MultiLineString)):
|
||||||
@@ -742,8 +742,14 @@ class CutOut(AppTool):
|
|||||||
object_geo = box(x0, y0, x1, y1)
|
object_geo = box(x0, y0, x1, y1)
|
||||||
if isinstance(object_geo, (LinearRing, LineString)):
|
if isinstance(object_geo, (LinearRing, LineString)):
|
||||||
object_geo = Polygon(object_geo)
|
object_geo = Polygon(object_geo)
|
||||||
geo_buf = object_geo.buffer(0)
|
if margin >= 0:
|
||||||
|
geo_buf = object_geo.buffer(margin)
|
||||||
geo = geo_buf.exterior
|
geo = geo_buf.exterior
|
||||||
|
else:
|
||||||
|
geo_buf = object_geo.buffer(0.0000001)
|
||||||
|
geo_ext = geo_buf.exterior
|
||||||
|
buff_geo_ext = geo_ext.buffer(-margin)
|
||||||
|
geo = unary_union(buff_geo_ext.interiors)
|
||||||
|
|
||||||
if geo.is_empty:
|
if geo.is_empty:
|
||||||
self.app.log.debug("Cutout.on_freeform_cutout() -> Empty geometry.")
|
self.app.log.debug("Cutout.on_freeform_cutout() -> Empty geometry.")
|
||||||
@@ -762,6 +768,15 @@ class CutOut(AppTool):
|
|||||||
else:
|
else:
|
||||||
geom_struct_buff = geom_struct.buffer(-margin + abs(cut_dia / 2))
|
geom_struct_buff = geom_struct.buffer(-margin + abs(cut_dia / 2))
|
||||||
geom_struct = geom_struct_buff.interiors
|
geom_struct = geom_struct_buff.interiors
|
||||||
|
else:
|
||||||
|
if margin >= 0:
|
||||||
|
geo_buf = geom_struct.buffer(margin)
|
||||||
|
geom_struct = geo_buf.exterior
|
||||||
|
else:
|
||||||
|
geo_buf = geom_struct.buffer(0.0000001)
|
||||||
|
geo_ext = geo_buf.exterior
|
||||||
|
buff_geo_ext = geo_ext.buffer(-margin)
|
||||||
|
geom_struct = unary_union(buff_geo_ext.interiors)
|
||||||
|
|
||||||
c_geo, r_geo = self.any_cutout_handler(geom_struct, cut_dia, gaps, gapsize, margin)
|
c_geo, r_geo = self.any_cutout_handler(geom_struct, cut_dia, gaps, gapsize, margin)
|
||||||
solid_geo += c_geo
|
solid_geo += c_geo
|
||||||
@@ -800,7 +815,7 @@ class CutOut(AppTool):
|
|||||||
if isinstance(mb_object_geo, MultiPolygon):
|
if isinstance(mb_object_geo, MultiPolygon):
|
||||||
x0, y0, x1, y1 = mb_object_geo.bounds
|
x0, y0, x1, y1 = mb_object_geo.bounds
|
||||||
mb_object_geo = box(x0, y0, x1, y1)
|
mb_object_geo = box(x0, y0, x1, y1)
|
||||||
geo_buf = mb_object_geo.buffer(0)
|
geo_buf = mb_object_geo.buffer(0.0000001)
|
||||||
mb_geo = geo_buf.exterior
|
mb_geo = geo_buf.exterior
|
||||||
|
|
||||||
__, rest_geo = self.any_cutout_handler(mb_geo, cut_dia, gaps, gapsize, margin)
|
__, rest_geo = self.any_cutout_handler(mb_geo, cut_dia, gaps, gapsize, margin)
|
||||||
@@ -920,7 +935,6 @@ class CutOut(AppTool):
|
|||||||
|
|
||||||
# Get min and max data for each object as we just cut rectangles across X or Y
|
# Get min and max data for each object as we just cut rectangles across X or Y
|
||||||
xxmin, yymin, xxmax, yymax = CutOut.recursive_bounds(geom)
|
xxmin, yymin, xxmax, yymax = CutOut.recursive_bounds(geom)
|
||||||
|
|
||||||
px = 0.5 * (xxmax - xxmin) + xxmin # center X
|
px = 0.5 * (xxmax - xxmin) + xxmin # center X
|
||||||
py = 0.5 * (yymax - yymin) + yymin # center Y
|
py = 0.5 * (yymax - yymin) + yymin # center Y
|
||||||
lenx = (xxmax - xxmin) + (margin * 2)
|
lenx = (xxmax - xxmin) + (margin * 2)
|
||||||
@@ -1109,6 +1123,15 @@ class CutOut(AppTool):
|
|||||||
else:
|
else:
|
||||||
work_margin = margin - abs(cut_dia / 2)
|
work_margin = margin - abs(cut_dia / 2)
|
||||||
geo = geo.buffer(work_margin)
|
geo = geo.buffer(work_margin)
|
||||||
|
else:
|
||||||
|
if margin >= 0:
|
||||||
|
geo_buf = geo.buffer(margin)
|
||||||
|
geo = geo_buf.exterior
|
||||||
|
else:
|
||||||
|
geo_buf = geo.buffer(0.0000001)
|
||||||
|
geo_ext = geo_buf.exterior
|
||||||
|
buff_geo_ext = geo_ext.buffer(-margin)
|
||||||
|
geo = unary_union(buff_geo_ext.interiors)
|
||||||
|
|
||||||
# w_gapsize = gapsize - abs(cut_dia)
|
# w_gapsize = gapsize - abs(cut_dia)
|
||||||
solid_geo = self.rect_cutout_handler(geo, cut_dia, gaps, gapsize, margin, xmin, ymin, xmax, ymax)
|
solid_geo = self.rect_cutout_handler(geo, cut_dia, gaps, gapsize, margin, xmin, ymin, xmax, ymax)
|
||||||
@@ -1121,8 +1144,15 @@ class CutOut(AppTool):
|
|||||||
for geom_struct in object_geo:
|
for geom_struct in object_geo:
|
||||||
geom_struct = unary_union(geom_struct)
|
geom_struct = unary_union(geom_struct)
|
||||||
xmin, ymin, xmax, ymax = geom_struct.bounds
|
xmin, ymin, xmax, ymax = geom_struct.bounds
|
||||||
# for geometry we don't buffer this with `margin` parameter
|
|
||||||
geom_struct = box(xmin, ymin, xmax, ymax)
|
geom_struct = box(xmin, ymin, xmax, ymax)
|
||||||
|
if margin >= 0:
|
||||||
|
geo_buf = geom_struct.buffer(margin)
|
||||||
|
geom_struct = geo_buf.exterior
|
||||||
|
else:
|
||||||
|
geo_buf = geom_struct.buffer(0.0000001)
|
||||||
|
geo_ext = geo_buf.exterior
|
||||||
|
buff_geo_ext = geo_ext.buffer(-margin)
|
||||||
|
geom_struct = unary_union(buff_geo_ext.interiors)
|
||||||
|
|
||||||
c_geo = self.rect_cutout_handler(geom_struct, cut_dia, gaps, gapsize, margin,
|
c_geo = self.rect_cutout_handler(geom_struct, cut_dia, gaps, gapsize, margin,
|
||||||
xmin, ymin, xmax, ymax)
|
xmin, ymin, xmax, ymax)
|
||||||
@@ -1184,7 +1214,7 @@ class CutOut(AppTool):
|
|||||||
else:
|
else:
|
||||||
mb_geo = mb_geo.buffer(margin - mb_buff_val)
|
mb_geo = mb_geo.buffer(margin - mb_buff_val)
|
||||||
else:
|
else:
|
||||||
mb_geo = mb_geo.buffer(0)
|
mb_geo = mb_geo.buffer(0.0000001)
|
||||||
|
|
||||||
mb_solid_geo = self.rect_cutout_handler(mb_geo, cut_dia, gaps, gapsize, margin,
|
mb_solid_geo = self.rect_cutout_handler(mb_geo, cut_dia, gaps, gapsize, margin,
|
||||||
xmin, ymin, xmax, ymax)
|
xmin, ymin, xmax, ymax)
|
||||||
|
|||||||
Reference in New Issue
Block a user