- fixed Tcl commands that use the overlap parameter to switch from fraction to percentage

- in Transform Tool mae sure that the buffer sub-tool parameters are better explained in tooltips
This commit is contained in:
Marius Stanciu 2019-12-30 22:04:39 +02:00 committed by Marius
parent f7eaf62606
commit 841e1f3eeb
12 changed files with 38 additions and 35 deletions

View File

@ -1269,23 +1269,22 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
""" """
if geometry is None: if geometry is None:
if follow: work_geo = self.follow_geometry if follow is True else self.solid_geometry
work_geo = self.follow_geometry
else:
work_geo = self.solid_geometry
else: else:
work_geo = geometry work_geo = geometry
if dia is None: if dia is None:
dia = float(self.options["isotooldia"]) dia = float(self.options["isotooldia"])
if passes is None: if passes is None:
passes = int(self.options["isopasses"]) passes = int(self.options["isopasses"])
if overlap is None: if overlap is None:
overlap = float(self.options["isooverlap"]) overlap = float(self.options["isooverlap"])
if combine is None:
combine = self.options["combine_passes"] overlap /= 100.0
else:
combine = bool(combine) combine = self.options["combine_passes"] if combine is None else bool(combine)
if milling_type is None: if milling_type is None:
milling_type = self.options["milling_type"] milling_type = self.options["milling_type"]
@ -1316,7 +1315,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
geo_obj.solid_geometry = [] geo_obj.solid_geometry = []
for i in range(passes): for i in range(passes):
iso_offset = dia * ((2 * i + 1) / 2.0) - (i * (overlap / 100) * dia) iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
# if milling type is climb then the move is counter-clockwise around features # 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
@ -1417,7 +1416,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
else: else:
for i in range(passes): for i in range(passes):
offset = dia * ((2 * i + 1) / 2.0) - (i * (overlap / 100) * dia) offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
if passes > 1: if passes > 1:
if outname is None: if outname is None:
if self.iso_type == 0: if self.iso_type == 0:

View File

@ -16,6 +16,8 @@ CAD program, and create G-Code for Isolation routing.
- fixed some decimals issues in NCC Tool, Paint Tool and Excellon Editor (they were still using the harcoded values) - fixed some decimals issues in NCC Tool, Paint Tool and Excellon Editor (they were still using the harcoded values)
- some small updates in the NCC Tool - some small updates in the NCC Tool
- changes in the Preferences UI for NCC and Paint Tool in Tool Dia entry field - changes in the Preferences UI for NCC and Paint Tool in Tool Dia entry field
- fixed Tcl commands that use the overlap parameter to switch from fraction to percentage
- in Transform Tool mae sure that the buffer sub-tool parameters are better explained in tooltips
29.12.2019 29.12.2019

View File

@ -1326,7 +1326,7 @@ class Geometry(object):
geoms.get_points = get_pts geoms.get_points = get_pts
# Path margin # Path margin
path_margin = polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle / 4)) path_margin = polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle))
if path_margin.is_empty or path_margin is None: if path_margin.is_empty or path_margin is None:
return return
@ -1345,7 +1345,7 @@ class Geometry(object):
# provide the app with a way to process the GUI events when in a blocking loop # provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents() QtWidgets.QApplication.processEvents()
path = Point(seedpoint).buffer(radius, int(steps_per_circle / 4)).exterior path = Point(seedpoint).buffer(radius, int(steps_per_circle)).exterior
path = path.intersection(path_margin) path = path.intersection(path_margin)
# Touches polygon? # Touches polygon?

View File

@ -453,7 +453,7 @@ class PaintOptionsTool(FlatCAMTool):
# Overlap # Overlap
ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
ovlabel.setToolTip( ovlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.\n" _("How much (percentage) of the tool width to overlap each tool pass.\n"
"Adjust the value starting with lower values\n" "Adjust the value starting with lower values\n"
"and increasing it if areas that should be painted are still \n" "and increasing it if areas that should be painted are still \n"
"not painted.\n" "not painted.\n"

View File

@ -388,7 +388,7 @@ class GerberObjectUI(ObjectUI):
# Pass overlap # Pass overlap
overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap')) overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
overlabel.setToolTip( overlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.") _("How much (percentage) of the tool width to overlap each tool pass.")
) )
overlabel.setMinimumWidth(90) overlabel.setMinimumWidth(90)
self.iso_overlap_entry = FCDoubleSpinner(suffix='%') self.iso_overlap_entry = FCDoubleSpinner(suffix='%')

View File

@ -2048,7 +2048,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
# Pass overlap # Pass overlap
overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap')) overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
overlabel.setToolTip( overlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.") _("How much (percentage) of the tool width to overlap each tool pass.")
) )
self.iso_overlap_entry = FCDoubleSpinner(suffix='%') self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
self.iso_overlap_entry.set_precision(self.decimals) self.iso_overlap_entry.set_precision(self.decimals)
@ -5157,7 +5157,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
# Overlap Entry # Overlap Entry
nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
nccoverlabel.setToolTip( nccoverlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.\n" _("How much (percentage) of the tool width to overlap each tool pass.\n"
"Adjust the value starting with lower values\n" "Adjust the value starting with lower values\n"
"and increasing it if areas that should be cleared are still \n" "and increasing it if areas that should be cleared are still \n"
"not cleared.\n" "not cleared.\n"
@ -5574,7 +5574,7 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
# Overlap # Overlap
ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
ovlabel.setToolTip( ovlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.\n" _("How much (percentage) of the tool width to overlap each tool pass.\n"
"Adjust the value starting with lower values\n" "Adjust the value starting with lower values\n"
"and increasing it if areas that should be painted are still \n" "and increasing it if areas that should be painted are still \n"
"not painted.\n" "not painted.\n"
@ -6418,12 +6418,13 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.buffer_label, 17, 0) grid0.addWidget(self.buffer_label, 17, 0)
grid0.addWidget(self.buffer_entry, 17, 1) grid0.addWidget(self.buffer_entry, 17, 1)
self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Factor")) self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
self.buffer_factor_label.setToolTip( self.buffer_factor_label.setToolTip(
_("A positive value will create the effect of dilation,\n" _("A positive value will create the effect of dilation,\n"
"while a negative value will create the effect of erosion.\n" "while a negative value will create the effect of erosion.\n"
"Each geometry element of the object will be increased\n" "Each geometry element of the object will be increased\n"
"or decreased by the 'factor'.") "or decreased to fit the 'Value'. Value is a percentage\n"
"of the initial dimension.")
) )
self.buffer_factor_entry = FCDoubleSpinner(suffix='%') self.buffer_factor_entry = FCDoubleSpinner(suffix='%')

View File

@ -318,7 +318,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
# Overlap Entry # Overlap Entry
nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
nccoverlabel.setToolTip( nccoverlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.\n" _("How much (percentage) of the tool width to overlap each tool pass.\n"
"Adjust the value starting with lower values\n" "Adjust the value starting with lower values\n"
"and increasing it if areas that should be cleared are still \n" "and increasing it if areas that should be cleared are still \n"
"not cleared.\n" "not cleared.\n"
@ -1430,7 +1430,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
else: else:
ncc_select = self.reference_radio.get_value() ncc_select = self.reference_radio.get_value()
overlap = overlap if overlap is not None else float(self.app.defaults["tools_nccoverlap"]) overlap = overlap if overlap is not None else float(self.app.defaults["tools_nccoverlap"]) / 100.0
connect = connect if connect else self.app.defaults["tools_nccconnect"] connect = connect if connect else self.app.defaults["tools_nccconnect"]
contour = contour if contour else self.app.defaults["tools_ncccontour"] contour = contour if contour else self.app.defaults["tools_ncccontour"]

View File

@ -218,7 +218,7 @@ class ToolPaint(FlatCAMTool, Gerber):
# Overlap # Overlap
ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
ovlabel.setToolTip( ovlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.\n" _("How much (percentage) of the tool width to overlap each tool pass.\n"
"Adjust the value starting with lower values\n" "Adjust the value starting with lower values\n"
"and increasing it if areas that should be painted are still \n" "and increasing it if areas that should be painted are still \n"
"not painted.\n" "not painted.\n"
@ -1380,7 +1380,7 @@ class ToolPaint(FlatCAMTool, Gerber):
prog_plot = True if self.app.defaults["tools_paint_plotting"] == 'progressive' else False prog_plot = True if self.app.defaults["tools_paint_plotting"] == 'progressive' else False
name = outname if outname is not None else self.obj_name + "_paint" name = outname if outname is not None else self.obj_name + "_paint"
over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) / 100.0
conn = connect if connect is not None else self.app.defaults["tools_pathconnect"] conn = connect if connect is not None else self.app.defaults["tools_pathconnect"]
cont = contour if contour is not None else self.app.defaults["tools_paintcontour"] cont = contour if contour is not None else self.app.defaults["tools_paintcontour"]
order = order if order is not None else self.order_radio.get_value() order = order if order is not None else self.order_radio.get_value()
@ -1630,7 +1630,7 @@ class ToolPaint(FlatCAMTool, Gerber):
proc = self.app.proc_container.new(_("Painting polygons...")) proc = self.app.proc_container.new(_("Painting polygons..."))
name = outname if outname is not None else self.obj_name + "_paint" name = outname if outname is not None else self.obj_name + "_paint"
over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) / 100.0
conn = connect if connect is not None else self.app.defaults["tools_pathconnect"] conn = connect if connect is not None else self.app.defaults["tools_pathconnect"]
cont = contour if contour is not None else self.app.defaults["tools_paintcontour"] cont = contour if contour is not None else self.app.defaults["tools_paintcontour"]
order = order if order is not None else self.order_radio.get_value() order = order if order is not None else self.order_radio.get_value()
@ -2214,7 +2214,7 @@ class ToolPaint(FlatCAMTool, Gerber):
proc = self.app.proc_container.new(_("Painting polygons...")) proc = self.app.proc_container.new(_("Painting polygons..."))
name = outname if outname is not None else self.obj_name + "_paint" name = outname if outname is not None else self.obj_name + "_paint"
over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) / 100.0
conn = connect if connect is not None else self.app.defaults["tools_pathconnect"] conn = connect if connect is not None else self.app.defaults["tools_pathconnect"]
cont = contour if contour is not None else self.app.defaults["tools_paintcontour"] cont = contour if contour is not None else self.app.defaults["tools_paintcontour"]
order = order if order is not None else self.order_radio.get_value() order = order if order is not None else self.order_radio.get_value()

View File

@ -371,12 +371,13 @@ class ToolTransform(FlatCAMTool):
grid0.addWidget(self.buffer_entry, 23, 1) grid0.addWidget(self.buffer_entry, 23, 1)
grid0.addWidget(self.buffer_button, 23, 2) grid0.addWidget(self.buffer_button, 23, 2)
self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Factor")) self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
self.buffer_factor_label.setToolTip( self.buffer_factor_label.setToolTip(
_("A positive value will create the effect of dilation,\n" _("A positive value will create the effect of dilation,\n"
"while a negative value will create the effect of erosion.\n" "while a negative value will create the effect of erosion.\n"
"Each geometry element of the object will be increased\n" "Each geometry element of the object will be increased\n"
"or decreased by the 'factor'.") "or decreased to fit the 'Value'. Value is a percentage\n"
"of the initial dimension.")
) )
self.buffer_factor_entry = FCDoubleSpinner(suffix='%') self.buffer_factor_entry = FCDoubleSpinner(suffix='%')

View File

@ -55,7 +55,7 @@ class TclCommandCopperClear(TclCommand):
('name', 'Name of the source Geometry object. String.'), ('name', 'Name of the source Geometry object. String.'),
('tooldia', 'Diameter of the tool to be used. Can be a comma separated list of diameters. No space is ' ('tooldia', 'Diameter of the tool to be used. Can be a comma separated list of diameters. No space is '
'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'), 'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'),
('overlap', 'Fraction of the tool diameter to overlap cuts. Float number.'), ('overlap', 'Percentage of the tool diameter to overlap cuts. Float number, [0%, 99.9999%]'),
('margin', 'Bounding box margin. Float number.'), ('margin', 'Bounding box margin. Float number.'),
('order', 'Can have the values: "no", "fwd" and "rev". String.' ('order', 'Can have the values: "no", "fwd" and "rev". String.'
'It is useful when there are multiple tools in tooldia parameter.' 'It is useful when there are multiple tools in tooldia parameter.'
@ -106,9 +106,9 @@ class TclCommandCopperClear(TclCommand):
tooldia = self.app.defaults["tools_ncctools"] tooldia = self.app.defaults["tools_ncctools"]
if 'overlap' in args: if 'overlap' in args:
overlap = float(args['overlap']) overlap = float(args['overlap']) / 100.0
else: else:
overlap = float(self.app.defaults["tools_nccoverlap"]) overlap = float(self.app.defaults["tools_nccoverlap"]) / 100.0
if 'order' in args: if 'order' in args:
order = args['order'] order = args['order']

View File

@ -45,7 +45,7 @@ class TclCommandIsolate(TclCommandSignaled):
('name', 'Name of the source object.'), ('name', 'Name of the source object.'),
('dia', 'Tool diameter.'), ('dia', 'Tool diameter.'),
('passes', 'Passes of tool width.'), ('passes', 'Passes of tool width.'),
('overlap', 'Fraction of tool diameter to overlap passes.'), ('overlap', 'Percentage of tool diameter to overlap passes. [0%, 99.9999%'),
('combine', 'Combine all passes into one geometry.'), ('combine', 'Combine all passes into one geometry.'),
('outname', 'Name of the resulting Geometry object.'), ('outname', 'Name of the resulting Geometry object.'),
('follow', 'Create a Geometry that follows the Gerber path.'), ('follow', 'Create a Geometry that follows the Gerber path.'),

View File

@ -56,7 +56,7 @@ class TclCommandPaint(TclCommand):
('name', 'Name of the source Geometry object. String.'), ('name', 'Name of the source Geometry object. String.'),
('tooldia', 'Diameter of the tool to be used. Can be a comma separated list of diameters. No space is ' ('tooldia', 'Diameter of the tool to be used. Can be a comma separated list of diameters. No space is '
'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'), 'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'),
('overlap', 'Fraction of the tool diameter to overlap cuts. Float number.'), ('overlap', 'Percentage of the tool diameter to overlap cuts. Float number, [0%, 99.9999%]'),
('margin', 'Bounding box margin. Float number.'), ('margin', 'Bounding box margin. Float number.'),
('order', 'Can have the values: "no", "fwd" and "rev". String.' ('order', 'Can have the values: "no", "fwd" and "rev". String.'
'It is useful when there are multiple tools in tooldia parameter.' 'It is useful when there are multiple tools in tooldia parameter.'
@ -74,7 +74,7 @@ class TclCommandPaint(TclCommand):
('y', 'Y value of coordinate for the selection of a single polygon. Float number.'), ('y', 'Y value of coordinate for the selection of a single polygon. Float number.'),
('outname', 'Name of the resulting Geometry object. String.'), ('outname', 'Name of the resulting Geometry object. String.'),
]), ]),
'examples': [] 'examples': ["paint obj_name -tooldia 0.3 -margin 0.1 -method 'seed' -all True"]
} }
def execute(self, args, unnamed_args): def execute(self, args, unnamed_args):
@ -103,9 +103,9 @@ class TclCommandPaint(TclCommand):
tooldia = float(self.app.defaults["tools_paintoverlap"]) tooldia = float(self.app.defaults["tools_paintoverlap"])
if 'overlap' in args: if 'overlap' in args:
overlap = float(args['overlap']) overlap = float(args['overlap']) / 100.0
else: else:
overlap = float(self.app.defaults["tools_paintoverlap"]) overlap = float(self.app.defaults["tools_paintoverlap"]) / 100.0
if 'order' in args: if 'order' in args:
order = args['order'] order = args['order']