- 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:
@@ -24,22 +24,25 @@ class TclCommandMirror(TclCommandSignaled):
|
||||
option_types = collections.OrderedDict([
|
||||
('axis', str),
|
||||
('box', str),
|
||||
('dist', float)
|
||||
('origin', str)
|
||||
])
|
||||
|
||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
||||
required = ['name', 'axis']
|
||||
required = ['name']
|
||||
|
||||
# structured help for current command, args needs to be ordered
|
||||
help = {
|
||||
'main': "Opens an Excellon file.",
|
||||
'main': "Will mirror an named object.",
|
||||
'args': collections.OrderedDict([
|
||||
('name', 'Name of the object (Gerber or Excellon) to mirror.'),
|
||||
('box', 'Name of object which act as box (cutout for example.)'),
|
||||
('name', 'Name of the object (Gerber, Geometry or Excellon) to be mirrored. Required.'),
|
||||
('axis', 'Mirror axis parallel to the X or Y axis.'),
|
||||
('dist', 'Distance of the mirror axis to the X or Y axis.')
|
||||
('box', 'Name of object which act as box (cutout for example.)'),
|
||||
('origin', 'Reference point . It is used only if the box is not used. Format (x,y).\n'
|
||||
'Comma will separate the X and Y coordinates.\n'
|
||||
'WARNING: no spaces are allowed. If uncertain enclose the two values inside parenthesis.\n'
|
||||
'See the example.')
|
||||
]),
|
||||
'examples': []
|
||||
'examples': ['mirror obj_name -box box_geo -axis X -origin 3.2,4.7']
|
||||
}
|
||||
|
||||
def execute(self, args, unnamed_args):
|
||||
@@ -69,10 +72,13 @@ class TclCommandMirror(TclCommandSignaled):
|
||||
return "ERROR: Only Gerber, Excellon and Geometry objects can be mirrored."
|
||||
|
||||
# Axis
|
||||
try:
|
||||
axis = args['axis'].upper()
|
||||
except KeyError:
|
||||
return "ERROR: Specify -axis X or -axis Y"
|
||||
if 'axis' in args:
|
||||
try:
|
||||
axis = args['axis'].upper()
|
||||
except KeyError:
|
||||
axis = 'Y'
|
||||
else:
|
||||
axis = 'Y'
|
||||
|
||||
# Box
|
||||
if 'box' in args:
|
||||
@@ -91,19 +97,22 @@ class TclCommandMirror(TclCommandSignaled):
|
||||
|
||||
obj.mirror(axis, [px, py])
|
||||
obj.plot()
|
||||
|
||||
return
|
||||
except Exception as e:
|
||||
return "Operation failed: %s" % str(e)
|
||||
|
||||
else:
|
||||
# Origin
|
||||
if 'origin' in args:
|
||||
try:
|
||||
dist = float(args['dist'])
|
||||
origin_val = eval(args['origin'])
|
||||
x = float(origin_val[0])
|
||||
y = float(origin_val[1])
|
||||
except KeyError:
|
||||
dist = 0.0
|
||||
x, y = (0, 0)
|
||||
except ValueError:
|
||||
return "Invalid distance: %s" % args['dist']
|
||||
return "Invalid distance: %s" % str(args['origin'])
|
||||
|
||||
try:
|
||||
obj.mirror(axis, [dist, dist])
|
||||
obj.mirror(axis, [x, y])
|
||||
except Exception as e:
|
||||
return "Operation failed: %s" % str(e)
|
||||
|
||||
Reference in New Issue
Block a user