title: using eTransmit in Forge
body: <p>We are currently developing an application with the Forge Platform.
  The input file should be a Revit file and the output should be the result, as if a project was converted with the Revit addin eTransmit.
  The classes eTransmit, TransmissionOptions and TransmissionGraph are used.
  Unfortunately, the function of the eTransmit class &quot;TransmitFiles&quot; always returns the value &quot;False&quot;. The output file remains unchanged.
  To get the app running, the eTransmitForRevitDB.dll also had to be uploaded to Forge with the compiled addin dlls.
  Because eTransmit does not run on an open Revit project, I used the example of &quot;learn.forge.designautomation&quot; to implement the Revit file input/output.
  I searched in the forum and found nothing.
  Is it possible to use the eTransmit dll in Forge?
  What could be the problem?
  Here below is the code.
  Thanks a lot!</p>
  <pre><code>using DesignAutomationFramework;
  using Newtonsoft.Json;
  using System.Collections.Generic;
  using System;
  using System.IO;
  using eTransmitForRevitDB;
  using System.Diagnostics;
  
  namespace Autodesk.Forge.Sample.DesignAutomation.Revit.transFile
  {
      [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
      [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
      public class Commands : IExternalDBApplication
      {
          //Path of the project(i.e)project where your Window family files are present
          string OUTPUT_FILE = &quot;outputFile.rvt&quot;;
          string output = &quot;&quot;;
  
          public ExternalDBApplicationResult OnStartup(ControlledApplication application)
          {
              DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent;
              return ExternalDBApplicationResult.Succeeded;
          }
  
          private void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e)
          {
              LogTrace(&quot;Design Automation Ready event triggered...&quot;);
              e.Succeeded = true;
              LogTrace(&quot;Handle event...&quot;);
              TransmitFile(e.DesignAutomationData);
          }
  
          private void TransmitFile(DesignAutomationData data)
          {
              Document doc = data.RevitDoc;
              Application rvtApp = data.RevitApp;
              LogTrace(&quot;TransmitFile function...&quot;);
              //Open transaction
              using (Transaction trans = new Transaction(doc))
              {
                  trans.Start(&quot;transmit file&quot;);
                  
                  eTransmit eTran = new eTransmit(rvtApp);
                  UpgradeOptions upgradeSettings = new UpgradeOptions();
                  upgradeSettings.PurgeUnused = true;
                  upgradeSettings.DeleteSheets = true;
                  
                  IEnumerable&lt;ModelPath&gt; modelPaths;
                  List&lt;ModelPath&gt; modelPathList = new List&lt;ModelPath&gt;();
                  modelPathList.Add((ModelPath)new FilePath(doc.PathName)); 
                  modelPaths = (IEnumerable&lt;ModelPath&gt;)modelPathList;
                                                  
                  LogTrace(&quot;Doc-Pathname: &quot; + doc.PathName);
                  string filename = Path.GetFileName(doc.PathName);
                  string filedirectory = Path.GetDirectoryName(doc.PathName);
                  LogTrace(&quot;Filename: &quot; + filename);
                  LogTrace(&quot;filedirectory: &quot; + filedirectory);
  
                  LogTrace(&quot;check input file readtransmission&quot;);
                  ModelPath modelPathInput = ModelPathUtils.ConvertUserVisiblePathToModelPath(doc.PathName);
                  TransmissionData transData = (TransmissionData)null;
                  try
                  {
                      transData = TransmissionData.ReadTransmissionData(modelPathInput);
                  }
                  catch (Exception transDataEx)
                  {
                      LogTrace(&quot;eTransmit - Source Err:  &quot; + transDataEx.Message);
                  }
  
                  
                  output = Path.Combine(filedirectory, OUTPUT_FILE);
                  LogTrace(&quot;output: &quot; + output);
  
                  LogTrace(&quot;check output file readtransmission&quot;);
                  TransmissionData transmissionData = (TransmissionData)null;
                  ModelPath modelPathOutput = ModelPathUtils.ConvertUserVisiblePathToModelPath(output);
                  try
                  {
                      transmissionData = new TransmissionData(TransmissionData.ReadTransmissionData(modelPathOutput));
                  }
                  catch (Exception ex)
                  {
                      LogTrace(&quot;eTransmit - Dest Err :  &quot; + ex.Message + &quot;--&quot;);
                  }
  
                  TransmissionOptions eTranO = new TransmissionOptions(modelPaths, filedirectory, null, true, upgradeSettings, null, false);
                  eTranO.PurgeUnused = true;
                  eTranO.OpenAndUpgrade = true;
                  eTranO.DeleteSheets = true;
                  eTranO.MultipleOutputDirectories = false;
  
                  TransmissionGraph eTranG = new TransmissionGraph(modelPathInput, eTranO);
                  LogTrace(&quot;GraphCount... &quot; + eTranG.Count.ToString());
  
                  try
                  {
                      bool res = eTran.TransmitFiles(eTranG, eTranO, new TransmissionCallbackHandler());
                      LogTrace(&quot;eTransmit-Result: &quot; + res);
                  }
                  catch (Exception ex1)
                  {
                      LogTrace(&quot;eTransmit - Err:  &quot; + ex1.Message);
                  }
  
                  trans.Commit();
              }
              LogTrace(&quot;saving...&quot;);
              //Save the updated file by overwriting the existing file
              ModelPath ProjectModelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(output);
              SaveAsOptions SAO = new SaveAsOptions();
              SAO.OverwriteExistingFile = true;
  
              //Save the project file with updated window's parameters
              LogTrace(&quot;Saving file...&quot;);
              doc.SaveAs(ProjectModelPath, SAO);
          }
  
  
          public ExternalDBApplicationResult OnShutdown(ControlledApplication application)
          {
              return ExternalDBApplicationResult.Succeeded;
          }
  
          private void SetElementParameter(FamilySymbol FamSym, BuiltInParameter paraMeter, double parameterValue)
          {
              FamSym.get_Parameter(paraMeter).Set(parameterValue);
          }
  
          public class InputParams
          {
              public double Width { get; set; }
              public double Height { get; set; }
          }
  
          /// &lt;summary&gt;
          /// This will appear on the Design Automation output
          /// &lt;/summary&gt;
          private static void LogTrace(string format, params object[] args) { System.Console.WriteLine(format, args); }
      }
  }
  </code></pre>