pyautocad COMError:(-2147352567,'发生异常。',(无,无,无,0,无))

问题描述 投票:0回答:1

我尝试使用 pyautocad 库通过下面的代码在打开的 Autocad 文件上绘制一个简单的圆圈。

import pyautocad

# Create an instance of AutoCAD
acad = pyautocad.Autocad()

# Define the center point of the circle (x, y coordinates)
center_point = (5, 5)

# Define the radius of the circle
radius = 3

# Draw the circle
circle = acad.model.AddCircle(center_point, radius)

# Display a message
print("Circle drawn successfully.")

但是我收到 COMError: (-2147352567, '发生异常。', (None, None, None, 0, None)) 错误。

我彻底卸载并重新安装了 Autocad 并将其重置为默认设置,我进入了 Autocad 安装路径并启用了权限,但仍然遇到相同的错误。我也禁用了防病毒软件,但它也不起作用。有人可以帮忙解决这个问题吗?

python exception com drawing autocad
1个回答
0
投票

必须将center_point转换为安全数组,或者使用pyautocad的Apoint

附带说明:pyautocad 似乎不再维护。如果您对 AutoCAD 的更深入的 Python 感兴趣,请查看 https://github.com/CEXT-Dan/PyRx

© www.soinside.com 2019 - 2024. All rights reserved.