cad二次开发

菜鸟踩踩踩 发布于 2018/10/21 09:54
阅读 271
收藏 0

源代码:

#导入模块
from pyautocad import Autocad, APoint
#创建cad实例
acad = Autocad(create_if_not_exists=True)
#在cad控制面板中输出
acad.prompt("Hello, Autocad from Python\n")
#输出文件的名字
print(acad.doc.Name)

结果:

C:\Python3.5\python.exe C:/Users/Administrator/PycharmProjects/script/cad_second.py
Traceback (most recent call last):
  File "C:/Users/Administrator/PycharmProjects/script/cad_second.py", line 2, in <module>
    from pyautocad import Autocad, APoint
  File "C:\Python3.5\lib\site-packages\pyautocad\__init__.py", line 15, in <module>
    from pyautocad.api import *
  File "C:\Python3.5\lib\site-packages\pyautocad\api.py", line 16, in <module>
    import comtypes
  File "C:\Python3.5\lib\site-packages\comtypes\__init__.py", line 357
    except COMError, err:
                   ^
SyntaxError: invalid syntax

刚入门的菜鸟,因为写论文需要,请会的大神帮个忙,怎么解决,谢谢了!

加载中
0
平原君
平原君

pyautocad应该比较老,估计不支持py3吧,换成py2试试

 

0
菜鸟踩踩踩
菜鸟踩踩踩
想要实现外部控制CAD还可以有什么软件或者编程语言?
返回顶部
顶部