Including fonts and other files using eTransmit API

<?xml encoding=”UTF-8″>By Balaji Ramamoorthy

Recently one of my colleague from Product support enquired if it was possible to find fonts and shape files included in a drawing using the eTransmit API. To configure what gets included as dependents when a drawing is added to the TransmittalOperation, it is required to setup the TransmittalInfo.

Here is a sample code that should also fetch the fonts and shape files associated with a drawing using e-Transmit API :

 <span>//AcETransmit19.Interop.dll</span><span> </span>
 <span>using</span><span>  AcETransmit;</span>
 
 [CommandMethod(<span>"DependentFiles"</span><span> )]</span>
 <span>static</span><span>  <span>public</span><span>  <span>void</span><span>  DependentFilesMethod()</span></span></span>
 <span>{</span>
     TransmittalFile tf;
     TransmittalOperation  to 
                 = <span>new</span><span>  TransmittalOperation();</span>
     TransmittalInfo ti 
                 = to.getTransmittalInfoInterface();
     ti.includeDataLinkFile = 1;
     ti.includeDGNUnderlay = 1;
     ti.includeDWFUnderlay = 1;
     ti.includeFontFile  = 1;
     ti.includeImageFile  = 1;
     ti.includeInventorProjectFile  = 1;
     ti.includeInventorReferences  = 1;
     ti.includeMaterialTextureFile  = 1;
     ti.includeNestedOverlayXrefDwg = 1;
     ti.includePDFUnderlay  = 1;
     ti.includePhotometricWebFile  = 1;
     ti.includePlotFile = 1;
     ti.includeUnloadedXrefDwg  = 1;
     ti.includeXrefDwg = 1;
  
     <span>string</span><span>  dwgFile = <span>@"D:\Temp\Sample.dwg"</span><span> ;</span></span>
     <span>if</span><span>  (to.addDrawingFile(dwgFile, <span>out</span><span>  tf) </span></span>
                 == AddFileReturnVal.eFileAdded)
     <span>{</span>
 
         TransmittalFilesGraph tfg 
                 = to.graphInterfacePtr();
 
         TransmittalFile rootTF = tfg.getRoot();
 
         DisplayDependent(rootTF);
     <span>}</span>
 <span>}</span>
 
 <span>static</span><span>  <span>void</span><span>  DisplayDependent(TransmittalFile tf)</span></span>
 <span>{</span>
     <span>int</span><span>  numberOfDependents = tf.numberOfDependents;</span>
     <span>for</span><span>  (<span>int</span><span>  i = 0; i < numberOfDependents; ++i)</span></span>
     <span>{</span>
         TransmittalFile childTF = tf.getDependent(i);
 
         FileType ft = childTF.FileType;
 
         <span>string</span><span>  sourcePath = childTF.sourcePath;</span>
 
         Application.DocumentManager.MdiActiveDocument.Editor
                             .WriteMessage(String.Format(
                             <span>"<span>{</span>0<span>}</span> Dependent <span>{</span>1<span>}</span> - <span>{</span>2<span>}</span>"</span><span> , </span>
                             Environment.NewLine, 
                                 ft.ToString(), sourcePath));
 
         DisplayDependent(childTF);
     <span>}</span>
 <span>}</span>
 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading