CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

关于将文件添加到传递集 (ActiveX/ATO)

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

关于将文件添加到传递集 (ActiveX/ATO)

可以将图形和与项目相关的其他文件添加到传输集中。

可以将存储在本地或网络驱动器上的图形 (DWG) 文件添加到传输集。对象的方法用于将图形文件添加到传递集。将图形文件添加到传递集时,传递引擎将逐步执行图形文件,以标识图形所引用的文件。每个引用的文件都会添加到传输集中。用于查找参照文件的路径来自参照文件的图形和传递集的对象。addDrawingFile()TransmittalOperationTransmittalInfo

下面显示了如何将图形文件添加到传递集:

VB.NET
' Defines the file to add to the transmittal set
Dim tf As TransmittalFile = Nothing
Dim dwgFile As String = "C:\Architectural\A-01.dwg"

' Adds the drawing file to the transmittal set
tro.addDrawingFile(dwgFile, tf)
C#
// Defines the file to add to the transmittal set
TransmittalFile tf = null;
string dwgFile = "C:\\Architectural\\A-01.dwg";

// Adds the drawing file to the transmittal set
tro.addDrawingFile(dwgFile, out tf);
VBA的
' Defines the file to add to the transmittal set
Dim tf As TransmittalFile
Dim dwgFile As String
dwgFile = "C:\Architectural\A-01.dwg"

' Adds the drawing file to the transmittal set
tro.addDrawingFile dwgFile, tf

从图纸集添加图形文件

除了将单个图形文件添加到传递集之外,还可以使用对象的 、 和 方法将图纸集 (DST) 文件参照的图形文件添加到传递集中。使用 DST 文件时,必须引用存储在 acsmcomponents<version>.tlb 文件中的图纸集管理器 API。archiveSheetSet()addSheets()addSheetSelSet()TransmittalOperation

注意:<version> 替换为目标 AutoCAD 版本使用的图纸集管理器 API 的版本号。
VB.NET
' Add a sheet set and the drawings files it references to a transmittal set
' Gets a new instance of the Sheet Set Manager object
Dim sheetSetManager As IAcSmSheetSetMgr = New AcSmSheetSetMgr
Dim sheetSetFile as String = "C:\Architectural\Project.dst"

' Opens a sheet set (DST) file in memory
Dim sheetSetDatabase As AcSmDatabase = _
    sheetSetManager.OpenDatabase(sheetSetFile, False)

' Gets the sheet set from the database and processes it
tro.archiveSheetSet(sheetSetDatabase.GetSheetSet(), vbTrue)

' Closes the sheet set
sheetSetManager.Close(sheetSetDatabase)
C#
// Add a sheet set and the drawings files it references to a transmittal set
// Gets a new instance of the Sheet Set Manager object
IAcSmSheetSetMgr sheetSetManagerSS = new AcSmSheetSetMgr();
string sheetSetFile = "C:\\Architectural\\Project.dst";

// Opens a sheet set (DST) file in memory
AcSmDatabase sheetSetDatabaseSS = sheetSetManagerSS.OpenDatabase(sheetSetFile, false);

// Gets the sheet set from the database and processes it
tro.archiveSheetSet(sheetSetDatabaseSS.GetSheetSet(), 1);

// Closes the sheet set
sheetSetManagerSS.Close(sheetSetDatabaseSS);
VBA的
' Add a sheet set and the drawings files it references to a transmittal set
' Gets a new instance of the Sheet Set Manager object
Dim sheetSetManager As New IAcSmSheetSetMgr
Dim sheetSetFile as String
sheetSetFile = "C:\Architectural\Project.dst"

' Opens a sheet set (DST) file in memory
Dim sheetSetDatabase As AcSmDatabase
Set sheetSetDatabase = sheetSetManager.OpenDatabase sheetSetFile, False

' Gets the sheet set from the database and processes it
tro.archiveSheetSet sheetSetDatabase.GetSheetSet, vbTrue

' Closes the sheet set
sheetSetManager.Close sheetSetDatabase

添加其他文件

图形以外的文件和图形文件所参照的文件可以添加到传输集中。例如,您可以添加一个电子表格,其中包含图形中使用的标准图层列表及其用途,甚至可以添加一个包含常规项目注释的文字处理器文档。对象的方法用于将文件添加到传递集。addFile()TransmittalOperation

VB.NET
' Gets a reference to the transmittal set's file graph and its root node
Dim tfg As TransmittalFilesGraph = tro.graphInterfacePtr()
Dim rootTF As TransmittalFile = tfg.getRoot()

' Defines the file to add to the transmittal set
Dim tf As TransmittalFile = Nothing
Dim file As String = "C:\Standards\layer_list.xls"

' Adds the file to the transmittal set
tro.addFile(file, rootTF, vbFalse, tf)
C#
// Gets a reference to the transmittal set's file graph and its root node
TransmittalFilesGraph tfg = tro.graphInterfacePtr();
TransmittalFile rootTF = tfg.getRoot();

// Defines the file to add to the transmittal set
TransmittalFile tf = null;
string file = "C:\\Standards\\layer_list.xls";

// Adds the file to the transmittal set
tro.addFile(file, rootTF, false, out tf);
VBA的
' Gets a reference to the transmittal set's file graph and its root node
Dim tfg As TransmittalFilesGraph
Set tfg = tro.graphInterfacePtr

Dim rootTF As TransmittalFile
Set rootTF = tfg.getRoot

' Defines the file to add to the transmittal set
Dim tf As TransmittalFile
Dim file As String
file = "C:\Standards\layer_list.xls"

' Adds the file to the transmittal set
tro.addFile file, rootTF, vbFalse, tf

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 22:21

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部