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

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

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

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

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

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

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