基于提供的坐标创建引出线,或向 MLeader 对象添加新的领导集群。 支持的平台:仅窗口 签名 - 块、模型空间、图纸空间工 务 局: RetVal = object.AddLeader(PointsArray, Annotation, Type) 返回值 (RetVal) - MLeader类型:长 添加的领导集群的索引 言论块、模型空间、图纸空间:引线是将某些注释连接到图形中特征的线。引线及其注释是关联的,这意味着如果您修改引线,引线也会相应地更新。注释可以是 a、、、 或对象。ToleranceMTextBlockReference 您还可以创建不与特定对象关联的引线。为此,只需输入一个对象作为注释。NULL 例子工 务 局: 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)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 11:27
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.