- 积分
- 2003
- 明经币
- 个
- 注册时间
- 2003-4-30
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2003-6-7 18:23:00
|
显示全部楼层
但把程序该成这样也不行啊!请帮我看看到底是什么问题呢
本帖最后由 作者 于 2003-6-7 18:23:22 编辑
请看看这个程序到底有什么问题呢?
Sub a() '选择多边形里面的物体
Set sel1 = acaddoc.SelectionSets.Add("zjsel")
Dim mode As Integer
Dim pointarrays() As Variant
Dim tpolyline As AcadLWPolyline
On Error Resume Next
Dim retent As Object
Dim pnt As Variant
acaddoc.Utility.GetEntity retent, ont, "选择一个闭合多边形"
While Err
Err.Clear
acaddoc.Utility.GetEntity retent, ont, "选择一个闭合多边形"
Wend
If retent.ObjectName = "AcDbPolyline" Then
Set tpolyline = retent
Else
Exit Sub
End If
Dim k As Integer, i As Integer
k = UBound(tpolyline.Coordinates)
k1 = (k + 1) * 1.5
ReDim pointarrays(0 To k1-1) As Variant
For i = 0 To k1 / 3 Step 1 '把坐标赋值给数组
pointarrays(i * 3) = tpolyline.Coordinates(i * 2)
pointarrays(i * 3 + 1) = tpolyline.Coordinates(i * 2 + 1)
pointarrays(i * 3 + 2) = 0
Next
Call sel1.SelectByPolygon(acSelectionSetCrossingPolygon, pointarrays)
sel1.Highlight (True)
MsgBox sel1.Count
End Sub
结果还是sel1.Count总是等于0???
还有,我想问问优化多段线和一般的多段线有什么不同呢? |
|