The e-Trasmit API is exposed using COM (AcETransmit18.tlb) and so, you will first need to create an inter-op assembly for use in your .Net project. You can add reference from the COM tab and select “Transmittal 18.0 Type Library” in which case Visual Studio will create the inter-op assembly. The other way is to create it yourself using the type library importer tool and add reference to the generated inter-op assembly. Now, you are all set to use the e-Transmit API.
Here is a sample code :
using TRANSMITTALLib;
[CommandMethod("eTransmitRef")]
static public void TestMethod()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
TransmittalFile tf;
TransmittalOperation to = new TransmittalOperation();
// Path of the drawing file for which we need
// the external references
string dwgFile = @"C:\Temp\Test2013.dwg";
if (to.addDrawingFile(dwgFile, out tf)
== AddFileReturnVal.eFileAdded)
{
TransmittalFilesGraph tfg = to.graphInterfacePtr();
TransmittalFile rootTF = tfg.getRoot();
List<TransmittalFile> tfList = new List<TransmittalFile>();
tfList.Add(rootTF);
while (tfList.Count > 0)
{
tf = tfList[0];
tfList.RemoveAt(0);
int numberOfDependents = tf.numberOfDependents;
for (int i = 0; i < numberOfDependents; ++i)
{
TransmittalFile childTF = tf.getDependent(i);
tfList.Add(childTF);
string sourcePath = childTF.sourcePath;
ed.WriteMessage(Environment.NewLine + sourcePath);
}
}
}
}

Leave a Reply