CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

添加表方法 (ActiveX/ATO)

2023-1-1 23:03| 发布者: admin| 查看: 184| 评论: 0|来自: AutoCAD

摘要: 将图纸集 (DST) 文件中的文件添加到传递集中。

将图纸集 (DST) 文件中的文件添加到传递集中。

支持的平台:仅窗口

Namespace:传输利布

组装:acETransmit20.tlb

签名

VB.NET:

object.addSheets sheets, includeSSFiles

C#:

object.addSheets(sheets, includeSSFiles);
对象

类型:传递操作对象

此方法适用的对象。

床单

访问:仅输入

类型:对象数组AcSmSheet

对象在库中定义。AcSmSheetAcSmComponents

包括SSFiles

访问:仅输入

类型:

  • 0 (): 不包括 DST 文件引用的图纸集 (DST) 和支持文件False
  • 1 (): 包括图纸集 (DST) 和 DST 文件引用的支持文件True

返回值(RetVal)

无返回值。

言论

没有额外的评论。

发布信息

释放:AutoCAD 2005 及更高版本

历史

  • 该界面与 AutoCAD 2010 版本的库中的界面合并。ITransmittalOperation2ITransmittalOperation
  • 该方法是在 AutoCAD 2005 版本的库中随界面一起引入的。addSheetsITransmittalOperation2

例子

VB.NET:

' Custom command to create a transmittal package from the sheets in a sheet set
<CommandMethod("eTransmitDSTFile_Sheets")> _
Public Shared Sub eTransmitDSTFile_Sheets()

    ' 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\")

    ' Add a sheet selection set from a sheet set and 
    ' the drawings contained in it
    ' Get a reference to the Sheet Set Manager object
    Dim sheetSetManager As IAcSmSheetSetMgr = New AcSmSheetSetMgr

    ' Open a Sheet Set file
    Dim sheetSetDatabase As AcSmDatabase = _
        sheetSetManager.OpenDatabase("C:\AutoCAD\Sample\Sheet Sets\Architectural\IRD Addition.dst", False)

    ' Get the enumerator for the objects in the 
    ' sheet set and then set the first object
    Dim enumerator As IAcSmEnumPersist = sheetSetDatabase.GetEnumerator()
    Dim itemSheetSet As IAcSmPersist = enumerator.Next()

    Dim sheetNames(0) As String
    Dim sheetSetSelOrSheetName As String = "T-01 TITLE SHEET;A-01 MAIN AND SECOND FLOOR PLAN"

    ' Semi-colon detected, multiple sheet names are being passed 
    If sheetSetSelOrSheetName.Contains(";") = True Then
        sheetNames = sheetSetSelOrSheetName.Split(";")
    Else
        sheetNames(0) = sheetSetSelOrSheetName
    End If

    ' Create an array of the sheets based on their names
    Dim sheetArray(0) As IAcSmObjectId
    Dim sheet As AcSmSheet, nCount As Integer = 0

    ' Step through the objects in the sheet set
    Do While Not itemSheetSet Is Nothing

        ' Check to see if the object is a Sheet
        If itemSheetSet.GetTypeName() = "AcSmSheet" Then

            ' A sheet was found, now to see if it is the one needed
            sheet = itemSheetSet

            ' Step through each name provided
            For Each sheetName As String In sheetNames

                ' Check to see if the sheet name matches the sheet
                If UCase(sheet.GetName()).Equals(UCase(sheetName)) = True Then
                    ReDim Preserve sheetArray(0 To nCount)

                    ' Match was found, add the sheet's object Id to the array
                    sheetArray(nCount) = sheet.GetObjectId()

                    ' Increment the counter by 1
                    nCount = nCount + 1
                End If
            Next
        End If

        ' Get the next object
        itemSheetSet = enumerator.Next()
    Loop

    ' Get the sheets from the database and process them
    ' 0 - Do not include DST file or support files referenced 
    '     by the DST file (templates, blocks, ...)
    ' 1 - Include DST file, all files referenced by the 
    '     DST file, its sheets and references
    If sheetArray.Length > 0 And sheetArray(0).Equals("") = False Then
        tro.addSheets(sheetArray, vbTrue)
    End If

    ' Close the sheet set
    sheetSetManager.Close(sheetSetDatabase)

    ' Create the transmittal package
    ' Files are copied and resaved to the path specified by the destinationRoot property
    ' and the other settings of the TransmittalInfo object.
    tro.createTransmittalPackage()
End Sub

C#:

// Custom command to create a transmittal package from the sheets in a sheet set
[CommandMethod("eTransmitDSTFile_Sheets")]
public static void eTransmitDSTFile_Sheets()
{
    // Create a transmittal operation
    TransmittalOperation tro = new TransmittalOperation();

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

    // Add a sheet set and the drawings referenced in it
    // Get a reference to the Sheet Set Manager object
    IAcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr();

    // Open a sheet set (DST) file
    AcSmDatabase sheetSetDatabase =
        sheetSetManager.OpenDatabase("C:\\AutoCAD\\Sample\\Sheet Sets\\Architectural\\IRD Addition.dst", false);

    // Get the enumerator for the objects in the 
    // sheet set and then set the first object
    IAcSmEnumPersist enumerator = sheetSetDatabase.GetEnumerator();
    IAcSmPersist itemSheetSet = enumerator.Next();

    string[] sheetNames = new string[1];
    string sheetSetSelOrSheetName = "T-01 TITLE SHEET;A-01 MAIN AND SECOND FLOOR PLAN";

    // Semi-colon detected, multiple sheet names are being passed 
    if (sheetSetSelOrSheetName.Contains(";") == true)
    {
        sheetNames = sheetSetSelOrSheetName.Split(';');
    }
    else
    {
        sheetNames[0] = sheetSetSelOrSheetName;
    }

    // Create an array of the sheets based on their names
    IAcSmObjectId[] sheetArray = new IAcSmObjectId[1];
    AcSmSheet sheet = default(AcSmSheet);
    int nCount = 0;

    // Step through the objects in the sheet set
    while (itemSheetSet != null)
    {
        // Check to see if the object is a Sheet
        if (itemSheetSet.GetTypeName() == "AcSmSheet")
        {
            // A sheet was found, now to see if it is the one needed
            sheet = (AcSmSheet)itemSheetSet;

            // Step through each name provided
            foreach (string sheetName in sheetNames)
            {
                // Check to see if the sheet name matches the sheet
                if (sheet.GetName().ToUpper().Equals(sheetName.ToUpper()) == true)
                {
                    Array.Resize(ref sheetArray, nCount + 1);

                    // Match was found, add the sheet's object Id to the array
                    sheetArray[nCount] = sheet.GetObjectId();

                    // Increment the counter by 1
                    nCount = nCount + 1;
                }
            }
        }

        // Get the next object
        itemSheetSet = enumerator.Next();
    }

    // Get the sheets from the database and process them
    // 0 - Do not include DST file or support files referenced 
    //     by the DST file (templates, blocks, ...)
    // 1 - Include DST file, all files referenced by the 
    //     DST file, its sheets and references
    if (sheetArray.Length > 0 & sheetArray[0].Equals("") == false)
    {
        tro.addSheets(sheetArray, 1);
    }

    // Close the sheet set
    sheetSetManager.Close(sheetSetDatabase);

    // Create the transmittal package
    // Files are copied and resaved to the path specified by the destinationRoot property
    // and the other settings of the TransmittalInfo object.
    tro.createTransmittalPackage();
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 04:39

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部