[求助]再求助用SelectByPolygon acSelectionSetWindowPolygon选择不到实体的问题!
[求助]再求助用SelectByPolygon acSelectionSetWindowPolygon选择不到实体的问题!!!!<p>下面是我的一个函数xzb构成的封闭多义线内明明有注记的内容可怎么总是选择不到呢?</p><p>Function tqjfh(zb, ds) As String '提取街坊号<br/>Dim xzb As Variant<br/>'ReDim xzb(ds) As Double<br/>xzb = zb</p><p>'On Error Resume Next<br/> Dim zjxzj As AcadSelectionSet<br/> If Not IsNull(ThisDrawing.SelectionSets.Item("zjst")) Then<br/> Set zjxzj = ThisDrawing.SelectionSets.Item("zjst")<br/> zjxzj.Delete<br/> End If<br/> Set zjxzj = ThisDrawing.SelectionSets.Add("zjst") '新建选择集<br/> ReDim gpCode(0 To 1) As Integer<br/> gpCode(0) = 0<br/> gpCode(1) = 8<br/> ReDim dataValue(0 To 1) As Variant<br/> dataValue(0) = "MTEXT"<br/> dataValue(1) = "街坊注记"<br/> <br/> Dim groupCode As Variant, dataCode As Variant<br/> groupCode = gpCode<br/> dataCode = dataValue<br/> <br/> zjxzj.SelectByPolygon acSelectionSetWindowPolygon, xzb, groupCode, dataCode‘此处总是提示错误:参数pointslist(位于selectbypolygon)中无效。<br/> 'zjxzj.SelectByPolygon acSelectionSetWindowPolygon, pointsArray, groupCode, dataCode<br/> jfh = "320506" + zjxzj.Item(0).TextString '<br/> '以上提取街坊坐标和街坊号<br/>tqjfh = jfh<br/>End Function</p> acSelectionSetWindowPolygon要求的是三维坐标点,而你的xzb是二维数组,把二维数组的Z坐标赋值为0就可以了。 zjxzj.SelectByPolygon acSelectionSetWindowPolygon, xzb, groupCode, dataCode改成
zjxzj.SelectByPolygon acSelectionSetWindowPolygon, xzb,gpCode, dataValue
试看看,
印象中你把groupCode宣告成Variant会发生错误
或者:将groupCode宣告成Integer应该也可以,只是似乎多余的资料砖换程序吧..
页:
[1]