pyautocad COM错误:(-2147352567, '发生异常。', (无, 无, 无, 0, 无))
我尝试使用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的安装路径启用了权限,但还是出现了同样的错误。我也关闭了杀毒软件,但也没有用。有没有人能帮我解决这个问题?
1 个回答
0
试试这个:
import pyautocad
acad = pyautocad.Autocad()
center_point = pyautocad.aDouble(5, 5) # ← ← ←
radius = 3
circle = acad.model.AddCircle(center_point, radius)
print("Circle drawn successfully.")