1234567891011121314151617181920212223242526 |
- # coding=utf-8
- from ctypes import *
- from pyautocad import Autocad,APoint
- import win32api
- import os
- def openTxt(fileName):
- win32api.ShellExecute(0, 'open', r'C:\Program Files (x86)\Notepad++\notepad++.exe', fileName,'',1)
- def openTxt2(handler,fileName):
- print(handler)
- handler=win32api.ShellExecute(handler, 'open', r'C:\Program Files\TortoiseGit\bin\notepad2.exe', fileName,'',1)
- print(handler)
- def openbyApi():
- win32api.ShellExecute(0, 'open', r'D:\tools\autocadinstall\AutoCAD 2016\acad.exe', r'F:\autocad_temp\newfile032.dwg','',1)
- def closeAcad():
- os.system("taskkill /F /IM acad.exe")
- def shellDllOpen(file):
- shelldll = WinDLL("C:/Windows/System32/shell32.dll")
- shelldll.ShellExecuteW(None, 'open', file, '', '', 1)
- def autoOpen(file):
- acad = Autocad(create_if_not_exists = True)
- p1 = APoint(0,0)
- acad.model.InsertBlock(p1,file,1,1,1,0)
- # openbyApi()
- # shellDllOpen(r"e:/jstat.txt")
- # shellDllOpen(r"e:/jstat.txt")
- # autoOpen( r'F:\autocad_temp\origin.dwg')
|