- fixed the Tcl Command Delete to have an argument -f that will force deletion evading the popup (if the popup is enabled). The sme command without a name now will delete all objects

- fixed the Tcl Command JoinExcellons
- fixed the Tcl Command JoinGeometry
- fixed the Tcl Command Mirror
- updated the Tcl Command Mirror to use a (X,Y) origin parameter. Works if the -box parameter is not used.
- updated the Tcl Command Offset. Now it can use only -x or -y parameter no longer is mandatory to have both. The one that is not present will be assumed 0.0
- updated the Tcl Command Panelize. The -rows and -columns parameters are no longer both required. If one is not present then it is assumed to be zero.
- updated the Tcl Command Scale. THe -origin parameter can now be a tuple of (x,y) coordinates.
- updated the Tcl Command Skew. Now it can use only -x or -y parameter no longer is mandatory to have both. The one that is not present will be assumed 0.0
- updated the help for all the Tcl Commands
This commit is contained in:
Marius Stanciu
2020-04-09 04:13:04 +03:00
committed by Marius
parent ecba1a9232
commit 42949021b1
53 changed files with 322 additions and 178 deletions

View File

@@ -45,18 +45,22 @@ class TclCommandScale(TclCommand):
help = {
'main': "Resizes the object by a factor on X axis and a factor on Y axis, having as scale origin the point ",
'args': collections.OrderedDict([
('name', 'Name of the object to resize.'),
('factor', 'Fraction by which to scale on both axis. '),
('name', 'Name of the object (Gerber, Geometry or Excellon) to be resized. Required.'),
('factor', 'Fraction by which to scale on both axis.'),
('x', 'Fraction by which to scale on X axis. If "factor" is used then this parameter is ignored'),
('y', 'Fraction by which to scale on Y axis. If "factor" is used then this parameter is ignored'),
('origin', 'Reference used for scale. It can be: "origin" which means point (0, 0) or "min_bounds" which '
'means the lower left point of the bounding box or it can be "center" which means the center '
'of the bounding box.')
('origin', 'Reference used for scale.\n'
'The reference point can be:\n'
'- "origin" which means point (0, 0)\n'
'- "min_bounds" which means the lower left point of the bounding box\n'
'- "center" which means the center point of the bounding box of the object.\n'
'- a tuple in format (x,y) with the X and Y coordinates separated by a comma. NO SPACES ALLOWED')
]),
'examples': ['scale my_geometry 4.2',
'scale my_geo -x 3.1 -y 2.8',
'scale my_geo 1.2 -origin min_bounds']
'scale my_geo 1.2 -origin min_bounds',
'scale my_geometry -x 2 -origin 3.0,2.1']
}
def execute(self, args, unnamed_args):
@@ -92,8 +96,17 @@ class TclCommandScale(TclCommand):
c_y = ymin + (ymax - ymin) / 2
point = (c_x, c_y)
else:
self.raise_tcl_error('%s' % _("Expected -origin <origin> or -origin <min_bounds> or -origin <center>."))
return 'fail'
try:
point = eval(args['origin'])
if not isinstance(point, tuple):
raise Exception
except Exception as e:
self.raise_tcl_error('%s\n%s' % (_("Expected -origin <origin> or "
"-origin <min_bounds> or "
"-origin <center> or "
"- origin 3.0,4.2."), str(e))
)
return 'fail'
if 'factor' in args:
factor = float(args['factor'])