- modified the Tcl command Paint "single" parameter. Now it's value is a tuple with the x,y coordinates of the single polygon to be painted.
This commit is contained in:
parent
6aacd4d978
commit
ce9b18f9ed
|
@ -12,7 +12,7 @@ CHANGELOG for FlatCAM beta
|
|||
- fixed recent issues introduced in Tcl command Drillcncjob
|
||||
- updated the Cncjob to use the 'endxy' parameter which dictates the x,y position at the end of the job
|
||||
- now the Tcl commands Drillcncjob and Cncjob can use the toolchangexy and endxy parameters with or without parenthesis (but no spaces allowed)
|
||||
|
||||
- modified the Tcl command Paint "single" parameter. Now it's value is a tuple with the x,y coordinates of the single polygon to be painted.
|
||||
|
||||
11.05.2020
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ class TclCommandCncjob(TclCommandSignaled):
|
|||
('toolchangez', 'Z distance for toolchange (example: 30.0).\n'
|
||||
'If used in the command then a toolchange event will be included in gcode'),
|
||||
('toolchangexy', 'The X,Y coordinates at Toolchange event in format (x, y) (example: (30.0, 15.2) or '
|
||||
'without parenthesis like: 0.3,1.0 - no spaces allowed in this case).'),
|
||||
'without parenthesis like: 0.3,1.0). WARNING: no spaces allowed in the value.'),
|
||||
('startz', 'Height before the first move.'),
|
||||
('endz', 'Height where the last move will park.'),
|
||||
('endxy', 'The X,Y coordinates at job end in format (x, y) (example: (30.0, 15.2) or without parenthesis'
|
||||
'like: 0.3,1.0 - no spaces allowed in this case).'),
|
||||
('endxy', 'The X,Y coordinates at job end in format (x, y) (example: (2.0, 1.2) or without parenthesis'
|
||||
'like: 0.3,1.0). WARNING: no spaces allowed in the value.'),
|
||||
('spindlespeed', 'Speed of the spindle in rpm (example: 4000).'),
|
||||
('dwelltime', 'Time to pause to allow the spindle to reach the full speed.\n'
|
||||
'If it is not used in command then it will not be included'),
|
||||
|
@ -173,8 +173,8 @@ class TclCommandCncjob(TclCommandSignaled):
|
|||
else:
|
||||
args["endxy"] = '0, 0'
|
||||
if len(eval(args["endxy"])) != 2:
|
||||
self.raise_tcl_error("The entered value for 'endxy' needs to have the format x,y - no spaces or "
|
||||
"in format (x, y) - spaces allowed. But always two comma separated values.")
|
||||
self.raise_tcl_error("The entered value for 'endxy' needs to have the format x,y or "
|
||||
"in format (x, y) - no spaces allowed. But always two comma separated values.")
|
||||
|
||||
args["spindlespeed"] = args["spindlespeed"] if "spindlespeed" in args and args["spindlespeed"] != 0 else None
|
||||
|
||||
|
@ -208,8 +208,8 @@ class TclCommandCncjob(TclCommandSignaled):
|
|||
else:
|
||||
args["toolchangexy"] = '0, 0'
|
||||
if len(eval(args["toolchangexy"])) != 2:
|
||||
self.raise_tcl_error("The entered value for 'toolchangexy' needs to have the format x,y - no spaces or "
|
||||
"in format (x, y) - spaces allowed. But always two comma separated values.")
|
||||
self.raise_tcl_error("The entered value for 'toolchangexy' needs to have the format x,y or "
|
||||
"in format (x, y) - no spaces allowed. But always two comma separated values.")
|
||||
|
||||
del args['name']
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ class TclCommandCopperClear(TclCommand):
|
|||
'main': "Clear excess copper in polygons. Basically it's a negative Paint.",
|
||||
'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 tool 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.'),
|
||||
|
@ -72,7 +72,7 @@ class TclCommandCopperClear(TclCommand):
|
|||
('all', 'If used will copper clear the whole object. Either "-all" or "-box <value>" has to be used.'),
|
||||
('box', 'Name of the object to be used as reference. Either "-all" or "-box <value>" has to be used. '
|
||||
'String.'),
|
||||
('outname', 'Name of the resulting Geometry object. String.'),
|
||||
('outname', 'Name of the resulting Geometry object. String. No spaces.'),
|
||||
]),
|
||||
'examples': ["ncc obj_name -tooldia 0.3,1 -overlap 10 -margin 1.0 -method 'lines' -all"]
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
('name', 'Name of the source object.'),
|
||||
('drilled_dias',
|
||||
'Comma separated tool diameters of the drills to be drilled (example: 0.6,1.0 or 3.125). '
|
||||
'No space allowed'),
|
||||
'WARNING: No space allowed'),
|
||||
('drillz', 'Drill depth into material (example: -2.0). Negative value.'),
|
||||
('dpp', 'Progressive drilling into material with a specified step (example: 0.7). Positive value.'),
|
||||
('travelz', 'Travel distance above material (example: 2.0).'),
|
||||
|
@ -69,11 +69,11 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
('toolchangez', 'Z distance for toolchange (example: 30.0).\n'
|
||||
'If used in the command then a toolchange event will be included in gcode'),
|
||||
('toolchangexy', 'The X,Y coordinates at Toolchange event in format (x, y) (example: (30.0, 15.2) or '
|
||||
'without parenthesis like: 0.3,1.0 - no spaces allowed in this case).'),
|
||||
'without parenthesis like: 0.3,1.0). WARNING: no spaces allowed in the value.'),
|
||||
('startz', 'The Z coordinate at job start (example: 30.0).'),
|
||||
('endz', 'The Z coordinate at job end (example: 30.0).'),
|
||||
('endxy', 'The X,Y coordinates at job end in format (x, y) (example: (30.0, 15.2) or without parenthesis'
|
||||
'like: 0.3,1.0 - no spaces allowed in this case).'),
|
||||
('endxy', 'The X,Y coordinates at job end in format (x, y) (example: (2.0, 1.2) or without parenthesis'
|
||||
'like: 0.3,1.0). WARNING: no spaces allowed in the value.'),
|
||||
('dwelltime', 'Time to pause to allow the spindle to reach the full speed.\n'
|
||||
'If it is not used in command then it will not be included'),
|
||||
('pp', 'This is the Excellon preprocessor name: case_sensitive, no_quotes'),
|
||||
|
@ -240,8 +240,8 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
else:
|
||||
xy_toolchange = '0, 0'
|
||||
if len(eval(xy_toolchange)) != 2:
|
||||
self.raise_tcl_error("The entered value for 'toolchangexy' needs to have the format x,y - no spaces or "
|
||||
"in format (x, y) - spaces allowed. But always two comma separated values.")
|
||||
self.raise_tcl_error("The entered value for 'toolchangexy' needs to have the format x,y or "
|
||||
"in format (x, y) - no spaces allowed. But always two comma separated values.")
|
||||
|
||||
endz = args["endz"] if "endz" in args and args["endz"] is not None else self.app.defaults["excellon_endz"]
|
||||
|
||||
|
@ -252,9 +252,10 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
xy_end = self.app.defaults["excellon_endxy"]
|
||||
else:
|
||||
xy_end = '0, 0'
|
||||
|
||||
if len(eval(xy_end)) != 2:
|
||||
self.raise_tcl_error("The entered value for 'xy_end' needs to have the format x,y - no spaces or "
|
||||
"in format (x, y) - spaces allowed. But always two comma separated values.")
|
||||
self.raise_tcl_error("The entered value for 'xy_end' needs to have the format x,y or "
|
||||
"in format (x, y) - no spaces allowed. But always two comma separated values.")
|
||||
|
||||
opt_type = args["opt_type"] if "opt_type" in args and args["opt_type"] else 'B'
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
@ -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],
|
||||
|
|
Loading…
Reference in New Issue