- improved the circle approximation resolution
This commit is contained in:
parent
f8c22ea32f
commit
a9b93cafa1
|
@ -1307,7 +1307,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
else:
|
||||
iso_name = outname
|
||||
|
||||
# TODO: This is ugly. Create way to pass data into init function.
|
||||
def iso_init(geo_obj, app_obj):
|
||||
# Propagate options
|
||||
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)
|
||||
|
||||
# if milling type is climb then the move is counter-clockwise around features
|
||||
mill_t = 1 if milling_type == 'cl' else 0
|
||||
geom = self.generate_envelope(iso_offset, mill_t, geometry=work_geo, env_iso_type=iso_t,
|
||||
mill_dir = 1 if milling_type == 'cl' else 0
|
||||
geom = self.generate_envelope(iso_offset, mill_dir, geometry=work_geo, env_iso_type=iso_t,
|
||||
follow=follow, nr_passes=i)
|
||||
|
||||
if geom == 'fail':
|
||||
|
@ -1438,7 +1437,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
else:
|
||||
iso_name = outname
|
||||
|
||||
# TODO: This is ugly. Create way to pass data into init function.
|
||||
def iso_init(geo_obj, app_obj):
|
||||
# Propagate options
|
||||
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
||||
|
@ -1448,9 +1446,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
geo_obj.tool_type = 'C1'
|
||||
|
||||
# if milling type is climb then the move is counter-clockwise around features
|
||||
mill_t = 1 if milling_type == 'cl' else 0
|
||||
mill_t = 1 if milling_type == 'cl' else 0
|
||||
geom = self.generate_envelope(offset, mill_t, geometry=work_geo, env_iso_type=iso_t,
|
||||
mill_dir = 1 if milling_type == 'cl' else 0
|
||||
geom = self.generate_envelope(offset, mill_dir, geometry=work_geo, env_iso_type=iso_t,
|
||||
follow=follow,
|
||||
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
|
||||
|
||||
- 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
|
||||
- updates in NCC Tool
|
||||
|
||||
6.01.2019
|
||||
6.01.2020
|
||||
|
||||
- working on new NCC Tool
|
||||
|
||||
|
|
31
camlib.py
31
camlib.py
|
@ -458,8 +458,8 @@ class Geometry(object):
|
|||
"""
|
||||
|
||||
defaults = {
|
||||
"units": 'in',
|
||||
"geo_steps_per_circle": 64
|
||||
"units": 'mm',
|
||||
# "geo_steps_per_circle": 128
|
||||
}
|
||||
|
||||
def __init__(self, geo_steps_per_circle=None):
|
||||
|
@ -529,12 +529,12 @@ class Geometry(object):
|
|||
|
||||
if type(self.solid_geometry) is list:
|
||||
self.solid_geometry.append(Point(origin).buffer(
|
||||
radius, int(int(self.geo_steps_per_circle) / 4)))
|
||||
radius, int(self.geo_steps_per_circle)))
|
||||
return
|
||||
|
||||
try:
|
||||
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:
|
||||
log.error("Failed to run union on polygons. %s" % str(e))
|
||||
return
|
||||
|
@ -944,7 +944,7 @@ class Geometry(object):
|
|||
geo_iso.append(pol)
|
||||
else:
|
||||
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
|
||||
disp_number = int(np.interp(pol_nr, [0, geo_len], [0, 100]))
|
||||
|
||||
|
@ -959,8 +959,7 @@ class Geometry(object):
|
|||
geo_iso.append(working_geo)
|
||||
else:
|
||||
corner_type = 1 if corner is None else corner
|
||||
geo_iso.append(working_geo.buffer(offset, int(int(self.geo_steps_per_circle) / 4),
|
||||
join_style=corner_type))
|
||||
geo_iso.append(working_geo.buffer(offset, int(self.geo_steps_per_circle), join_style=corner_type))
|
||||
|
||||
self.app.proc_container.update_view_text(' %s' % _("Buffering"))
|
||||
geo_iso = unary_union(geo_iso)
|
||||
|
@ -1225,7 +1224,7 @@ class Geometry(object):
|
|||
|
||||
# Can only result in a Polygon or MultiPolygon
|
||||
# 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:
|
||||
# Otherwise, trying to to insert current.exterior == None
|
||||
# into the FlatCAMStorage will fail.
|
||||
|
@ -1254,7 +1253,7 @@ class Geometry(object):
|
|||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
# 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:
|
||||
|
||||
# current can be a MultiPolygon
|
||||
|
@ -1372,11 +1371,12 @@ class Geometry(object):
|
|||
|
||||
# Clean inside edges (contours) of the original polygon
|
||||
if contour:
|
||||
outer_edges = [x.exterior for x in autolist(
|
||||
polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle / 4)))]
|
||||
outer_edges = [
|
||||
x.exterior for x in autolist(polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle)))
|
||||
]
|
||||
inner_edges = []
|
||||
# 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
|
||||
inner_edges.append(y)
|
||||
# geoms += outer_edges + inner_edges
|
||||
|
@ -1626,7 +1626,7 @@ class Geometry(object):
|
|||
# Straight line from current_pt to pt.
|
||||
# Is the toolpath inside the geometry?
|
||||
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:
|
||||
# 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)
|
||||
start = np.arctan2(-gobj['J'], -gobj['I'])
|
||||
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['Y'] = y
|
||||
|
@ -4362,8 +4362,7 @@ class CNCjob(Geometry):
|
|||
visible=visible, layer=1)
|
||||
else:
|
||||
# For Incremental coordinates type G91
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
||||
_('G91 coordinates not implemented ...'))
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _('G91 coordinates not implemented ...'))
|
||||
for geo in gcode_parsed:
|
||||
if geo['kind'][0] == 'T':
|
||||
current_position = geo['geom'].coords[0]
|
||||
|
|
Loading…
Reference in New Issue