XVector and YVector property example


Sub X_Vector_Example()
    ' This example creates a new UCS, activates it and lists its X and Y Vectors.
    Dim origin(0 To 2) As Double: origin(0) = 0: origin(1) = 0: origin(2) = 0
    Dim xAxisPoint(0 To 2) As Double: xAxisPoint(0) = 4: xAxisPoint(1) = 3: xAxisPoint(2) = 0
    Dim yAxisPoint(0 To 2) As Double: yAxisPoint(0) = -3: yAxisPoint(1) = 4: yAxisPoint(2) = 5
    
'    Dim origin(0 To 2) As Double: origin(0) = 0: origin(1) = 0: origin(2) = 0
'    Dim xAxisPoint(0 To 2) As Double: xAxisPoint(0) = 1: xAxisPoint(1) = 1: xAxisPoint(2) = 0
'    Dim yAxisPoint(0 To 2) As Double: yAxisPoint(0) = -1: yAxisPoint(1) = 1: yAxisPoint(2) = 0.5
'
'    Dim origin(0 To 2) As Double: origin(0) = 22: origin(1) = 10: origin(2) = 0
'    Dim xAxisPoint(0 To 2) As Double: xAxisPoint(0) = 37: xAxisPoint(1) = 15: xAxisPoint(2) = 0
'    Dim yAxisPoint(0 To 2) As Double: yAxisPoint(0) = 17: yAxisPoint(1) = 25: yAxisPoint(2) = 0
'
    Dim ucsObj As AcadUCS
    Dim UCSName As String
    UCSName = InputBox("Type a name for the user coordinate system:")
    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, UCSName)
    ThisDrawing.ActiveUCS = ucsObj
    MsgBox "XVector(0) = " & ucsObj.XVector(0) & Chr(13) & "XVector(1) = " & ucsObj.XVector(1) & Chr(13) & "XVector(2) = " & ucsObj.XVector(2)
    MsgBox "YVector(0) = " & ucsObj.YVector(0) & Chr(13) & "YVector(1) = " & ucsObj.YVector(1) & Chr(13) & "XVector(2) = " & ucsObj.YVector(2)
End Sub

© Bricsys NV. All rights reserved.