- in FlatCAMObj.export_gerber() method took into account the possibility of polygons of type 'clear' (the ones found in the Gerber files under the LPC command)

This commit is contained in:
Marius Stanciu
2020-02-19 22:09:32 +02:00
committed by Marius
parent 72ce53182d
commit dab46ef3ae
2 changed files with 58 additions and 0 deletions

View File

@@ -2233,6 +2233,63 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
x_formatted, y_formatted = lz_format(geo.x, geo.y, factor) x_formatted, y_formatted = lz_format(geo.x, geo.y, factor)
gerber_code += "X{xform}Y{yform}D03*\n".format(xform=x_formatted, gerber_code += "X{xform}Y{yform}D03*\n".format(xform=x_formatted,
yform=y_formatted) yform=y_formatted)
elif isinstance(geo, Polygon):
geo_coords = list(geo.exterior.coords)
# first command is a move with pen-up D02 at the beginning of the geo
if g_zeros == 'T':
x_formatted, y_formatted = tz_format(
geo_coords[0][0], geo_coords[0][1], factor)
gerber_code += "X{xform}Y{yform}D02*\n".format(xform=x_formatted,
yform=y_formatted)
else:
x_formatted, y_formatted = lz_format(
geo_coords[0][0], geo_coords[0][1], factor)
gerber_code += "X{xform}Y{yform}D02*\n".format(xform=x_formatted,
yform=y_formatted)
prev_coord = geo_coords[0]
for coord in geo_coords[1:]:
if coord != prev_coord:
if g_zeros == 'T':
x_formatted, y_formatted = tz_format(coord[0], coord[1], factor)
gerber_code += "X{xform}Y{yform}D01*\n".format(xform=x_formatted,
yform=y_formatted)
else:
x_formatted, y_formatted = lz_format(coord[0], coord[1], factor)
gerber_code += "X{xform}Y{yform}D01*\n".format(xform=x_formatted,
yform=y_formatted)
prev_coord = coord
for geo_int in geo.interiors:
geo_coords = list(geo_int.coords)
# first command is a move with pen-up D02 at the beginning of the geo
if g_zeros == 'T':
x_formatted, y_formatted = tz_format(
geo_coords[0][0], geo_coords[0][1], factor)
gerber_code += "X{xform}Y{yform}D02*\n".format(xform=x_formatted,
yform=y_formatted)
else:
x_formatted, y_formatted = lz_format(
geo_coords[0][0], geo_coords[0][1], factor)
gerber_code += "X{xform}Y{yform}D02*\n".format(xform=x_formatted,
yform=y_formatted)
prev_coord = geo_coords[0]
for coord in geo_coords[1:]:
if coord != prev_coord:
if g_zeros == 'T':
x_formatted, y_formatted = tz_format(coord[0], coord[1], factor)
gerber_code += "X{xform}Y{yform}D01*\n".format(
xform=x_formatted,
yform=y_formatted)
else:
x_formatted, y_formatted = lz_format(coord[0], coord[1], factor)
gerber_code += "X{xform}Y{yform}D01*\n".format(
xform=x_formatted,
yform=y_formatted)
prev_coord = coord
else: else:
geo_coords = list(geo.coords) geo_coords = list(geo.coords)
# first command is a move with pen-up D02 at the beginning of the geo # first command is a move with pen-up D02 at the beginning of the geo

View File

@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed some issues in the Geometry Editor; the jump sigmal disconnect was failing for repeated Editor tool operation - fixed some issues in the Geometry Editor; the jump sigmal disconnect was failing for repeated Editor tool operation
- fixed an issue in Gerber Editor where the multiprocessing pool was reported as closed and an ValueError exception was raised in a certain scneraio - fixed an issue in Gerber Editor where the multiprocessing pool was reported as closed and an ValueError exception was raised in a certain scneraio
- on Set Origin, Move to Origin and Move actions for Gerber and Excellon objects the source file will be also updated (the export functions will export an updated object) - on Set Origin, Move to Origin and Move actions for Gerber and Excellon objects the source file will be also updated (the export functions will export an updated object)
- in FlatCAMObj.export_gerber() method took into account the possibility of polygons of type 'clear' (the ones found in the Gerber files under the LPC command)
17.02.2020 17.02.2020