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

@@ -1,6 +1,7 @@
from ObjectCollection import *
import TclCommand
class TclCommandInteriors(TclCommand.TclCommand):
"""
Tcl shell command to get interiors of polygons
@@ -29,7 +30,7 @@ class TclCommandInteriors(TclCommand.TclCommand):
('name', 'Name of the source Geometry object.'),
('outname', 'Name of the resulting Geometry object.')
]),
'examples':[]
'examples': []
}
def execute(self, args, unnamed_args):
@@ -49,19 +50,15 @@ class TclCommandInteriors(TclCommand.TclCommand):
else:
outname = name + "_interiors"
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_interiors()
self.app.new_object('geometry', outname, geo_init)
self.app.new_object('geometry', outname, geo_init)