Once created, you can query the first point of a ray using the BasePoint property. The second point used to create the ray is not stored with the object. Instead, use the DirectionVector property to obtain the directional vector for the ray.

Add, query, and edit a Ray object

The following example code creates a Ray object using the two points (5, 0, 0) and (1, 1, 0). It then queries the current base point and direction vector and displays the results in a message box. The direction vector is then changed and the base point and new direction vector are queried and displayed.

```Sub Ch3_EditRay()
```
```	Dim rayObj As AcadRay
```
```	Dim basePoint(0 To 2) As Double
```
```	Dim secondPoint(0 To 2) As Double
```

```	' Define the ray
```
```	basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
```
```	secondPoint(0) = 4#: secondPoint(1) = 4#: secondPoint(2) = 0#
```

```	' Creates a Ray object in model space
```
```	Set rayObj = ThisDrawing.ModelSpace.AddRay _
```
```				 (basePoint, secondPoint)
```
```	ThisDrawing.Application.ZoomAll
```

```	' Find the current status of the Ray
```
```	MsgBox "The base point of the ray is: " & _
```
```			rayObj.basePoint(0) & ", " & _
```
```			rayObj.basePoint(1) & ", " & _
```
```			rayObj.basePoint(2) & vbCrLf & _
```
```			"The directional vector for the ray is: " & _
```
```		 rayObj.DirectionVector(0) & ", " & _
```
```		 rayObj.DirectionVector(1) & ", " & _
```
```		 rayObj.DirectionVector(2), , "Edit Ray"
```

```	' Change the directional vector for the ray
```
```	Dim newVector(0 To 2) As Double
```
```	newVector(0) = -1
```
```	newVector(1) = 1
```
```	newVector(2) = 0
```
```	rayObj.DirectionVector = newVector
```
```	ThisDrawing.Regen False
```
```	MsgBox "The base point of the ray is: " & _
```
```			rayObj.basePoint(0) & ", " & _
```
```			rayObj.basePoint(1) & ", " & _
```
```			rayObj.basePoint(2) & vbCrLf & _
```
```			"The directional vector for the ray is: " & _
```
```		 rayObj.DirectionVector(0) & ", " & _
```
```		 rayObj.DirectionVector(1) & ", " & _
```
```		 rayObj.DirectionVector(2), , "Edit Ray"
```
```End Sub
```