CreateEntry 方法 (ActiveX) 
在“文件依赖项列表”中创建一个新条目。(已过时) 支持的平台:仅限 Windows 签名VBA: object.CreateEntry Feature, FullFileName, AffectsGraphics, noIncrement 
 返回值 (RetVal)无返回值。 言论此方法采用指示功能说明的字符串。该字符串与文件依赖项列表 (FDL) 条目一起存储,并标识创建此条目的应用程序或功能,例如 Acad::xref。不对功能字符串执行唯一应用程序名称检查。此方法还采用一个参数来指示存储在 FDL 中的文件的名称,并且可以包含存储的路径(如果有)。 如果未包含路径,AutoCAD 将在当前目录和 AutoCAD 支持文件搜索路径中搜索文件,并且找到的文件将与条目一起存储。如果找不到文件或无法打开该文件,则不创建任何条目并返回 0。如果找到该文件,则其时间/日期和文件大小将与条目一起存储,并为该条目分配一个唯一的索引并返回。 可以使用此方法通过将 noIncrement 设置为 来重新创建一组条目。这样可以防止在 FDL 中已有条目时增加引用计数。如果 noIncrement 设置为 ,则可以多次添加同一条目。在这种情况下,条目的引用计数递增,以记录该条目在 FDL 中被引用的次数。从不创建重复的记录。TrueFalse 例子VBA: Sub Example_CreateEntry()
    ' This example adds an entry to the File Dependency List, returns its Index, updates
    ' the entry, and then removes the entry.
    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency
    
    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."
    
    Dim FDLIndex As Long
    FDLIndex = objFDLCol.CreateEntry("acad:xref", "c:\referenced.dwg", True, True)
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."
    
    Dim IndexNumber As Long
    IndexNumber = objFDLCol.IndexOf("acad:xref", "c:\referenced.dwg")
    Dim IndexString As String
    IndexString = CStr(IndexNumber)
    MsgBox "The index of the new entry is " & IndexString & "."
    
    objFDLCol.UpdateEntry FDLIndex
    
    objFDLCol.RemoveEntry FDLIndex, True
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."
End Sub
 
  可视化 LISP: (vl-load-com)
(defun c:Example_CreateEntry()
    ;; This example adds an entry to the File Dependency List, returns its Index, updates
    ;; the entry, and then removes the entry.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
    
    (setq FDLIndex (vla-CreateEntry objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Wall Base.dwg") :vlax-true :vlax-true))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
    
    (setq IndexNumber (vla-IndexOf objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Wall Base.dwg")))
    (setq IndexString (itoa IndexNumber))
    (alert (strcat "The index of the new entry is " IndexString "."))
    
    (vla-UpdateEntry objFDLCol FDLIndex)
    
    (vla-RemoveEntry objFDLCol FDLIndex :vlax-true)
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
)
 
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 19:05
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.