Hi,
Hoping someone can shed some light on whats going on here..
Basically, I am getting the coordinates of 2 MText objects and trying to work out the angle between the 2 points.
This example works fine
Code:
Sub Example_AngleFromXAxis()
' This example finds the angle, in radians, between the X axis
' and a line defined by two points.
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim retAngle As Double
pt1(0) = 256833.405419725: pt1(1) = 5928142.14654379: pt1(2) = 0
pt2(0) = 256890.630751811: pt2(1) = 5928014.31962269: pt2(2) = 0
' Return the angle
retAngle = ThisDrawing.Utility.AngleFromXAxis(pt1, pt2)
' Create the line for a visual reference
Dim lineObj As AcadLine
Set lineObj = ThisDrawing.ModelSpace.AddLine(pt1, pt2)
ZoomAll
' Display the angle found
MsgBox "The angle in radians between the X axis and the line is " & retAngle, , "AngleFromXAxis Example"
End Sub
However, if those same coordinates are passed from another array like this:
Code:
.......
pt1(0) = blockLocation(0): pt1(1) = blockLocation(1): pt1(2) = 0
pt2(0) = blockLocation(2): pt2(1) = blockLocation(3): pt2(2) = 0
retAngle = ThisDrawing.Utility.AngleFromXAxis(pt1, pt2)
.......
It doesn't work... it gives the error "Invalid argument StartPoint in AngleFromXAxis"
I got the code to show me the coordinates in the blockLocation() array and used those to manually set pt1() and pt2() in the first example above which works fine...
Any ideas why it doesn't work when passing the same numbers from the blockLocation() array?
Cheers,
Kyle.