AddLeader 方法 (ActiveX)
根据提供的坐标创建引线,或将新的引线群集添加到 MLeader 对象。 支持的平台:仅限 Windows 签名 - Block、ModelSpace、PaperSpaceVBA: RetVal = object.AddLeader(PointsArray, Annotation, Type) 返回值 (RetVal) - MLeader类型:长 添加的领导集群的索引 言论块、模型空间、PaperSpace:引线是将某些注释连接到绘图中要素的线。引线及其注释是关联的,这意味着如果修改注释,引线会相应地更新。批注可以是 、 或 对象。ToleranceMTextBlockReference 您还可以创建与特定对象无关的引线。为此,只需输入一个对象作为注释即可。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 可视化 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-3-14 07:56
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.