指定された座標に基づいて引出線を作成するか、MLeader オブジェクトに新しい引出線クラスタを追加します。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.AddLeader(PointsArray, Annotation, Type)
タイプ: Block、ModelSpace、PaperSpace
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: バリアント型(倍精度浮動小数点数型配列)
引出線を指定する 3D WCS 座標の配列。引出線定義のために少なくとも 2 点を指定。3 点目はオプション。
アクセス: 入力のみ
タイプ: BlockReference、MText、Tolerance
引出線にアタッチするオブジェクト。この値を NULL にして、オブジェクトをアタッチしないようにすることもできます。
アクセス: 入力のみ
タイプ: AcLeaderType 列挙型
タイプ: 長整数型
追加する引出線クラスタのインデックス。
Block、ModelSpace、PaperSpace: 引出線は、図面内の機能に注釈を接続する線分です。引出線とその注釈は関連付けられています。つまり、注釈を変更すれば、それに応じて引出線は更新されます。注釈としては、Tolerance、MText、または BlockReference オブジェクトが可能です。
特定のオブジェクトに関連付けられない引出線を作成することもできます。このようにするには、注釈として NULL オブジェクトを入力するだけです。
VBA:
Sub Example_AddLeader()
' This example creates a leader in model space.
' The leader is not attached to any annotation object
' in this example.
Dim leaderObj As AcadLeader
Dim points(0 To 8) As Double
Dim leaderType As Integer
Dim annotationObject As AcadObject
points(0) = 0: points(1) = 0: points(2) = 0
points(3) = 4: points(4) = 4: points(5) = 0
points(6) = 4: points(7) = 5: points(8) = 0
leaderType = acLineWithArrow
Set annotationObject = Nothing
' Create the leader object in model space
Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)
ZoomAll
End Sub
Sub Example_MLeaderLine()
Dim oML As AcadMLeader
Dim points(0 To 5) As Double
points(0) = 1: points(1) = 1: points(2) = 0
points(3) = 4: points(4) = 4: points(5) = 0
Dim i As Long
Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)
Dim r As Long
r = oML.AddLeader()
points(4) = 10
Call oML.AddLeaderLine(r, points)
MsgBox "LeaderCount = " & oML.LeaderCount
ZoomExtents
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AddLeader()
;; This example creates a leader in model space.
;; The leader is not attached to any annotation object
;; in this example.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq modelSpace (vla-get-ModelSpace doc))
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
(vlax-safearray-fill points '(0 0 0
4 4 0
4 5 0
)
)
(setq leaderType acLineWithArrow)
;; Create a temporary annotaion object
(setq point (vlax-3d-point 4 5 0))
(setq annotationObject (vla-AddMText modelSpace point 1 ""))
;; Create the leader object in model space
(setq leaderObj (vla-AddLeader modelSpace points annotationObject leaderType))
;; Remove the temporary annotaion object and adjust the last coordinate of the leader
(vla-Erase annotationObject)
(vla-put-Coordinate leaderObj 2 (vlax-3D-point 4 5 0))
(vla-ZoomAll acadObj)
)
(defun c:Example_MLeaderLine()
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
(vlax-safearray-fill points '(1 1 0
4 4 0
)
)
(setq i 0)
(setq modelSpace (vla-get-ModelSpace doc))
(setq oML (vla-AddMLeader modelSpace points i))
(setq r (vla-AddLeader oML))
(vlax-safearray-put-element points 4 10)
(vla-AddLeaderLine oML r points)
(alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
(vla-ZoomExtents acadObj)
)