AddRay Method (ActiveX)

Creates a ray passing through two unique points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddRay(Point1, Point2)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the finite start point of the ray.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point through which the ray will pass. The ray extends from Point1, through Point2 to infinity.

Return Value (RetVal)

Type: Ray

The newly created Ray object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddRay()
    ' This example creates a ray in model space.
    
    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)
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddRay()
    ;; This example creates a ray in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the ray
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 4 4 0))
    
    ;; Creates a Ray object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))
    (vla-ZoomAll acadObj)
)