- maintenance_2

This commit is contained in:
Marius Stanciu
2020-06-02 18:29:45 +03:00
committed by Marius
parent 38fa25ed3d
commit f5c84fdc49
255 changed files with 162378 additions and 152106 deletions

View File

@@ -4,7 +4,7 @@ import collections
import logging
import gettext
import FlatCAMTranslation as fcTranslate
import AppTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
@@ -43,8 +43,6 @@ class TclCommandPaint(TclCommand):
('single', str),
('ref', str),
('box', str),
('x', float),
('y', float),
('outname', str),
])
@@ -53,30 +51,32 @@ class TclCommandPaint(TclCommand):
# structured help for current command, args needs to be ordered
help = {
'main': "Paint polygons in the specified object by covering them with toolpaths.",
'main': "Paint polygons in the specified object by covering them with toolpaths.\n"
"Can use only one of the parameters: 'all', 'box', 'single'.",
'args': collections.OrderedDict([
('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 '
'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'),
('tooldia', 'Diameter of the tools to be used. Can be a comma separated list of diameters.\n'
'WARNING: No space is allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'),
('overlap', 'Percentage of tool diameter to overlap current pass over previous pass. Float [0, 99.9999]\n'
'E.g: for a 25% from tool diameter overlap use -overlap 25'),
('margin', 'Bounding box margin. Float number.'),
('order', 'Can have the values: "no", "fwd" and "rev". String.'
'It is useful when there are multiple tools in tooldia parameter.'
'"no" -> the order used is the one provided.'
'"fwd" -> tools are ordered from smallest to biggest.'
('order', 'Can have the values: "no", "fwd" and "rev". String.\n'
'It is useful when there are multiple tools in tooldia parameter.\n'
'"no" -> the order used is the one provided.\n'
'"fwd" -> tools are ordered from smallest to biggest.\n'
'"rev" -> tools are ordered from biggest to smallest.'),
('method', 'Algorithm for painting. Can be: "standard", "seed", "lines", "laser_lines", "combo".'),
('connect', 'Draw lines to minimize tool lifts. True (1) or False (0)'),
('contour', 'Cut around the perimeter of the painting. True (1) or False (0)'),
('all', 'If used, paint all polygons in the object.'),
('box', 'name of the object to be used as paint reference. String.'),
('single', 'Paint a single polygon specified by "x" and "y" parameters. True (1) or False (0)'),
('x', 'X 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.'),
('single', 'Value is in format x,y or (x,y). Example: 2.0,1.1\n'
'If used will paint a single polygon specified by "x" and "y" values.\n'
'WARNING: No spaces allowed in the value. Use dot decimals separator.'),
('outname', 'Name of the resulting Geometry object. String. No spaces.'),
]),
'examples': ["paint obj_name -tooldia 0.3 -margin 0.1 -method 'seed' -all"]
'examples': ["paint obj_name -tooldia 0.3 -margin 0.1 -method 'seed' -all",
"paint obj_name -tooldia 0.3 -margin 0.1 -method 'seed' -single 3.3,2.0"]
}
def execute(self, args, unnamed_args):
@@ -159,7 +159,7 @@ class TclCommandPaint(TclCommand):
# used only to have correct information's in the obj.tools[tool]['data'] dict
if "all" in args:
select = _("All Polygons")
select = _("All")
elif "single" in args:
select = _("Polygon Selection")
else:
@@ -245,11 +245,17 @@ class TclCommandPaint(TclCommand):
# Paint single polygon in the painted object
if 'single' in args:
if 'x' not in args and 'y' not in args:
self.raise_tcl_error('%s' % _("Expected -x <value> and -y <value>."))
if not args['single'] or args['single'] == '':
self.raise_tcl_error('%s Got: %s' %
(_("Expected a tuple value like -single 3.2,0.1."), str(args['single'])))
else:
x = args['x']
y = args['y']
coords_xy = [float(eval(a)) for a in args['single'].split(",") if a != '']
if coords_xy and len(coords_xy) != 2:
self.raise_tcl_error('%s Got: %s' %
(_("Expected a tuple value like -single 3.2,0.1."), str(coords_xy)))
x = coords_xy[0]
y = coords_xy[1]
self.app.paint_tool.paint_poly(obj=obj,
inside_pt=[x, y],