- improved the circle approximation resolution
This commit is contained in:
parent
f8c22ea32f
commit
a9b93cafa1
|
@ -1307,7 +1307,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||||
else:
|
else:
|
||||||
iso_name = outname
|
iso_name = outname
|
||||||
|
|
||||||
# TODO: This is ugly. Create way to pass data into init function.
|
|
||||||
def iso_init(geo_obj, app_obj):
|
def iso_init(geo_obj, app_obj):
|
||||||
# Propagate options
|
# Propagate options
|
||||||
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
||||||
|
@ -1318,8 +1317,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||||
iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
|
iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
|
||||||
|
|
||||||
# if milling type is climb then the move is counter-clockwise around features
|
# if milling type is climb then the move is counter-clockwise around features
|
||||||
mill_t = 1 if milling_type == 'cl' else 0
|
mill_dir = 1 if milling_type == 'cl' else 0
|
||||||
geom = self.generate_envelope(iso_offset, mill_t, geometry=work_geo, env_iso_type=iso_t,
|
geom = self.generate_envelope(iso_offset, mill_dir, geometry=work_geo, env_iso_type=iso_t,
|
||||||
follow=follow, nr_passes=i)
|
follow=follow, nr_passes=i)
|
||||||
|
|
||||||
if geom == 'fail':
|
if geom == 'fail':
|
||||||
|
@ -1438,7 +1437,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||||
else:
|
else:
|
||||||
iso_name = outname
|
iso_name = outname
|
||||||
|
|
||||||
# TODO: This is ugly. Create way to pass data into init function.
|
|
||||||
def iso_init(geo_obj, app_obj):
|
def iso_init(geo_obj, app_obj):
|
||||||
# Propagate options
|
# Propagate options
|
||||||
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
||||||
|
@ -1448,9 +1446,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||||
geo_obj.tool_type = 'C1'
|
geo_obj.tool_type = 'C1'
|
||||||
|
|
||||||
# if milling type is climb then the move is counter-clockwise around features
|
# if milling type is climb then the move is counter-clockwise around features
|
||||||
mill_t = 1 if milling_type == 'cl' else 0
|
mill_dir = 1 if milling_type == 'cl' else 0
|
||||||
mill_t = 1 if milling_type == 'cl' else 0
|
geom = self.generate_envelope(offset, mill_dir, geometry=work_geo, env_iso_type=iso_t,
|
||||||
geom = self.generate_envelope(offset, mill_t, geometry=work_geo, env_iso_type=iso_t,
|
|
||||||
follow=follow,
|
follow=follow,
|
||||||
nr_passes=i)
|
nr_passes=i)
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
12.01.2020
|
||||||
|
|
||||||
|
- improved the circle approximation resolution
|
||||||
|
|
||||||
11.01.2020
|
11.01.2020
|
||||||
|
|
||||||
- fixed an issue in the Distance Tool
|
- fixed an issue in the Distance Tool
|
||||||
|
@ -36,7 +40,7 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
- solved issue #368 - when using the Enable/Disable prj context menu entries the plotted status is not updated in the object properties
|
- solved issue #368 - when using the Enable/Disable prj context menu entries the plotted status is not updated in the object properties
|
||||||
- updates in NCC Tool
|
- updates in NCC Tool
|
||||||
|
|
||||||
6.01.2019
|
6.01.2020
|
||||||
|
|
||||||
- working on new NCC Tool
|
- working on new NCC Tool
|
||||||
|
|
||||||
|
|
31
camlib.py
31
camlib.py
|
@ -458,8 +458,8 @@ class Geometry(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
"units": 'in',
|
"units": 'mm',
|
||||||
"geo_steps_per_circle": 64
|
# "geo_steps_per_circle": 128
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, geo_steps_per_circle=None):
|
def __init__(self, geo_steps_per_circle=None):
|
||||||
|
@ -529,12 +529,12 @@ class Geometry(object):
|
||||||
|
|
||||||
if type(self.solid_geometry) is list:
|
if type(self.solid_geometry) is list:
|
||||||
self.solid_geometry.append(Point(origin).buffer(
|
self.solid_geometry.append(Point(origin).buffer(
|
||||||
radius, int(int(self.geo_steps_per_circle) / 4)))
|
radius, int(self.geo_steps_per_circle)))
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.solid_geometry = self.solid_geometry.union(Point(origin).buffer(
|
self.solid_geometry = self.solid_geometry.union(Point(origin).buffer(
|
||||||
radius, int(int(self.geo_steps_per_circle) / 4)))
|
radius, int(self.geo_steps_per_circle)))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("Failed to run union on polygons. %s" % str(e))
|
log.error("Failed to run union on polygons. %s" % str(e))
|
||||||
return
|
return
|
||||||
|
@ -944,7 +944,7 @@ class Geometry(object):
|
||||||
geo_iso.append(pol)
|
geo_iso.append(pol)
|
||||||
else:
|
else:
|
||||||
corner_type = 1 if corner is None else corner
|
corner_type = 1 if corner is None else corner
|
||||||
geo_iso.append(pol.buffer(offset, int(int(self.geo_steps_per_circle) / 4), join_style=corner_type))
|
geo_iso.append(pol.buffer(offset, int(self.geo_steps_per_circle), join_style=corner_type))
|
||||||
pol_nr += 1
|
pol_nr += 1
|
||||||
disp_number = int(np.interp(pol_nr, [0, geo_len], [0, 100]))
|
disp_number = int(np.interp(pol_nr, [0, geo_len], [0, 100]))
|
||||||
|
|
||||||
|
@ -959,8 +959,7 @@ class Geometry(object):
|
||||||
geo_iso.append(working_geo)
|
geo_iso.append(working_geo)
|
||||||
else:
|
else:
|
||||||
corner_type = 1 if corner is None else corner
|
corner_type = 1 if corner is None else corner
|
||||||
geo_iso.append(working_geo.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
|
geo_iso.append(working_geo.buffer(offset, int(self.geo_steps_per_circle), join_style=corner_type))
|
||||||
join_style=corner_type))
|
|
||||||
|
|
||||||
self.app.proc_container.update_view_text(' %s' % _("Buffering"))
|
self.app.proc_container.update_view_text(' %s' % _("Buffering"))
|
||||||
geo_iso = unary_union(geo_iso)
|
geo_iso = unary_union(geo_iso)
|
||||||
|
@ -1225,7 +1224,7 @@ class Geometry(object):
|
||||||
|
|
||||||
# Can only result in a Polygon or MultiPolygon
|
# Can only result in a Polygon or MultiPolygon
|
||||||
# NOTE: The resulting polygon can be "empty".
|
# NOTE: The resulting polygon can be "empty".
|
||||||
current = polygon.buffer((-tooldia / 1.999999), int(int(steps_per_circle) / 4))
|
current = polygon.buffer((-tooldia / 1.999999), int(steps_per_circle))
|
||||||
if current.area == 0:
|
if current.area == 0:
|
||||||
# Otherwise, trying to to insert current.exterior == None
|
# Otherwise, trying to to insert current.exterior == None
|
||||||
# into the FlatCAMStorage will fail.
|
# into the FlatCAMStorage will fail.
|
||||||
|
@ -1254,7 +1253,7 @@ class Geometry(object):
|
||||||
QtWidgets.QApplication.processEvents()
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
# Can only result in a Polygon or MultiPolygon
|
# Can only result in a Polygon or MultiPolygon
|
||||||
current = current.buffer(-tooldia * (1 - overlap), int(int(steps_per_circle) / 4))
|
current = current.buffer(-tooldia * (1 - overlap), int(steps_per_circle))
|
||||||
if current.area > 0:
|
if current.area > 0:
|
||||||
|
|
||||||
# current can be a MultiPolygon
|
# current can be a MultiPolygon
|
||||||
|
@ -1372,11 +1371,12 @@ class Geometry(object):
|
||||||
|
|
||||||
# Clean inside edges (contours) of the original polygon
|
# Clean inside edges (contours) of the original polygon
|
||||||
if contour:
|
if contour:
|
||||||
outer_edges = [x.exterior for x in autolist(
|
outer_edges = [
|
||||||
polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle / 4)))]
|
x.exterior for x in autolist(polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle)))
|
||||||
|
]
|
||||||
inner_edges = []
|
inner_edges = []
|
||||||
# Over resulting polygons
|
# Over resulting polygons
|
||||||
for x in autolist(polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle / 4))):
|
for x in autolist(polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle))):
|
||||||
for y in x.interiors: # Over interiors of each polygon
|
for y in x.interiors: # Over interiors of each polygon
|
||||||
inner_edges.append(y)
|
inner_edges.append(y)
|
||||||
# geoms += outer_edges + inner_edges
|
# geoms += outer_edges + inner_edges
|
||||||
|
@ -1626,7 +1626,7 @@ class Geometry(object):
|
||||||
# Straight line from current_pt to pt.
|
# Straight line from current_pt to pt.
|
||||||
# Is the toolpath inside the geometry?
|
# Is the toolpath inside the geometry?
|
||||||
walk_path = LineString([current_pt, pt])
|
walk_path = LineString([current_pt, pt])
|
||||||
walk_cut = walk_path.buffer(tooldia / 2, int(steps_per_circle / 4))
|
walk_cut = walk_path.buffer(tooldia / 2, int(steps_per_circle))
|
||||||
|
|
||||||
if walk_cut.within(boundary) and walk_path.length < max_walk:
|
if walk_cut.within(boundary) and walk_path.length < max_walk:
|
||||||
# log.debug("Walk to path #%d is inside. Joining." % path_count)
|
# log.debug("Walk to path #%d is inside. Joining." % path_count)
|
||||||
|
@ -4213,7 +4213,7 @@ class CNCjob(Geometry):
|
||||||
radius = np.sqrt(gobj['I']**2 + gobj['J']**2)
|
radius = np.sqrt(gobj['I']**2 + gobj['J']**2)
|
||||||
start = np.arctan2(-gobj['J'], -gobj['I'])
|
start = np.arctan2(-gobj['J'], -gobj['I'])
|
||||||
stop = np.arctan2(-center[1] + y, -center[0] + x)
|
stop = np.arctan2(-center[1] + y, -center[0] + x)
|
||||||
path += arc(center, radius, start, stop, arcdir[current['G']], int(self.steps_per_circle / 4))
|
path += arc(center, radius, start, stop, arcdir[current['G']], int(self.steps_per_circle))
|
||||||
|
|
||||||
current['X'] = x
|
current['X'] = x
|
||||||
current['Y'] = y
|
current['Y'] = y
|
||||||
|
@ -4362,8 +4362,7 @@ class CNCjob(Geometry):
|
||||||
visible=visible, layer=1)
|
visible=visible, layer=1)
|
||||||
else:
|
else:
|
||||||
# For Incremental coordinates type G91
|
# For Incremental coordinates type G91
|
||||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
self.app.inform.emit('[ERROR_NOTCL] %s' % _('G91 coordinates not implemented ...'))
|
||||||
_('G91 coordinates not implemented ...'))
|
|
||||||
for geo in gcode_parsed:
|
for geo in gcode_parsed:
|
||||||
if geo['kind'][0] == 'T':
|
if geo['kind'][0] == 'T':
|
||||||
current_position = geo['geom'].coords[0]
|
current_position = geo['geom'].coords[0]
|
||||||
|
|
Loading…
Reference in New Issue