- in Paint Plugin fixed the method 'laser-lines' for the case when the painted Gerber file has square shape apertures

This commit is contained in:
Marius Stanciu
2022-01-05 04:41:47 +02:00
committed by Marius
parent f3d379e4af
commit fff657389e
2 changed files with 51 additions and 36 deletions

View File

@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
================================================= =================================================
5.01.2022
- in Paint Plugin fixed the method 'laser-lines' for the case when the painted Gerber file has square shape apertures
24.12.2021 24.12.2021
- in Milling Plugin made sure that the UI is updated correctly when changing the type of target object depending on the Basic/Advanced mode - in Milling Plugin made sure that the UI is updated correctly when changing the type of target object depending on the Basic/Advanced mode

View File

@@ -1657,7 +1657,6 @@ class ToolPaint(AppTool, Gerber):
except Exception as ee: except Exception as ee:
log.error("ToolPaint.paint_polygon_worker() Lines --> %s" % str(ee)) log.error("ToolPaint.paint_polygon_worker() Lines --> %s" % str(ee))
elif paint_method == 3: # _("Laser_lines") elif paint_method == 3: # _("Laser_lines")
try:
# line = None # line = None
# aperture_size = None # aperture_size = None
@@ -1666,10 +1665,11 @@ class ToolPaint(AppTool, Gerber):
# the key is the aperture size, the val is a list of geo elements # the key is the aperture size, the val is a list of geo elements
traces_el_dict = {} traces_el_dict = {}
try:
# find the flashes and the lines that are in the selected polygon and store them separately # find the flashes and the lines that are in the selected polygon and store them separately
for apid, apval in obj.tools.items(): for apid, apval in obj.tools.items():
for geo_el in apval['geometry']: for geo_el in apval['geometry']:
if apval["size"] == 0.0: if "size" in apval and apval["size"] == 0.0:
if apval["size"] in traces_el_dict: if apval["size"] in traces_el_dict:
traces_el_dict[apval["size"]].append(geo_el) traces_el_dict[apval["size"]].append(geo_el)
else: else:
@@ -1699,6 +1699,10 @@ class ToolPaint(AppTool, Gerber):
traces_el_dict[aperture_size].append(geo_el) traces_el_dict[aperture_size].append(geo_el)
else: else:
traces_el_dict[aperture_size] = [geo_el] traces_el_dict[aperture_size] = [geo_el]
except grace:
return "fail"
except Exception as ee:
log.error("ToolPaint.paint_polygon_worker() Laser Lines -> Identify flashes/traces--> %s" % str(ee))
cpoly = FlatCAMRTreeStorage() cpoly = FlatCAMRTreeStorage()
pads_lines_list = [] pads_lines_list = []
@@ -1706,6 +1710,7 @@ class ToolPaint(AppTool, Gerber):
# process the flashes found in the selected polygon with the 'lines' method for rectangular # process the flashes found in the selected polygon with the 'lines' method for rectangular
# flashes and with _("Seed") for oblong and circular flashes # flashes and with _("Seed") for oblong and circular flashes
# and pads (flashes) need the contour therefore I override the GUI settings with always True # and pads (flashes) need the contour therefore I override the GUI settings with always True
try:
for ap_type in flash_el_dict: for ap_type in flash_el_dict:
for elem in flash_el_dict[ap_type]: for elem in flash_el_dict[ap_type]:
if 'solid' in elem: if 'solid' in elem:
@@ -1742,6 +1747,10 @@ class ToolPaint(AppTool, Gerber):
prog_plot=prog_plot) prog_plot=prog_plot)
pads_lines_list += [p for p in f_o.get_objects() if p] pads_lines_list += [p for p in f_o.get_objects() if p]
except grace:
return "fail"
except Exception as ee:
log.error("ToolPaint.paint_polygon_worker() Laser Lines -> Process flashes--> %s" % str(ee))
# add the lines from pads to the storage # add the lines from pads to the storage
try: try:
@@ -1755,6 +1764,7 @@ class ToolPaint(AppTool, Gerber):
# process the traces found in the selected polygon using the 'laser_lines' method, # process the traces found in the selected polygon using the 'laser_lines' method,
# method which will follow the 'follow' line therefore use the longer path possible for the # method which will follow the 'follow' line therefore use the longer path possible for the
# laser, therefore the acceleration will play a smaller factor # laser, therefore the acceleration will play a smaller factor
try:
for aperture_size in traces_el_dict: for aperture_size in traces_el_dict:
for elem in traces_el_dict[aperture_size]: for elem in traces_el_dict[aperture_size]:
line = elem['follow'] line = elem['follow']
@@ -1769,6 +1779,10 @@ class ToolPaint(AppTool, Gerber):
prog_plot=prog_plot) prog_plot=prog_plot)
copper_lines_list += [p for p in t_o.get_objects() if p] copper_lines_list += [p for p in t_o.get_objects() if p]
except grace:
return "fail"
except Exception as ee:
log.error("ToolPaint.paint_polygon_worker() Laser Lines -> Process traces--> %s" % str(ee))
# add the lines from copper features to storage but first try to make as few lines as possible # add the lines from copper features to storage but first try to make as few lines as possible
# by trying to fuse them # by trying to fuse them
@@ -1779,10 +1793,7 @@ class ToolPaint(AppTool, Gerber):
cpoly.insert(lin) cpoly.insert(lin)
except TypeError: except TypeError:
cpoly.insert(lines_union) cpoly.insert(lines_union)
except grace:
return "fail"
except Exception as ee:
log.error("ToolPaint.paint_polygon_worker() Laser Lines --> %s" % str(ee))
elif paint_method == 4: # _("Combo") elif paint_method == 4: # _("Combo")
try: try:
self.app.inform.emit(_("Painting polygon with method: lines.")) self.app.inform.emit(_("Painting polygon with method: lines."))