- 积分
- 3172
- 明经币
- 个
- 注册时间
- 2013-12-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2014-10-26 17:01:45
|
显示全部楼层
Sub xzj()
'这样写不行,请教解决办法。我想得到多段线里的顶点坐标
Dim i As Integer, j As Integer, Points As Variant
Dim ss1 As AcadSelectionSet
Dim mode As Integer
Dim ent As AcadEntity
Dim Y As Double, X As Double
Dim FType(1) As Integer, FData(1) As Variant
On Error GoTo a0
FType(0) = 0: FData(0) = "LWPOLYLINE"
FType(1) = 8: FData(1) = "0" '"SJW"
Set ss1 = ThisDrawing.SelectionSets.Add("Ps1" & Time)
ss1.Select acSelectionSetAll, , , FType, FData
For Each ent In ss1
Points = ent.Coordinates
For j = 0 To (UBound(Points) - 1) / 2
X = Points(j * 2)
Y = Points(j * 2 + 1)
Debug.Print X & ";" & Y
Next j
Next
ss1.Clear
ss1.Delete
Exit Sub
a0:
ss1.Clear
ss1.Delete
MsgBox "发生了" & Err.Description & "错误"
End Sub |
|