implement TclCommand.TclCommandSignaled as proof of concept (not usefull)
bypass using threads  within obj.generatecncjob(use_thread = False, **args)
reimplement some more shell commands  to  OOP style
This commit is contained in:
Kamil Sopko
2016-03-19 15:13:07 +01:00
parent 0f463a1fc2
commit 980638630d
10 changed files with 427 additions and 162 deletions

View File

@@ -8,7 +8,7 @@ class TclCommandExteriors(TclCommand.TclCommand):
"""
# array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
aliases = ['exteriors','ext']
aliases = ['exteriors', 'ext']
# dictionary of types from Tcl command, needs to be ordered
arg_names = collections.OrderedDict([
@@ -30,7 +30,7 @@ class TclCommandExteriors(TclCommand.TclCommand):
('name', 'Name of the source Geometry object.'),
('outname', 'Name of the resulting Geometry object.')
]),
'examples':[]
'examples': []
}
def execute(self, args, unnamed_args):
@@ -50,19 +50,15 @@ class TclCommandExteriors(TclCommand.TclCommand):
else:
outname = name + "_exteriors"
try:
obj = self.app.collection.get_by_name(name)
except:
self.app.raiseTclError("Could not retrieve object: %s" % name)
obj = self.app.collection.get_by_name(name)
if obj is None:
self.app.raiseTclError("Object not found: %s" % name)
self.raise_tcl_error("Object not found: %s" % name)
if not isinstance(obj, Geometry):
self.app.raiseTclError('Expected Geometry, got %s %s.' % (name, type(obj)))
self.raise_tcl_error('Expected Geometry, got %s %s.' % (name, type(obj)))
def geo_init(geo_obj, app_obj):
def geo_init(geo_obj):
geo_obj.solid_geometry = obj_exteriors
obj_exteriors = obj.get_exteriors()
self.app.new_object('geometry', outname, geo_init)
self.app.new_object('geometry', outname, geo_init)