pyautocad:COM错误:(-2147352571,“类型不匹配。”,(无,无,无,0,无))

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

我有 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}")
python autocad
1个回答
0
投票

根据文档,Hatch 不将点作为参数。

首先创建剖面线,然后附加外循环

或者使用SendCommand

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