- fixed text annotation for CNC job so there are no overlapping numbers when 2 lines meet on the same point

- fixed issue in CNC job plotting where some of the isolation polygons are painted incorrectly
- fixed issue in CNCJob where the set circle steps is not used
This commit is contained in:
Marius Stanciu 2019-06-01 03:17:28 +03:00
parent 9abb9c5df2
commit dca57edf24
3 changed files with 25 additions and 20 deletions

View File

@ -795,7 +795,7 @@ class App(QtCore.QObject):
"cncjob_tooldia": 0.0393701, "cncjob_tooldia": 0.0393701,
"cncjob_coords_decimals": 4, "cncjob_coords_decimals": 4,
"cncjob_fr_decimals": 2, "cncjob_fr_decimals": 2,
"cncjob_steps_per_circle": 64, "cncjob_steps_per_circle": 128,
# CNC Job Options # CNC Job Options
"cncjob_prepend": "", "cncjob_prepend": "",

View File

@ -9,6 +9,12 @@ CAD program, and create G-Code for Isolation routing.
================================================= =================================================
1.06.2019
- fixed text annotation for CNC job so there are no overlapping numbers when 2 lines meet on the same point
- fixed issue in CNC job plotting where some of the isolation polygons are painted incorrectly
- fixed issue in CNCJob where the set circle steps is not used
31.05.2019 31.05.2019
- added the possibility to display text annotation for the CNC travel lines. The setting is both in Preferences and in the CNC object properties - added the possibility to display text annotation for the CNC travel lines. The setting is both in Preferences and in the CNC object properties

View File

@ -4909,7 +4909,6 @@ class CNCjob(Geometry):
"pp_geometry_name":'default', "pp_geometry_name":'default',
"pp_excellon_name":'default', "pp_excellon_name":'default',
"excellon_optimization_type": "B", "excellon_optimization_type": "B",
"steps_per_circle": 64
} }
def __init__(self, def __init__(self,
@ -4926,11 +4925,9 @@ class CNCjob(Geometry):
steps_per_circle=None): steps_per_circle=None):
# Used when parsing G-code arcs # Used when parsing G-code arcs
if steps_per_circle is None: self.steps_per_circle = int(self.app.defaults['cncjob_steps_per_circle'])
steps_per_circle = int(CNCjob.defaults["steps_per_circle"])
self.steps_per_circle = int(steps_per_circle)
Geometry.__init__(self, geo_steps_per_circle=int(steps_per_circle)) Geometry.__init__(self, geo_steps_per_circle=self.steps_per_circle)
self.kind = kind self.kind = kind
self.origin_kind = None self.origin_kind = None
@ -6420,9 +6417,7 @@ class CNCjob(Geometry):
radius = sqrt(gobj['I']**2 + gobj['J']**2) radius = sqrt(gobj['I']**2 + gobj['J']**2)
start = arctan2(-gobj['J'], -gobj['I']) start = arctan2(-gobj['J'], -gobj['I'])
stop = arctan2(-center[1] + y, -center[0] + x) stop = arctan2(-center[1] + y, -center[0] + x)
path += arc(center, radius, start, stop, path += arc(center, radius, start, stop, arcdir[current['G']], int(self.steps_per_circle / 4))
arcdir[current['G']],
int(self.steps_per_circle / 4))
# Update current instruction # Update current instruction
for code in gobj: for code in gobj:
@ -6509,15 +6504,17 @@ class CNCjob(Geometry):
text = [] text = []
pos = [] pos = []
for geo in gcode_parsed: for geo in gcode_parsed:
path_num += 1 if geo['kind'][0] == 'T':
current_position = geo['geom'].coords[0]
text.append(str(path_num)) if current_position not in pos:
current_position = geo['geom'].coords[0] pos.append(current_position)
if current_position in pos: path_num += 1
corrected_position = (current_position[0], current_position[1] + tooldia) text.append(str(path_num))
pos.append(corrected_position) current_position = geo['geom'].coords[-1]
else: if current_position not in pos:
pos.append(current_position) pos.append(current_position)
path_num += 1
text.append(str(path_num))
# plot the geometry of Excellon objects # plot the geometry of Excellon objects
if self.origin_kind == 'excellon': if self.origin_kind == 'excellon':
@ -6525,10 +6522,12 @@ class CNCjob(Geometry):
poly = Polygon(geo['geom']) poly = Polygon(geo['geom'])
except ValueError: except ValueError:
# if the geos are travel lines it will enter into Exception # if the geos are travel lines it will enter into Exception
poly = geo['geom'].buffer(tooldia / 2.0).simplify(tool_tolerance) poly = geo['geom'].buffer(distance=(tooldia / 1.99999999), resolution=self.steps_per_circle)
poly = poly.simplify(tool_tolerance)
else: else:
# plot the geometry of any objects other than Excellon # plot the geometry of any objects other than Excellon
poly = geo['geom'].buffer(tooldia / 2.0).simplify(tool_tolerance) poly = geo['geom'].buffer(distance=(tooldia / 1.99999999), resolution=self.steps_per_circle)
poly = poly.simplify(tool_tolerance)
if kind == 'all': if kind == 'all':
obj.add_shape(shape=poly, color=color[geo['kind'][0]][1], face_color=color[geo['kind'][0]][0], obj.add_shape(shape=poly, color=color[geo['kind'][0]][1], face_color=color[geo['kind'][0]][0],