本文整理汇总了Python中application.Application.getCommandList方法的典型用法代码示例。如果您正苦于以下问题:Python Application.getCommandList方法的具体用法?Python Application.getCommandList怎么用?Python Application.getCommandList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.Application
的用法示例。
在下文中一共展示了Application.getCommandList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: textApplication
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import getCommandList [as 别名]
class textApplication(object):
def __init__(self):
self.__command={}
self.__applicationCommand={}
# Application Command
self.__applicationCommand['Open']=self.openFile
self.__applicationCommand['Close']=self.closeFile
self.__applicationCommand['New']=self.newDoc
self.__applicationCommand['Documents']=self.showDocuments
self.__applicationCommand['CreateStyle']=self.createStyle
self.__applicationCommand['SetActive']=self.setActiveDoc
self.__applicationCommand['GetActive']=self.getActiveDoc
self.__applicationCommand['GetEnts']=self.getEnts
self.__applicationCommand['Esc']=self.endApplication
self.__applicationCommand['?']=self.printHelp
self.__applicationCommand['Test']=self.featureTest
self.__applicationCommand['ETest']=self.easyTest
# Document Commandf
self.__pyCadApplication=Application()
for command in self.__pyCadApplication.getCommandList():
self.__command[command]=self.performCommand
def mainLoop(self):
"""
mainLoop operation
"""
while 1:
imputstr=self.inputMsg("Insert a command (? for Help)")
try:
if imputstr in self.__command:
self.__command[imputstr](imputstr)
elif imputstr in self.__applicationCommand:
self.__applicationCommand[imputstr]()
else:
self.outputMsg("Wrong Command !!")
except EntityMissing as err:
self.outputMsg("Application Error %s "%str(err))
def printHelp(self):
"""
print the command list
"""
self.outputMsg("*****************************Drawing")
for commandName in self.__command:
self.outputMsg("Comand : %s "%str(commandName))
self.outputMsg("**************************Application Command")
for commandName in self.__applicationCommand:
self.outputMsg("Comand : %s "%str(commandName))
def getEnts(self):
"""
get database entitys
"""
try:
type=self.inputMsg("Witch Type ?")
if not type:
type="ALL"
startTime=time.clock()
activeDoc=self.__pyCadApplication.ActiveDocument
if activeDoc == None:
self.outputMsg("No Object opened")
return
ents=activeDoc.getEntityFromType(type)
endTime=time.clock()-startTime
self.printEntity(ents)
self.outputMsg("Exec query get %s ent in %s s"%(str(len(ents)), str(endTime)))
self.outputMsg("********************************")
except:
self.outputMsg("Unable To Perform the getEnts")
def printEntity(self, ents):
"""
print a query result
"""
i=0
for e in ents:
self.outputMsg("Entity Type %s id %s "%(str(e.eType),str(e.getId())))
if i > 100:
self.outputMsg("There are more then 100 entitys in the select so i stop printing")
break
i+=1
def newDoc(self):
"""
create a new document
"""
try:
self.__pyCadApplication.newDocument(None)
except (IOError, EmptyFile):
self.outputMsg("Unable To open the file %s"%str(filePath))
def createStyle(self):
"""
create a new style object
"""
styleName=self.inputMsg("Write style name")
stl=Style(styleName)
doc=self.__pyCadApplication.ActiveDocument
doc.saveEntity(stl);
#.........这里部分代码省略.........
示例2: find_intersections
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import getCommandList [as 别名]
p1=Point(0, 0)
arg={"ELLIPSE_0":p1, "ELLIPSE_1":300, "ELLIPSE_2":100}
eli=Ellipse(arg)
p2=Point(0, 0)
p3=Point(-1,0)
arg={"CLINE_0":p2, "CLINE_1":p3}
seg1=CLine(arg)
print find_intersections(eli, seg1)
print "-- segment_ellipse --"
def TestIntersection():
segment_segmet()
segment_cline()
segment_circle()
segment_ellipse()
from application import Application
a=Application()
print("stored file")
for f in a.getRecentFiles:
print "File :", str(f)
print("available command")
for c in a.getCommandList():
print "Command:", str(c)
doc=a.openDocument(a.getRecentFiles[0])
a.saveAs(r"C:\Users\mboscolo\AppData\Local\Temp\test.dxf")