示例#1
0
 def performCommandRandomly(self, commandName, andLoop=10):
     """
         set some random Value at the command imput
     """
     self.outputMsg("Start Command %s" % str(commandName))
     i = 0
     cObject = self.__pyCadApplication.getCommand(commandName)
     for iv in cObject:
         exception, message = iv
         try:
             raise exception(None)
         except ExcPoint:
             self.outputMsg("Add Point")
             if i >= andLoop:
                 cObject[iv] = None
             else:
                 cObject[iv] = self.getRandomPoint()
         except (ExcLenght, ExcAngle):
             self.outputMsg("Add Lengh/Angle")
             cObject[iv] = 100
         except:
             self.outputMsg("Bad error !!")
             raise
         i += 1
     else:
         self.outputMsg("Apply Command")
         cObject.applyCommand()
示例#2
0
 def performCommand(self,cObject, text):
     """
         Perform a Command
         cObject is the command object
     """
     try:
         iv=next(cObject)
         exception,message=iv
         try:
             raise exception(None)
         except ExcPoint:
             cObject[iv]=self.convertToPoint(text)  
             return cObject
         except (ExcLenght, ExcAngle, ExcInt):
             cObject[iv]=self.convertToFloat(text)
             return cObject
         except (ExcBool):
             cObject[iv]=self.convertToBool(text)
             return cObject
         except (ExcText):
             cObject[iv]=text
             return cObject
         except (ExcEntity):
             cObject[iv]=self.convertToInt(text)
             return cObject
         except:
             msg="Error on command imput"
             self.outputMsg(msg)
             raise CommandException(msg)
         
     except (StopIteration):
         cObject.applyCommand()
         return None
     except PyCadWrongCommand:
         self.outputMsg("Wrong Command")
示例#3
0
    def performCommand(self, cObject, text):
        """
            Perform a Command
            cObject is the command object
        """
        try:
            iv = next(cObject)
            exception, message = iv
            try:
                raise exception(None)
            except ExcPoint:
                cObject[iv] = self.convertToPoint(text)
                return cObject
            except (ExcLenght, ExcAngle, ExcInt):
                cObject[iv] = self.convertToFloat(text)
                return cObject
            except (ExcBool):
                cObject[iv] = self.convertToBool(text)
                return cObject
            except (ExcText):
                cObject[iv] = text
                return cObject
            except (ExcEntity):
                cObject[iv] = self.convertToInt(text)
                return cObject
            except:
                msg = "Error on command imput"
                self.outputMsg(msg)
                raise CommandException(msg)

        except (StopIteration):
            cObject.applyCommand()
            return None
        except PyCadWrongCommand:
            self.outputMsg("Wrong Command")
示例#4
0
 def performCommandRandomly(self, commandName, andLoop=10):
     """
         set some random Value at the command imput
     """
     self.outputMsg("Start Command %s"%str(commandName))
     i=0
     cObject=self.__pyCadApplication.getCommand(commandName)
     for iv in cObject:
         exception,message=iv
         try:
             raise exception(None)
         except ExcPoint:
             self.outputMsg("Add Point")
             if i>=andLoop:
                 cObject[iv]=None
             else:
                 cObject[iv]=self.getRandomPoint()
         except (ExcLenght, ExcAngle):
             self.outputMsg("Add Lengh/Angle")
             cObject[iv]=100
         except:
             self.outputMsg("Bad error !!")
             raise 
         i+=1
     else:
         self.outputMsg("Apply Command")
         cObject.applyCommand()