AddXLine Method (ActiveX)

Creates an xline (an infinite line) passing through two specified points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddXline(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 infinite start point of the xline.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point through which the xline will pass. The xline extends through Point1 and Point2 in both directions to infinity.

Return Value (RetVal)

Type: XLine

The newly created XLine object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddXLine()
    ' This example creates an XLine in model space.
    
    Dim xlineObj As AcadXline
    Dim basePoint(0 To 2) As Double
    Dim directionVec(0 To 2) As Double
    
    ' Define the xline
    basePoint(0) = 2#: basePoint(1) = 2#: basePoint(2) = 0#
    directionVec(0) = 1#: directionVec(1) = 1#: directionVec(2) = 0#
    
    ' Create the xline in model space
    Set xlineObj = ThisDrawing.ModelSpace.AddXline(basePoint, directionVec)
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddXLine()
    ;; This example creates an XLine in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the xline
    (setq basePoint (vlax-3d-point 2 2 0)
          directionVec (vlax-3d-point 1 1 0))
    
    ;; Create the xline in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq xlineObj (vla-AddXline modelSpace basePoint directionVec))
    (vla-ZoomAll acadObj)
)