- Function GetVertexs(Ent As AcadEntity) As Variant
- Dim n As Integer
- Dim oVertexs() As AcadObject
- Dim sName As String
- sName = UCase(Ent.ObjectName)
- If sName = "ACDBPOLYLINE" Or sName = "ACDB3DPOLYLINE" Then
- n = (UBound(Ent.Coordinates) + 1) / 3
- End If
- If n = 0 Then Exit Function
- ReDim oVertexs(n - 1)
- Dim oVlax As New VLAX
- lst = oVlax.GetLispList("(GetVers """ & Ent.Handle & """)")
- For i = 1 To n
- Set oVertexs(i - 1) = acadapp.ActiveDocument.HandleToObject(lst(n - i))
- Next i
- GetVertexs = oVertexs
- End Function
- Sub test4()
- ' Dim ZY_Xian1 As AcadPolyline
- Dim obj As AcadLWPolyline, pnt, oVers
- Dim xt, xd
- ThisDrawing.Utility.GetEntity obj, pnt
- ' oVers = GetVertexs(ZY_Xian1)
- oVers = GetVertexs(obj)
- For i = 0 To UBound(oVers)
- s = ""
- oVers(i).GetXData "", xt, xd
-
- For j = 0 To UBound(xd)
- s = s & vbCrLf & xd(j)
- Next j
- If Err Then
- Err.Clear
- MsgBox "空值"
- Else
- MsgBox s
- End If
- Next i
- End Sub
|