Results 1 to 2 of 2

Thread: AngleFromXAxis Troubles

  1. #1
    Member
    Join Date
    2017-05
    Posts
    2
    Login to Give a bone
    0

    Default AngleFromXAxis Troubles

    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.

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,680
    Login to Give a bone
    0

    Default Re: AngleFromXAxis Troubles

    You need to show us the code that shows how the array is getting assigned.
    C:> ED WORKING....

Similar Threads

  1. .COM troubles
    By rhutchi1 in forum VBA/COM Interop
    Replies: 11
    Last Post: 2012-09-19, 02:39 PM
  2. troubles with floors in boq:(
    By Amro in forum Revit Architecture - General
    Replies: 2
    Last Post: 2011-05-31, 05:20 PM
  3. Workset Troubles - Please Help
    By ekneer in forum Revit Structure - General
    Replies: 10
    Last Post: 2007-04-20, 01:21 PM
  4. Elevation troubles
    By h.jobe in forum ACA General
    Replies: 1
    Last Post: 2006-08-25, 05:35 PM
  5. big roof troubles
    By ..shaner in forum Revit Architecture - General
    Replies: 1
    Last Post: 2006-07-18, 09:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •