laoxie_198 发表于 2007-10-20 07:49:00

[求助]再求助用SelectByPolygon acSelectionSetWindowPolygon选择不到实体的问题!

[求助]再求助用SelectByPolygon acSelectionSetWindowPolygon选择不到实体的问题!!!!下面是我的一个函数xzb构成的封闭多义线内明明有注记的内容可怎么总是选择不到呢?
Function tqjfh(zb, ds) As String '提取街坊号
Dim xzbAs Variant
'ReDim xzb(ds) As Double
xzb = zb
'On Error Resume Next
Dim zjxzj As AcadSelectionSet
   If Not IsNull(ThisDrawing.SelectionSets.Item("zjst")) Then
   Set zjxzj = ThisDrawing.SelectionSets.Item("zjst")
   zjxzj.Delete
   End If
Set zjxzj = ThisDrawing.SelectionSets.Add("zjst") '新建选择集
ReDim gpCode(0 To 1) As Integer
    gpCode(0) = 0
    gpCode(1) = 8
    ReDim dataValue(0 To 1) As Variant
    dataValue(0) = "MTEXT"
    dataValue(1) = "街坊注记"
   
    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue
   
    zjxzj.SelectByPolygon acSelectionSetWindowPolygon, xzb, groupCode, dataCode‘此处总是提示错误:参数pointslist(位于selectbypolygon)中无效。
    'zjxzj.SelectByPolygon acSelectionSetWindowPolygon, pointsArray, groupCode, dataCode
jfh = "320506" + zjxzj.Item(0).TextString '
'以上提取街坊坐标和街坊号
tqjfh = jfh
End Function

wuzhm21 发表于 2013-1-2 12:56:00

acSelectionSetWindowPolygon要求的是三维坐标点,而你的xzb是二维数组,把二维数组的Z坐标赋值为0就可以了。

markc0826 发表于 2013-1-7 11:38:00

zjxzj.SelectByPolygon acSelectionSetWindowPolygon, xzb, groupCode, dataCode
改成
zjxzj.SelectByPolygon acSelectionSetWindowPolygon, xzb,gpCode, dataValue
试看看,
印象中你把groupCode宣告成Variant会发生错误
或者:将groupCode宣告成Integer应该也可以,只是似乎多余的资料砖换程序吧..
页: [1]
查看完整版本: [求助]再求助用SelectByPolygon acSelectionSetWindowPolygon选择不到实体的问题!