'ANALYZING A POLYLINE FOR ARCS AND LINES
'
'
'
'Improvised in one hour exclusively for Mr. FlyCast
'Polyline: this method will fail if the polyline Type property is not acSimplePoly.
'The bulge is the tangent of 1/4 of the included angle for the arc
'between the selected vertex and the next vertex in the polyline’s vertex list.
'A negative bulge value indicates that the arc goes clockwise
'from the selected vertex to the next vertex.
'A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle.
Sub AnalysePoly()
' Begin the selection
Dim returnObj As AcadObject
Dim basePnt As Variant
Dim OldColor As Variant
On Error Resume Next
' The following example waits for a selection from the user
RETRY:
ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
If Err <> 0 Then
Err.Clear
MsgBox "Good Bye.", , "GetEntity Example"
Exit Sub
Else
OldColor = returnObj.Color
returnObj.Color = acRed
returnObj.Update
If returnObj.EntityName = "AcDbPolyline" Then
msgy = returnObj.EntityName & vbCrLf
Dim retCoord As Variant
retCoord = returnObj.Coordinates
For i = LBound(retCoord) To UBound(retCoord)
'Debug.Print retCoord(i)
Next
verticio = i / 3
For j = 1 To verticio
If returnObj.GetBulge(j) = 0 Then
typo = " Line"
Else
typo = " Arc"
End If
msgy = msgy & vbCrLf & "bulge " & j & " = " & returnObj.GetBulge(j) & typo
Debug.Print "bulge " & j & " = " & returnObj.GetBulge(j) & typo
Next
Debug.Print "coordinates " & i
Debug.Print "Vertices " & i / 3
returnObj.Color = OldColor
returnObj.Update
Else
msgy = "No PolyLine!Object is " & returnObj.EntityName
End If
MsgBox msgy, , "
End If
GoTo RETRY
End Sub