AddMLeader Method (ActiveX)

Creates an mleader line, given coordinates.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddMLeader(pointsArray, leaderLineIndex)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

pointsArray

Access: Input-only

Type: Variant (three-element array of Doubles)

The array of 3D WCS coordinates specifying the leader. You must provide at least two point to define the leader. The third point is optional.

leaderLineIndex

Access: Input-only

Type: Long

Input index of the mleader cluster.

Return Value (RetVal)

Type: MLeader

The newly created MLeader object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMLeader()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double
    
    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMLeader()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)
  
    ;; Add the mleader object to model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq mLeader (vla-AddMLeader modelSpace points i))
)