Hi,
hopfully that is what you are looking for, let's know if not.
That code only calculates straight angles between vertices (projected on WCS XY plane), so for any other planes or in case there are arcs included the calcualation would have "to learn" that siutations.
(minimal error handling)
Dim tDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim tED As Editor = Nothing
If tDoc IsNot Nothing Then
tED = tDoc.Editor
Dim tTrAct As Transaction = Nothing
Try
Dim tRes As PromptEntityResult = tED.GetEntity("Select Object: ")
If (tRes IsNot Nothing) AndAlso (tRes.Status = PromptStatus.OK) AndAlso (tRes.ObjectId.IsValid) Then
tTrAct = tDoc.Database.TransactionManager.StartOpenCloseTransaction
Dim tDbObj As DBObject = tTrAct.GetObject(tRes.ObjectId, OpenMode.ForRead)
If (tDbObj IsNot Nothing) Then
Dim tCurve As Curve = TryCast(tDbObj, Curve)
If tCurve IsNot Nothing Then
Dim tPnts As Point3dCollection = New Point3dCollection
tCurve.GetStretchPoints(tPnts)
If (tPnts IsNot Nothing) AndAlso (tPnts.Count >= 3) Then
For i As Integer = 1 To tPnts.Count - 2
'get point before and after current vertex
Dim tPnt1 As Point3d = tPnts(i - 1)
Dim tPnt2 As Point3d = tPnts(i)
Dim tPnt3 As Point3d = tPnts(i + 1)
'get 2D-projected vectors from prev. to current point as well as from current to next vertex
Dim tVec1 As Vector2d = tPnt2.GetVectorTo(tPnt1).Convert2d(New Plane)
Dim tVec3 As Vector2d = tPnt2.GetVectorTo(tPnt3).Convert2d(New Plane)
'now get the angle between these vectors
Dim tAng As Double = tVec1.GetAngleTo(tVec3)
Debug.Print("Vertex " & i.ToString & ": Angle = " & Format(tAng * 180 / Math.PI, "#.00"))
Next
End If
End If
End If
Else
Call MsgBox("No (valid) object selected, function cancelled.")
End If
Catch ex As Exception
'TODO run error handling
Finally
If tTrAct IsNot Nothing Then tTrAct.Dispose() : tTrAct = Nothing
End Try
End If
- alfred -
------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ...
blog.ish-solutions.at ...
LinkedIn ...
CDay 2026------------------------------------------------------------------------------------
(not an Autodesk consultant)