当前位置: 首页>>代码示例>>Python>>正文


Python Application.getDocuments方法代码示例

本文整理汇总了Python中application.Application.getDocuments方法的典型用法代码示例。如果您正苦于以下问题:Python Application.getDocuments方法的具体用法?Python Application.getDocuments怎么用?Python Application.getDocuments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在application.Application的用法示例。


在下文中一共展示了Application.getDocuments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: textApplication

# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import getDocuments [as 别名]

#.........这里部分代码省略.........
            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);
        
    def getActiveDoc(self):            
        """
            print the active document
        """ 
        try:
            doc=self.__pyCadApplication.ActiveDocument
            self.outputMsg("Active Document is %s"%str(doc.dbPath))
        except:
            self.outputMsg("Unable To Perform the getActiveDoc") 
   
    def setActiveDoc(self):
        """
            set the active docuement
        """
        try:
            lookIndex=self.inputMsg("Write the number of doc that you are looking for")
            i=0
            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:
开发者ID:chiamingyen,项目名称:PythonCAD_py3,代码行数:70,代码来源:test_kernel.py


注:本文中的application.Application.getDocuments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。