问题描述
我正在尝试保存并关闭AutoCAD应用程序。我尝试使用.Quit()
,但没有用。
from comtypes import COMError
from comtypes.client import CreateObject,GetActiveObject
def main():
# Capture opened AutoCAD
try:
acad = GetActiveObject("AutoCAD.Application")
# Open new AutoCAD instance
except (OSError,COMError):
acad = CreateObject("AutoCAD.Application",dynamic=True)
# Path to dwg file
filepath = r"C:\test.dwg" # Replace it with the actual drawing path
doc = acad.Documents.Open(filepath)
load_lisp = '(load "C:/DemoExtracao.fas") ' # Notice that the last SPACE is equivalent to
doc.SendCommand(load_lisp)
execute_lisp = "(DEMO) "
doc.SendCommand(execute_lisp)
doc.Quit() # This line doesn't work
# Início da aplicação principal
if __name__ == "__main__":
main()
如何保存和关闭AutoCAD应用程序?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)