免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2380 | 回复: 0
打印 上一主题 下一主题

[問題]Python VS. AutoCAD 執行錯誤? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-02-05 12:16 |只看该作者 |倒序浏览
請教各位前輩,
我依照網址 https://pyautocad.readthedocs.or ... d.html#requirements
安裝 pyAutocad 和 comtypes
Run下列代碼:
from pyautocad import Autocad
from pyautocad.types import APoint

acad = Autocad()
acad.prompt("Hello, Autocad from Python\n"
print(acad.doc.Name)

p1 = APoint(0, 0)
p2 = APoint(50, 25)
for i in range(5):
    text = acad.model.AddText('Hi %s!' % i, p1, 2.5)
    acad.model.AddLine(p1, p2)
    acad.model.AddCircle(p1, 10)
    p1.y += 10

dp = APoint(10, 0)
for text in acad.iter_objects('Text'):
    print('text: %s at: %s' % (text.TextString, text.InsertionPoint))
    text.InsertionPoint = APoint(text.InsertionPoint) + dp

for obj in acad.iter_objects(['Circle', 'Line']):
    print(obj.ObjectName)

會發生如下錯誤:
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:4 [MSC v.1600 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
[evaluate untitled-1.py]
Traceback (most recent call last):
  File "C:\Program Files\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py", line 1, in <module>
    # Used internally for debug sandbox under external interpreter
  File "c:\Python33\Lib\pyautocad\__init__.py", line 15, in <module>
    from pyautocad.api import *
  File "c:\Python33\Lib\pyautocad\api.py", line 16, in <module>
    import comtypes
  File "c:\Python33\Lib\comtypes\__init__.py", line 1262, in <module>
    from comtypes._comobject import COMObject
  File "c:\Python33\lib\comtypes\_comobject.py", line 63, in ?
    except ReturnHRESULT, err:
Syntax Error:         except ReturnHRESULT, err:: c:\Python33\lib\comtypes\_comobject.py, line 6329

請問該如何解決?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP