#==============================================================================
# mechCAD
#==============================================================================
class mechCAD ( CAD ) :
def move (self,index):
try:
self.clear()
self.a.put("MOVE")
self.b.put(`index`)
self.mark()
self.preset()
pythonCA.flush()
if self.isvalid():
self.start()
else:
print "move failed:",self.mess.get()
except pythonCA.IOerror:
print "move failed: IO error"
raise CommandError
def stop (self):
try:
self.clear()
self.mark()
self.stop()
if self.val.get():
print "stop failed:",self.mess.get()
except pythonCA.IOerror:
print "stop failed: IO error"
raise CommandError
#==============================================================================
# mechanism
#==============================================================================
class mechanism:
def __init__ (self,mech = ''):
try:
self.cad = mechCAD (mech)
self.car = CAR (mech)
except InitError:
print "error creating",mech
raise NullObject
def move (self,index):
self.cad.move(index)
def stop (self,index):
self.cad.stop()