active angle pt2

Microstation v8i (08.11.09.833)

I took an example from help vba. I entered points to try but the macro hangs on

vec1 = Vector3dFromMatrix3dTimesVector3d(oview.Rotation, Vector3dSubtractPoint3dPoint3d(pt2, pt1))

... what's wrong?

Option Explicit

Sub anglept2()
Dim activeangle As Double
Dim computedangle As Double
Dim oview As View
Dim pt1 As Point3d
Dim pt2 As Point3d

pt1.X = 527203.091598784
pt1.Y = 5064287.03824722
pt1.Z = 0
 
pt2.X = 527197.378828332
pt2.Y = 5064287.03824722
pt2.Z = 0

    computedangle = GetActiveAngleFrom2Points(pt1, pt2, oview)
    activeangle = Radians(computedangle)
    Debug.Print "angolo attivo  = " & activeangle
    End Sub
    

Function GetActiveAngleFrom2Points(pt1 As Point3d, pt2 As Point3d, oview As View) As Double
    Dim vec1 As Vector3d, vec2 As Vector3d
    Dim angle As Double

    'get vectors in plane of view
     vec1 = Vector3dFromMatrix3dTimesVector3d(oview.Rotation, Vector3dSubtractPoint3dPoint3d(pt2, pt1))
    vec2 = Vector3dFromXY(1#, 0#)

    'duplicate keyin logic
    angle = Degrees(Vector3dAngleBetweenVectorsXY(vec2, vec1))
    If angle < 0# Then
        angle = angle + 360#
    End If

    GetActiveAngleFrom2Points = angle
End Function

thank you

Parents Reply Children