- applied changes for offsetting to other methods
This commit is contained in:
@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
27.10.2021
|
27.10.2021
|
||||||
|
|
||||||
- fixed the offseting feature in the Isolation Plugin such that the interiors of the isolated polygons are offset correctly
|
- fixed the offseting feature in the Isolation Plugin such that the interiors of the isolated polygons are offset correctly
|
||||||
|
- applied changes for offsetting to other methods
|
||||||
|
|
||||||
25.10.2021
|
25.10.2021
|
||||||
|
|
||||||
|
|||||||
41
camlib.py
41
camlib.py
@@ -5716,6 +5716,15 @@ class CNCjob(Geometry):
|
|||||||
# it's a Shapely object, return it's bounds
|
# it's a Shapely object, return it's bounds
|
||||||
return obj.bounds
|
return obj.bounds
|
||||||
|
|
||||||
|
# #############################################################################################################
|
||||||
|
# ## Flatten the geometry. Only linear elements (no polygons) remain.
|
||||||
|
# #############################################################################################################
|
||||||
|
|
||||||
|
# flat_geometry = self.flatten(temp_solid_geometry, pathonly=True)
|
||||||
|
flat_ext_geo, flat_ints_geo = self.flatten_exterior_interiors(geo_obj.solid_geometry)
|
||||||
|
flat_geometry = flat_ext_geo + flat_ints_geo
|
||||||
|
log.debug("%d paths" % len(flat_geometry))
|
||||||
|
|
||||||
# Create the solid geometry which will be used to generate GCode
|
# Create the solid geometry which will be used to generate GCode
|
||||||
temp_solid_geometry = []
|
temp_solid_geometry = []
|
||||||
if offset != 0.0:
|
if offset != 0.0:
|
||||||
@@ -5737,19 +5746,31 @@ class CNCjob(Geometry):
|
|||||||
elif -offset == ((c - a) / 2) or -offset == ((d - b) / 2):
|
elif -offset == ((c - a) / 2) or -offset == ((d - b) / 2):
|
||||||
offset_for_use = offset - 0.0000000001
|
offset_for_use = offset - 0.0000000001
|
||||||
|
|
||||||
for it in geo_obj.solid_geometry:
|
# for it in flat_geometry:
|
||||||
|
# # if the geometry is a closed shape then create a Polygon out of it
|
||||||
|
# if isinstance(it, (LineString, LinearRing)):
|
||||||
|
# c = it.coords
|
||||||
|
# if c[0] == c[-1]:
|
||||||
|
# it = Polygon(it)
|
||||||
|
# temp_solid_geometry.append(it.buffer(offset_for_use, join_style=2))
|
||||||
|
|
||||||
|
for it in flat_ext_geo:
|
||||||
# if the geometry is a closed shape then create a Polygon out of it
|
# if the geometry is a closed shape then create a Polygon out of it
|
||||||
if isinstance(it, LineString):
|
if isinstance(it, LineString):
|
||||||
c = it.coords
|
if it.is_ring:
|
||||||
if c[0] == c[-1]:
|
|
||||||
it = Polygon(it)
|
it = Polygon(it)
|
||||||
temp_solid_geometry.append(it.buffer(offset_for_use, join_style=2))
|
temp_solid_geometry.append(it.buffer(offset_for_use, join_style=2))
|
||||||
else:
|
|
||||||
temp_solid_geometry = geo_obj.solid_geometry
|
|
||||||
|
|
||||||
# ## Flatten the geometry. Only linear elements (no polygons) remain.
|
for it in flat_ints_geo:
|
||||||
flat_geometry = self.flatten(temp_solid_geometry, pathonly=True)
|
# if the geometry is a closed shape then create a Polygon out of it
|
||||||
log.debug("%d paths" % len(flat_geometry))
|
if isinstance(it, (LineString, LinearRing)):
|
||||||
|
if it.is_ring:
|
||||||
|
it = Polygon(it)
|
||||||
|
temp_solid_geometry.append(it.buffer(-offset_for_use, join_style=2))
|
||||||
|
|
||||||
|
temp_solid_geometry = self.flatten(temp_solid_geometry, reset=True, pathonly=True)
|
||||||
|
else:
|
||||||
|
temp_solid_geometry = flat_geometry
|
||||||
|
|
||||||
default_dia = None
|
default_dia = None
|
||||||
if isinstance(self.app.defaults["tools_mill_tooldia"], float):
|
if isinstance(self.app.defaults["tools_mill_tooldia"], float):
|
||||||
@@ -5889,7 +5910,7 @@ class CNCjob(Geometry):
|
|||||||
log.debug("Indexing geometry before generating G-Code...")
|
log.debug("Indexing geometry before generating G-Code...")
|
||||||
self.app.inform.emit(_("Indexing geometry before generating G-Code..."))
|
self.app.inform.emit(_("Indexing geometry before generating G-Code..."))
|
||||||
|
|
||||||
for geo_shape in flat_geometry:
|
for geo_shape in temp_solid_geometry:
|
||||||
if self.app.abort_flag:
|
if self.app.abort_flag:
|
||||||
# graceful abort requested by the user
|
# graceful abort requested by the user
|
||||||
raise grace
|
raise grace
|
||||||
@@ -5960,7 +5981,7 @@ class CNCjob(Geometry):
|
|||||||
self.app.inform.emit('%s...' % _("Starting G-Code"))
|
self.app.inform.emit('%s...' % _("Starting G-Code"))
|
||||||
|
|
||||||
# variables to display the percentage of work done
|
# variables to display the percentage of work done
|
||||||
geo_len = len(flat_geometry)
|
geo_len = len(temp_solid_geometry)
|
||||||
|
|
||||||
old_disp_number = 0
|
old_disp_number = 0
|
||||||
log.warning("Number of paths for which to generate GCode: %s" % str(geo_len))
|
log.warning("Number of paths for which to generate GCode: %s" % str(geo_len))
|
||||||
|
|||||||
Reference in New Issue
Block a user