- fixed Paint Tcl command; fixes issue #437

This commit is contained in:
Marius Stanciu
2020-11-10 21:08:00 +02:00
committed by Marius Stanciu
parent ef162bc33a
commit 48c12c2a5c
4 changed files with 28 additions and 20 deletions

View File

@@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
- updated the Extract Tool - Extract Soldermask functionality, such that the selection of apertures will control the final SolderMask Gerber content - updated the Extract Tool - Extract Soldermask functionality, such that the selection of apertures will control the final SolderMask Gerber content
- updated the Extract Tool - new functionality added: Extract Cutout Gerber from a given Gerber object; added parameters in Preferences - updated the Extract Tool - new functionality added: Extract Cutout Gerber from a given Gerber object; added parameters in Preferences
- updated the UI for Cutout Tool - updated the UI for Cutout Tool
- fixed Paint Tcl command; fixes issue #437
9.11.2020 9.11.2020

View File

@@ -1700,7 +1700,7 @@ class ToolPaint(AppTool, Gerber):
return None return None
def paint_geo(self, obj, geometry, tooldia=None, order=None, method=None, outname=None, def paint_geo(self, obj, geometry, tooldia=None, order=None, method=None, outname=None,
tools_storage=None, plot=True, run_threaded=True): tools_storage=None, plot=True, rest=None, run_threaded=True):
""" """
Paints a given geometry. Paints a given geometry.
@@ -1725,6 +1725,7 @@ class ToolPaint(AppTool, Gerber):
name = outname if outname is not None else self.obj_name + "_paint" name = outname if outname is not None else self.obj_name + "_paint"
order = order if order is not None else self.ui.order_radio.get_value() order = order if order is not None else self.ui.order_radio.get_value()
tools_storage = self.paint_tools if tools_storage is None else tools_storage tools_storage = self.paint_tools if tools_storage is None else tools_storage
use_rest_strategy = rest if rest is not None else self.ui.rest_cb.get_value()
sorted_tools = [] sorted_tools = []
if tooldia is not None: if tooldia is not None:
@@ -2167,7 +2168,7 @@ class ToolPaint(AppTool, Gerber):
def job_thread(app_obj): def job_thread(app_obj):
try: try:
if self.ui.rest_cb.get_value(): if use_rest_strategy:
ret = app_obj.app_obj.new_object("geometry", name, job_rest_clear, plot=plot) ret = app_obj.app_obj.new_object("geometry", name, job_rest_clear, plot=plot)
else: else:
ret = app_obj.app_obj.new_object("geometry", name, job_normal_clear, plot=plot) ret = app_obj.app_obj.new_object("geometry", name, job_normal_clear, plot=plot)

View File

@@ -126,8 +126,11 @@ class TclCommandCopperClear(TclCommand):
method_data = 0 method_data = 0
elif method == "seed": elif method == "seed":
method_data = 1 method_data = 1
else: elif method == "lines":
method_data = 2 method_data = 2
else:
return "Method not supported or typo.\n" \
"Supported methods are: 'standard', 'seed' and 'lines'."
else: else:
method = str(self.app.defaults["tools_ncc_method"]) method = str(self.app.defaults["tools_ncc_method"])
method_data = method method_data = method
@@ -250,7 +253,7 @@ class TclCommandCopperClear(TclCommand):
ncc_tools[int(tooluid)]['data']['tooldia'] = self.app.dec_format(tool, obj.decimals) ncc_tools[int(tooluid)]['data']['tooldia'] = self.app.dec_format(tool, obj.decimals)
# Non-Copper clear all polygons in the non-copper clear object # Non-Copper clear all polygons in the non-copper clear object
if 'all' in args: if select == 0: # 'all' in args
self.app.ncclear_tool.clear_copper_tcl(ncc_obj=obj, self.app.ncclear_tool.clear_copper_tcl(ncc_obj=obj,
select_method=0, # ITSELF select_method=0, # ITSELF
ncctooldia=tooldia, ncctooldia=tooldia,
@@ -270,7 +273,7 @@ class TclCommandCopperClear(TclCommand):
return return
# Non-Copper clear all polygons found within the box object from the the non_copper cleared object # Non-Copper clear all polygons found within the box object from the the non_copper cleared object
if 'box' in args: # Reference Object if select == 2: # Reference Object 'box' in args
box_name = args['box'] box_name = args['box']
# Get box source object. # Get box source object.

View File

@@ -105,9 +105,9 @@ class TclCommandPaint(TclCommand):
tooldia = str(self.app.defaults["tools_paint_tooldia"]) tooldia = str(self.app.defaults["tools_paint_tooldia"])
if 'overlap' in args: if 'overlap' in args:
overlap = float(args['overlap']) / 100.0 overlap = float(args['overlap'])
else: else:
overlap = float(self.app.defaults["tools_paint_overlap"]) / 100.0 overlap = float(self.app.defaults["tools_paint_overlap"])
if 'order' in args: if 'order' in args:
order = args['order'] order = args['order']
@@ -122,15 +122,18 @@ class TclCommandPaint(TclCommand):
if 'method' in args: if 'method' in args:
method = args['method'] method = args['method']
if method == "standard": if method == "standard":
method = _("Standard") method = 0
elif method == "seed": elif method == "seed":
method = _("Seed") method = 1
elif method == "lines": elif method == "lines":
method = _("Lines") method = 2
elif method == "laser_lines": elif method == "laser_lines":
method = _("Laser_lines") method = 3
elif method == "combo":
method = 4
else: else:
method = _("Combo") return "Method not supported or typo.\n" \
"Supported methods are: 'standard', 'seed', 'lines', 'laser_lines' and 'combo'."
else: else:
method = str(self.app.defaults["tools_paint_method"]) method = str(self.app.defaults["tools_paint_method"])
@@ -158,12 +161,12 @@ class TclCommandPaint(TclCommand):
outname = name + "_paint" outname = name + "_paint"
# used only to have correct information's in the obj.tools[tool]['data'] dict # used only to have correct information's in the obj.tools[tool]['data'] dict
if "all" in args: if "single" in args:
select = _("All") select = 1 # _("Polygon Selection")
elif "single" in args: elif 'box' in args:
select = _("Polygon Selection") select = 3 # _("Reference Object")
else: else:
select = _("Reference Object") select = 0 # _("All")
try: try:
tools = [float(eval(dia)) for dia in tooldia.split(",") if dia != ''] tools = [float(eval(dia)) for dia in tooldia.split(",") if dia != '']
@@ -232,7 +235,7 @@ class TclCommandPaint(TclCommand):
return "Object not found: %s" % name return "Object not found: %s" % name
# Paint all polygons in the painted object # Paint all polygons in the painted object
if 'all' in args: if select == 0: # 'all' in args
self.app.paint_tool.paint_poly_all(obj=obj, self.app.paint_tool.paint_poly_all(obj=obj,
tooldia=tooldia, tooldia=tooldia,
order=order, order=order,
@@ -244,7 +247,7 @@ class TclCommandPaint(TclCommand):
return return
# Paint single polygon in the painted object # Paint single polygon in the painted object
if 'single' in args: if select == 1: # 'single' in args
if not args['single'] or args['single'] == '': if not args['single'] or args['single'] == '':
self.raise_tcl_error('%s Got: %s' % self.raise_tcl_error('%s Got: %s' %
(_("Expected a tuple value like -single 3.2,0.1."), str(args['single']))) (_("Expected a tuple value like -single 3.2,0.1."), str(args['single'])))
@@ -271,7 +274,7 @@ class TclCommandPaint(TclCommand):
return return
# Paint all polygons found within the box object from the the painted object # Paint all polygons found within the box object from the the painted object
if 'box' in args: if select == 3: # 'box' in args
box_name = args['box'] box_name = args['box']
if box_name is None: if box_name is None: