CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

TotalBytes Property (ActiveX/ATO)

2023-1-1 20:53| 发布者: admin| 查看: 1766| 评论: 0|来自: AutoCAD

摘要: 返回传递集中所有文件的总大小(以字节为单位)。

返回传递集中所有文件的总大小(以字节为单位)。

支持的平台:仅窗口

Namespace:传输利布

组装:acETransmit20.tlb

签名

VBA/VB.NET:

object.totalBytes(bIncludedFilesOnly)

C#:

object.get_totalBytes(bIncludedFilesOnly);
对象

类型:传递文件图形

此属性适用的对象。

b仅包含文件

访问:仅输入

类型:整数

  • 0 (): 传递图中所有文件的文件大小相加False
  • 1 (): 将传递集中所有文件的文件大小相加,谁属性设置为TrueIncludeInTransmittalTrue

属性值

只读:是的

类型:不支持的变体类型

所有文件的总字节数。

言论

没有额外的评论。

发布信息

释放:AutoCAD 2004 及更高版本

历史

  • 该界面与 AutoCAD 2010 版本的库中的界面合并。ITransmittalFilesGraph2ITransmittalFilesGraph
  • 该属性也随 AutoCAD 2005 版本的库中的界面一起引入。totalBytesITransmittalFilesGraph2
  • 该属性最初是在 AutoCAD 2004 版本的库中随界面一起引入的,但标记为仅供 Autodesk 内部使用。totalBytesITransmittalFilesGraph

例子

VB.NET:

' Custom command that lists the file dependents
<CommandMethod("FileDependents")> _
Public Shared Sub FileDependents()
    ' 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 each of the referenced files in the file being added
        Dim tfg As TransmittalFilesGraph = tro.graphInterfacePtr()
        Dim rootTF As TransmittalFile = tfg.getRoot()

        ' Get the current editor
        Dim acEditor As Editor = Application.DocumentManager.MdiActiveDocument.Editor

        ' Output information about the overall size of the files in the transmittal graph
        acEditor.WriteMessage(Environment.NewLine & "Total Bytes: " & tfg.totalBytes(vbTrue).ToString())

        Dim tfList As New List(Of TransmittalFile)()
        tfList.Add(rootTF)

        ' Step through each of the referenced files identified
        While tfList.Count > 0
            tf = tfList(0)
            tfList.RemoveAt(0)

            Dim numberOfDependents As Integer = tf.numberOfDependents
            For i As Integer = 0 To numberOfDependents - 1
                Dim childTF As TransmittalFile = tf.getDependent(i)
                tfList.Add(childTF)

                ' Output the source path of the child in the transmittal graph
                acEditor.WriteMessage(Environment.NewLine + "Dependent file name: " & childTF.sourcePath)

                ' See if the dependent file is a drawing or not
                If System.IO.Path.GetExtension(childTF.sourcePath).ToUpper() = ".DWG" Then
                    ' Get the database of the drawing
                    Dim acDb As AcadDatabase = childTF.database

                    ' If the drawing is not null, display the name sof the layers in the drawing
                    If Not acDb Is Nothing Then
                        acEditor.WriteMessage(Environment.NewLine & "Layer Names:")

                        ' Step through each of the layers
                        For Each acLyr As AcadLayer In acDb.Layers
                            ' Output the names of each layer
                            acEditor.WriteMessage(Environment.NewLine & "  " & acLyr.Name)
                        Next
                    End If
                End If
            Next
        End While
    End If
End Sub

C#:

// Custom command that lists the file dependents
[CommandMethod("FileDependents")]
public static void FileDependents()
{
    // 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 each of the referenced files in the file being added
        TransmittalFilesGraph tfg = tro.graphInterfacePtr();
        TransmittalFile rootTF = tfg.getRoot();

        // Get the current editor
        Editor acEditor = Application.DocumentManager.MdiActiveDocument.Editor;

        // Output information about the overall size of the files in the transmittal graph
        acEditor.WriteMessage(Environment.NewLine + "Total Bytes: " + tfg.get_totalBytes(1).ToString());

        List<TransmittalFile> tfList = new List<TransmittalFile>();
        tfList.Add(rootTF);

        // Step through each of the referenced files identified
        while (tfList.Count > 0)
        {
            tf = tfList[0];
            tfList.RemoveAt(0);

            int numberOfDependents = tf.numberOfDependents;
            for (int i = 0; i <= numberOfDependents - 1; i++)
            {
                TransmittalFile childTF = tf.getDependent(i);
                tfList.Add(childTF);

                // Get the current editor
                acEditor.WriteMessage(Environment.NewLine + "Dependent file name: " + childTF.sourcePath);

                // See if the dependent file is a drawing or not
                if (System.IO.Path.GetExtension(childTF.sourcePath).ToUpper() == ".DWG")
                {
                    // Get the database of the drawing
                    AcadDatabase acDb = childTF.database;

                    // If the drawing is not null, display the name sof the layers in the drawing
                    if (acDb != null)
                    {
                        acEditor.WriteMessage(Environment.NewLine + "Layer Names:");

                        // Sstep through each of the layers
                        foreach (AcadLayer acLyr in acDb.Layers)
                        {
                            // Output the names of each layer
                            acEditor.WriteMessage(Environment.NewLine + "  " + acLyr.Name);
                        }
                    }
                }
            }
        }
    }
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 13:23

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部