我有 python autocad 的问题
错误是“COM错误:(-2147352571,'类型不匹配。',(无,无,无,0,无))”
我请求大家找到这个问题的解决方案
我的代码是:
import pyautocad
from pyautocad import APoint
import comtypes
acad = pyautocad.Autocad()
# Define the points for a rectangle
#points = [APoint(0, 0), APoint(10, 0), APoint(10, 5), APoint(0, 5)]
# Create a lightweight polyline from the points
#polyline = acad.model.AddLwpolyline(points)
# Specify the pick point as an APoint
pick_point = APoint(5, 2.5)
# Attempt to create a hatch
try:
hatch = acad.model.AddHatch(0, pick_point, "SOLID", 1.0) # Adjust the scale factor as needed
hatch.Evaluate()
except comtypes.COMError as e:
print(f"COM Error: {e}")