GetUCSMatrix method example

Private Sub cmdGetUCS_Click()

'Sub Example_GetUCSMatrix()

     ' This example creates a new UCS and finds the UCS matrix for it.

 

     ' Define a new UCS and turn on the UCS icon at the origin.

     Dim ucsObj As IntelliCAD.UserCoordSystem

     Dim originPt As Point

     Dim xAxisVector As Vector

     Dim yAxisVector As Vector

     Dim UCSName As String

' Set the origin and axes vectors.

     Set originPt = Library.CreatePoint(0, 0, 0)

     Set xAxisVector = Library.CreateVector(0, 0, 0, 1, 1, 0)

     Set yAxisVector = Library.CreateVector(0, 2, 0, 1, 1, 0)

 

     UCSName = InputBox("Type a name for the user coordinate system:")

     Set ucsObj = ThisDocument.UserCoordinateSystems.Add(originPt, xAxisVector, yAxisVector, UCSName)

     ThisDocument.ActiveUCS = ucsObj

     ThisDocument.ActiveViewport.UCSIconOn = True

     ThisDocument.ActiveViewport.UCSIconAtOrigin = True

     MsgBox "Origin coordinates: " & ucsObj.origin.x & ", " & ucsObj.origin.y & ", " & ucsObj.origin.z     

      ' Get the UCS transformation matrix

     Dim TransMatrix As Matrix

     Set TransMatrix = ucsObj.GetUCSMatrix()

     MsgBox "First two values of matrix: " TransMatrix.GetValue(0, 1) & " " & TransMatrix.GetValue(1, 2)

End Sub