- fixed Tcl Command CncJob

- fixed crash due of Properties Tool trying to have a convex hull area on FlatCAMCNCJob objects which is not possible due of their nature
- modified Tcl Command SubtractRectangle
- fixed and modernized the Tcl Command Scale to be able to scale on X axis or on Y axis or on both and having as scale reference either the (0, 0) point or the minimum point of the bounding box or the center of the bounding box.
- fixed and modernized the Tcl Command Skew
This commit is contained in:
Marius Stanciu
2019-08-26 00:40:35 +03:00
committed by Marius
parent 65ab17e308
commit ba1e0bc94b
11 changed files with 133 additions and 50 deletions

View File

@@ -4,7 +4,7 @@ from tclCommands.TclCommand import TclCommandSignaled
class TclCommandSubtractRectangle(TclCommandSignaled):
"""
Tcl shell command to subtract a rectange from the given Geometry object.
Tcl shell command to subtract a rectangle from the given Geometry object.
"""
# array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
@@ -13,11 +13,7 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
# Dictionary of types from Tcl command, needs to be ordered.
# For positional arguments
arg_names = collections.OrderedDict([
('name', str),
('x0', float),
('y0', float),
('x1', float),
('y1', float)
('name', str)
])
# Dictionary of types from Tcl command, needs to be ordered.
@@ -27,7 +23,7 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
required = ['name', 'x0', 'y0', 'x1', 'y1']
required = ['name']
# structured help for current command, args needs to be ordered
help = {
@@ -37,7 +33,7 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
('x0 y0', 'Bottom left corner coordinates.'),
('x1 y1', 'Top right corner coordinates.')
]),
'examples': []
'examples': ['subtract_rectangle geo_obj 8 8 15 15']
}
def execute(self, args, unnamed_args):
@@ -49,12 +45,19 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
without -somename and we do not have them in known arg_names
:return: None or exception
"""
if 'name' not in args:
self.raise_tcl_error("%s:" % _("No Geometry name in args. Provide a name and try again."))
return 'fail'
obj_name = args['name']
x0 = args['x0']
y0 = args['y0']
x1 = args['x1']
y1 = args['y1']
if len(unnamed_args) != 4:
self.raise_tcl_error("Incomplete coordinates. There are 4 required: x0 y0 x1 y1.")
return 'fail'
x0 = float(unnamed_args[0])
y0 = float(unnamed_args[1])
x1 = float(unnamed_args[2])
y1 = float(unnamed_args[3])
try:
obj = self.app.collection.get_by_name(str(obj_name))