这样对 Coordinates 的遍历来得到的
Sub Test5() Dim objSel As AcadEntity Dim pt As ACAD_POINT On Error GoTo exitSel ThisDrawing.Utility.GetEntity objSel, pt, "Pick a text" 'If TypeOf objSel Is AcDbText Then If objSel.ObjectName <> "AcDbPolyline" Then ThisDrawing.Utility.Prompt "选择的不是 AcDbPolyline,请重新选择!" Exit Sub End If 'Dim vv As AcadPolyline Dim pts As Variant pts = objSel.Coordinates Dim i As Integer i = 1 Dim ptCir(0 To 2) As Double Dim cir As AcadCircle For Each pt In pts If i = 2 Then ptCir(1) = pt ptCir(2) = 0# Set cir = ThisDrawing.ModelSpace.AddCircle(ptCir, 2#) i = 1 Else ptCir(0) = pt i = i + 1 End If Next pt
exitSel: End Sub |