本文整理汇总了Python中application.Application.getActiveDocuemnt方法的典型用法代码示例。如果您正苦于以下问题:Python Application.getActiveDocuemnt方法的具体用法?Python Application.getActiveDocuemnt怎么用?Python Application.getActiveDocuemnt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.Application
的用法示例。
在下文中一共展示了Application.getActiveDocuemnt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: textApplication
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import getActiveDocuemnt [as 别名]
#.........这里部分代码省略.........
docs=self.__pyCadApplication.getDocuments()
if len(docs)<int(lookIndex):
self.outputMsg("No such a document")
return
for key in docs:
if i == int(lookIndex):
self.__pyCadApplication.ActiveDocument=docs[key]
return
i+=1
else:
self.outputMsg("Document not found")
except:
self.outputMsg("Unable To Perform the setActiveDoc")
def showDocuments(self):
"""
show The list of documents
"""
try:
self.outputMsg("Documents in the curret application")
i=0
for key in self.__pyCadApplication.getDocuments():
self.outputMsg("%s File %s"%(str(i), str(key)))
i+=1
self.outputMsg("***********************************")
except:
self.outputMsg("Unable To Perform the GetDocuments")
def closeFile(self):
"""
close the active Document
"""
try:
acDoc=self.__pyCadApplication.getActiveDocuemnt()
self.__pyCadApplication.closeDocument(acDoc.dbFile)
except:
self.outputMsg("Unable To close the active document")
def openFile(self):
"""
open a new document
"""
try:
filePath=self.inputMsg("File Path")
self.__pyCadApplication.openDocument(filePath)
except IOError:
self.outputMsg("Unable To open the file %s"%str(filePath))
def endApplication(self):
"""
close the application
"""
self.outputMsg("Bye")
sys.exit(0)
def performCommand(self,name):
"""
Perform a Command
"""
try:
cmd_Key=str(name).upper()
cObject=self.__pyCadApplication.getCommand(cmd_Key)
for iv in cObject:
exception,message=iv
try:
raise exception(None)