CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

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

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

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

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

可以将存储在本地或网络驱动器上的图形 (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

注意:<版本>替换为目标 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

Add Other Files

Files other than drawings and those referenced by a drawing file can be added to a transmittal set. For example, you could add a spreadsheet that contains a list of standard layers used in your drawings and their purpose, or even a word processor document that contains general project notes. The method of the object is used to add a file to a transmittal set. 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 )

GMT+8, 2024-5-12 06:18

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部