怎样实现呢?请看:
在图形中画任一多边形,想取出多边形内的所有实体,请问用VB如何实现呢?急!!!这是我前天才写好的,你看看有没有帮助咯
Dim retent As ObjectDim pnt As Variant
acaddoc.Utility.GetEntity retent, ont, "选择一个闭合多边形"
While Err
Err.Clearacaddoc.Utility.GetEntity retent, ont, "选择一个闭合多边形"
Wend
If retent.ObjectName = "AcDbPolyline" Then
Set tpolyline = retent
Dim k As Integer, i As Integer
k = UBound(tpolyline.Coordinates)
k1 = (k + 1) * 1.5
ReDim pointarrays(0 To k1 - 1)
For i = 0 To k1 / 3 - 1 Step 1 '把坐标赋值给数组
pointarrays(i * 3) = tpolyline.Coordinates(i * 2)
pointarrays(i * 3 + 1) = tpolyline.Coordinates(i * 2 + 1)
pointarrays(i * 3 + 2) = 0
Next
sel1.SelectByPolygon(acSelectionSetWindowPolygon, pointarrays, FILTERTYPE, FILTERDATA)
不错,还有?
您这个程序很不错,在选择对象时很有用。可是这样选择到的实体如果本身延伸在多边形外边,那也被选上了,能否将选择中的对象沿多边形边线裁切后,只要多边形内部的内容呢?
页:
[1]