CreateEntry Method (ActiveX)

Creates a new entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.CreateEntry Feature, FullFileName, AffectsGraphics, noIncrement
object

Type: FileDependencies

The object this method applies to.

Feature

Access: Input-only

Type: String

Description of the application or feature creating the entry.

FullFileName

Access: Input-only

Type: String

Name of the file to be stored in the File Dependency List (must be an existing file).

AffectsGraphics

Access: Input-only

Type: Boolean

True means that the entry affects the on-screen view of the drawing file, specifically the graphics cache; false means it does not affect the on-screen view.

noIncrement

Access:Input-only

Type: Boolean

True does not increment the reference count on existing entries; false increments the reference count when an existing entry is added.

Return Value (RetVal)

No return value.

Remarks

This method takes a string indicating a feature description. The string is stored with the File Dependency List (FDL) entry and identifies the application or feature that created this entry, such as Acad::xref. No unique-application-name checking is done on the feature string. This method also takes a parameter to indicate the name of the file stored in the FDL, and the stored path, if any, can be included.

If no path is included, AutoCAD searches for the file in the current directory and the AutoCAD support file search path, and the found is stored with the entry. If the file cannot be found or if it cannot be opened, no entry is created and 0 is returned. If the file is found, its time/date and file size are stored with the entry, and a unique index is assigned to the entry and is returned.

You can use this method to recreate a set of entries by setting noIncrement to True. This prevents the increment of the reference count when an entry already is in the FDL. If noIncrement is set to False, then the same entry can be added multiple times. In this case, the reference count is incremented for the entry to record the number of times the entry is referenced in the FDL. Duplicate records are never created.

Examples

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

Visual 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)) "."))
)