action_menu_pcb2dxf.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:kicad-action-plugins 作者: easyw 项目源码 文件源码
def Run( self ):
        fileName = GetBoard().GetFileName()
        if len(fileName)==0:
            wx.LogMessage("a board needs to be saved/loaded!")
        else:
            dirpath = os.path.abspath(os.path.expanduser(fileName))
            path, fname = os.path.split(dirpath)
            ext = os.path.splitext(os.path.basename(fileName))[1]
            name = os.path.splitext(os.path.basename(fileName))[0]

            LogMsg="reading from "+ dirpath
            out_filename=path+os.sep+name+".dxf"
            LogMsg+="writing to "+out_filename
            content=[]
            txtFile = open(fileName,"r")
            content = txtFile.readlines()
            content.append(" ")
            txtFile.close()

            #wx.MessageDialog(None, 'This is a message box. ONLY TEST!', 'Test', wx.OK | wx.ICON_INFORMATION).ShowModal()
            #wx.MessageDialog(None, 'This is a message box. ONLY TEST!', content, wx.OK | wx.ICON_INFORMATION).ShowModal()
            #found_selected=False
            #board = pcbnew.GetBoard()

            dlg=wx.MessageBox( 'Only SAVED board file will be exported to DXF file', 'Confirm',  wx.OK | wx.CANCEL | wx.ICON_INFORMATION )
            if dlg == wx.OK:
                if os.path.isfile(out_filename):
                    dlg=wx.MessageBox( 'Overwrite DXF file?', 'Confirm', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION )
                    if dlg == wx.YES:
                        export_dxf(content, out_filename)
                else:
                    export_dxf(content, out_filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号