SecondPoint Example

Using Programming Languages other than VBA

Sub Example_SecondPoint()
	' This example creates a ray object. It then finds the
	' second point of the ray, changes the second point, and
	' queries the new second point.

	Dim basePoint(0 To 2) As Double
	Dim directionVec(0 To 2) As Double
	Dim rayObj As AcadRay
	Dim currSecondPoint As Variant
	Dim msg As String
	Dim newSecondPoint(0 To 2) As Double

	' Establish the base point and directional vector for the ray
	basePoint(0) = 3: basePoint(1) = 3: basePoint(2) = 0
	directionVec(0) = 1:	directionVec(1) = 1: directionVec(2) = 0

	' Create a Ray object in model space
	Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, directionVec)

	ThisDrawing.Regen True
	MsgBox "A new Ray has been added.", vbInformation

	' Define a new second point
	newSecondPoint(0) = 4: newSecondPoint(1) = 2: newSecondPoint(2) = 0

	' Update the ray using the new second point
	rayObj.SecondPoint = newSecondPoint
		
	' Query the new second point for the Ray
	currSecondPoint = rayObj.SecondPoint
	msg = currSecondPoint(0) & vbCrLf & _
		currSecondPoint(1) & vbCrLf & _
		currSecondPoint(2)

	ThisDrawing.Regen True
	MsgBox "We've just changed the second point of the new Ray to: " & vbCrLf & msg, vbInformation

End Sub

 

   Comments?