不知以下程序是否可用:
- Sub oef()
- Dim pnt As Variant
- Dim ent1 As AcadLWPolyline
- Dim ent2 As AcadLWPolyline
- Dim ents As Variant
- Dim pnts As Variant
- Dim cnt As Integer
- Dim cor() As Double
- Dim i As Integer
- Dim txt As String
- ThisDrawing.Utility.GetEntity ent1, pnt
- pnts = ent1.Coordinates
- cnt = (UBound(pnts) + 1) / 2
- Debug.Print cnt
- ReDim cor(1, cnt) As Double
- For i = 0 To UBound(pnts) Step 2
- cor(0, i / 2) = ent1.Coordinates(i)
- cor(1, i / 2) = ent1.Coordinates(i + 1)
- Next
- ents = ent1.Offset(10)
- Set ent2 = ents(0)
- If ent2.Area > ent1.Area Then
- txt = "逆时针方向,其逆时针坐标如下:"
- For i = 0 To UBound(cor, 2) - 1
- txt = txt & vbCr & cor(0, i) & "," & cor(1, i)
- Next
- Else
- txt = "线为顺时针方向,已经转换为逆时针的坐标如下:"
- For i = UBound(cor, 2) - 1 To 0 Step -1
- txt = txt & vbCr & cor(0, i) & "," & cor(1, i)
- Next
- End If
- For i = 0 To UBound(ents)
- ents(i).Delete
- Next
- MsgBox txt
-
- End Sub
|