请教高手,使用复杂的polyline选择其内部文字注记
请教高手,本人使用复杂的polyline线选择其内部的楼层文字注记,但是没有选择到,不知怎么回事?本人使用了acSelectionSetWindowPolygon与acSelectionSeCrossingPolygon两种模式均未选择到,请教各位高手赐教,谢谢!Sub ssettext()
Dim obj As AcadObject
Dim pnt As Variant
Dim SSetObj As AcadSelectionSet
Dim u As Integer
Dim coord As Variant
Dim pointsArray() As Double
' On Error Resume Next
ThisDrawing.Utility.GetEntity obj, pnt
MsgBox obj.ObjectName
If obj.ObjectName = "AcDb2dPolyline" Then
coord = obj.Coordinates
u = UBound(coord)
ReDim pointsArray(u)
For i = 0 To u
pointsArray(i) = coord(i)
Next
End If
If Not IsNull(ThisDrawing.SelectionSets.Item("TEST_SSET2")) Then
Set SSetObj = ThisDrawing.SelectionSets.Item("TEST_SSET2")
SSetObj.Delete
End If
Set SSetObj = ThisDrawing.SelectionSets.Add("TEST_SSET2")
SSetObj.SelectByPolygon acSelectionSetCrossingPolygon, pointsArray '2013.11.13 edit
Dim txtpl As AcadPolyline
Set txtpl = ThisDrawing.ModelSpace.AddPolyline(pointsArray)
txtpl.ConstantWidth = 2#
MsgBox SSetObj.count
End Sub
的确很奇怪,把AcDb2dPolyline线改简单一些就可以了,难道autocad限制了pointsArray的点的数量? 本人是新手,楼主的程序本身没问题,但是画的图有问题,导致数组出错,炸开图形后发现左下角多画了个点.
因我画不出"AcDb2dPolyline" ,用"AcDb3dPolyline" 重绘一个图测试成功 先谢谢楼上的,我试试看 我测试了一下,把pl线中的重复点删除了,还是没有成功得选择到文字,可能与autocad的系统有关系吧 一次也没有成功,哪位大神继续研究一下。。
页:
[1]