CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2018 开发者帮助

GetDependee 方法 (ActiveX/ATO)

2024-5-18 16:56| 发布者: admin| 查看: 11| 评论: 0|原作者: admin|来自: AutoCAD

GetDependee 方法 (ActiveX/ATO)

返回指定索引处的文件的依赖对象。

支持的平台:仅限 Windows

命名空间:传输塔利布

集会:AcETransmit19.tlb

签名

VB.NET:

RetVal = object.getDependee(nIndex)

C#:

RetVal = object.getDependee(nIndex);
对象

类型:TransmittalFile 对象

此方法应用到的对象。

n索引

访问:仅输入

类型:

要检索的依赖文件的索引。

返回值 (RetVal)

类型:TransmittalFile 对象

指定索引处的 dependee 文件。

言论

没有其他评论。

发行信息

释放:AutoCAD 2005 及更高版本

  • AcETransmit19.tlb - AutoCAD 2015 及更高版本
  • AcETransmit18.tlb - AutoCAD 2010 到 AutoCAD 2014
    • 该界面已与 AutoCAD 2010 版库中的界面合并。ITransmittalFile2ITransmittalFile
  • AcETransmit16.tlb - AutoCAD 2005 到 AutoCAD 2009
    • 该方法是在 AutoCAD 2005 版本的库中引入的。getDependeeITransmittalFile2

例子

VB.NET:

' Custom command that displays information about a file
<CommandMethod("FileInfo")> _
Public Shared Sub FileInfo()
    ' Create a transmittal operation
    Dim tro As TransmittalOperation = New TransmittalOperation()

    ' Setup the transmittal behavior
    Dim ti As TransmittalInfo = TransInfo(tro.getTransmittalInfoInterface(), _
                                          "C:\Users\Public\TransmittalAPITest\")

    ' Define file to add to the transmittal
    Dim tf As TransmittalFile = Nothing
    Dim dwgFile As String = "C:\AutoCAD\Sample\Sheet Sets\Architectural\A-01.dwg"

    ' Add file to transmittal and parse its information
    If tro.addDrawingFile(dwgFile, tf) = AddFileReturnVal.eFileAdded Then
        ' Get the current editor
        Dim acEditor As Editor = Application.DocumentManager.MdiActiveDocument.Editor

        ' Output information about the file in the transmittal set
        ' Source and full target path to the file
        acEditor.WriteMessage(Environment.NewLine & "Source Path: " & tf.sourcePath)
        acEditor.WriteMessage(Environment.NewLine & "Full Path: " & tf.fullPathForTarget)
        acEditor.WriteMessage(Environment.NewLine & "Target SubPath: " & tf.targetSubPath)

        ' See if the file is a drawing
        If System.IO.Path.GetExtension(tf.sourcePath).ToUpper() = ".DWG" Then
            ' Number of dependents and dependees
            acEditor.WriteMessage(Environment.NewLine & "# of Dependents: " & tf.numberOfDependents.ToString())
            acEditor.WriteMessage(Environment.NewLine & "# of Dependees: " & tf.numberOfDependees.ToString())

            ' Get the first dependent of the drawing
            If tf.numberOfDependents > 0 Then
                acEditor.WriteMessage(Environment.NewLine & "Name of First Dependent: " & tf.getDependent(0).sourcePath)
            Else
                acEditor.WriteMessage(Environment.NewLine & "No dependents")
            End If

            ' Get the first dependee of the drawing
            If tf.numberOfDependees > 0 Then
                acEditor.WriteMessage(Environment.NewLine & "Name of First Dependee: " & tf.getDependee(0).sourcePath)
            Else
                acEditor.WriteMessage(Environment.NewLine & "No dependees")
            End If
        End If

        ' Output file system information about the file
        acEditor.WriteMessage(Environment.NewLine & "File Exists: " & tf.fileExists.ToString())
        acEditor.WriteMessage(Environment.NewLine & "File Size: " & tf.fileSize.ToString())
        acEditor.WriteMessage(Environment.NewLine & "File Type: " & tf.FileType.ToString())
        acEditor.WriteMessage(Environment.NewLine & "Include in transmittal: " & tf.includeInTransmittal.ToString())
        acEditor.WriteMessage(Environment.NewLine & "Date/Time: " & tf.lastModifiedTime.ToLongDateString() & "  " &
                                                                    tf.lastModifiedTime.ToLongTimeString())
        acEditor.WriteMessage(Environment.NewLine & "Type: " & tf.type.ToString())
        acEditor.WriteMessage(Environment.NewLine & "Version: " & tf.version.ToString())
    End If
End Sub

C#:

// Custom command that displays information about a file
[CommandMethod("FileInfo")]
public static void FileInfo()
{
    // Create a transmittal operation
    TransmittalOperation tro = new TransmittalOperation();

    // Setup the transmittal behavior
    TransmittalInfo ti = TransInfo(tro.getTransmittalInfoInterface(),
                                   @"C:\Users\Public\TransmittalAPITest\");

    // Define file to add to the transmittal
    TransmittalFile tf = null;
    string dwgFile = @"C:\AutoCAD\Sample\Sheet Sets\Architectural\A-01.dwg";

    // Add file to transmittal and parse its information
    if (tro.addDrawingFile(dwgFile, out tf) == AddFileReturnVal.eFileAdded)
    {
        // Get the current editor
        Editor acEditor = Application.DocumentManager.MdiActiveDocument.Editor;

        // Output information about the root file of the transmittal set
        // Source and full target path to the file
        acEditor.WriteMessage(Environment.NewLine + "Source Path: " + tf.sourcePath);
        acEditor.WriteMessage(Environment.NewLine + "Full Path: " + tf.fullPathForTarget);
        acEditor.WriteMessage(Environment.NewLine + "Target SubPath: " + tf.targetSubPath);

        // See if the root file is a drawing
        if (Path.GetExtension(tf.sourcePath).ToUpper() == ".DWG")
        {
            // Number of dependents and dependees
            acEditor.WriteMessage(Environment.NewLine + "# of Dependents: " + tf.numberOfDependents.ToString());
            acEditor.WriteMessage(Environment.NewLine + "# of Dependees: " + tf.numberOfDependees.ToString());

            // Get the first dependent of the drawing
            if(tf.numberOfDependents > 0)
            {
                acEditor.WriteMessage(Environment.NewLine + "Name of First Dependent: " + tf.getDependent(0).sourcePath);
            } else {
                acEditor.WriteMessage(Environment.NewLine + "No dependents");
            }

            // Get the first dependee of the drawing
            if (tf.numberOfDependees > 0)
            {
                acEditor.WriteMessage(Environment.NewLine + "Name of First Dependee: " + tf.getDependee(0).sourcePath);
            }
            else
            {
                acEditor.WriteMessage(Environment.NewLine + "No dependees");
            }
        }

        // Output file system information about the root file
        acEditor.WriteMessage(Environment.NewLine + "File Exists: " + tf.fileExists.ToString());
        acEditor.WriteMessage(Environment.NewLine + "File Size: " + tf.fileSize.ToString());
        acEditor.WriteMessage(Environment.NewLine + "File Type: " + tf.FileType.ToString());
        acEditor.WriteMessage(Environment.NewLine + "Include in transmittal: " + tf.includeInTransmittal.ToString());
        acEditor.WriteMessage(Environment.NewLine + "Date/Time: " + tf.lastModifiedTime.ToLongDateString() + "  " +
                                                                    tf.lastModifiedTime.ToLongTimeString());
        acEditor.WriteMessage(Environment.NewLine + "Type: " + tf.type.ToString());
        acEditor.WriteMessage(Environment.NewLine + "Version: " + tf.version.ToString());
    }
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-6-27 16:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部