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


Python Application.openDocument方法代码示例

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


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

示例1: textApplication

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

#.........这里部分代码省略.........
        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)
                except ExcPoint:
                    cObject[iv]=self.imputPoint(message)                    
                except (ExcLenght, ExcAngle):
                    cObject[iv]=self.inputFloat(message)
                except (ExText):
                    cObject[iv]=self.inputMsg(message)
                except (ExEntity):
                    cObject[iv]=self.inputInt(message)
                except:
                    print("Bad error !!")
                    raise 
开发者ID:chiamingyen,项目名称:PythonCAD_py3,代码行数:70,代码来源:test_kernel.py

示例2: find_intersections

# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import openDocument [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")
开发者ID:chrisbura,项目名称:pythoncad-legacy,代码行数:32,代码来源:application_test.py


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