CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2025 开发者帮助

IndexOf 方法 (ActiveX)

2024-5-18 19:22| 发布者: admin| 查看: 83| 评论: 0|原作者: admin|来自: AutoCAD

IndexOf 方法 (ActiveX)

提供“文件依赖项列表”中条目的索引。(已过时)

支持的平台:仅限 Windows

签名

VBA:

RetVal = object.IndexOf(Feature, FullFileName)
对象

类型:FileDependencies

此方法应用到的对象。

特征

访问:仅输入

类型:字符串

条目的功能名称。

完整文件名

访问:仅输入

类型:字符串

条目的完整路径。

返回值 (RetVal)

类型:

条目的索引。

言论

没有其他评论。

发行信息

释放:AutoCAD 2000 到 AutoCAD 2017

例子

VBA:

Sub Example_IndexOf()
    'This example adds an entry to the File Dependency List, returns its Index, updates
    'the entry, and then removes the entry.
        
    ThisDrawing.Application.Documents.Open ("c:\program files\autocad\sample\city map.dwg")
    ThisDrawing.Application.ZoomAll
    
    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_IndexOf()
    ;; 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\\Exterior Elevations.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\\Exterior Elevations.dwg")))
    (alert (strcat "The index of the new entry is " (itoa IndexNumber) "."))
    
    (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)) "."))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 12:50

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部