See how it will works for you
~'J'~
_
Sub TestAngle()
Dim adoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = adoc.Editor
Dim p1 As Point3d = New Point3d(0, 0, 0)
Dim p2 As Point3d = New Point3d(1000, 1111, 0)
ed.WriteMessage(vbNewLine & "Angle from #1 x axis = " & (AngleFromX(p1, p2, ed) * 180 / Math.PI).ToString & " degrees")
p1 = New Point3d(0, 0, 0)
p2 = New Point3d(-1000, -1111, 0)
ed.WriteMessage(vbNewLine & "Angle #2 from x axis = " & (AngleFromX(p1, p2, ed) * 180 / Math.PI).ToString & " degrees")
End Sub
Public Shared Function AngleFromX(ByVal pt1 As Point3d, ByVal pt2 As Point3d, ByVal ed As Editor) As Double
Dim ucsmtx As Matrix3d = ed.CurrentUserCoordinateSystem
Dim ucs As CoordinateSystem3d = ucsmtx.CoordinateSystem3d
Dim ucsplane As Plane = New Plane(ucs.Origin, ucs.Xaxis, ucs.Yaxis)
Dim vec As Vector3d = pt2 - pt1
Dim ang As Double = vec.AngleOnPlane(ucsplane)
Return ang
End Function