Navis CLI

In this post we will investigate how to launch a command in Navis from command line. The command will open a .nwf file (previously created) run the clash detective and export the results to a .csv file. The intent is to display the results in a dashboard in PowerBI.

We will start by coding the command behaviour.

To start, we need to use an AddInPlugin class which is a base class for adding an executable plugin to Navisworks and optionally the User Interface.

using System;
using System.IO;
using System.Text;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Clash;
using Autodesk.Navisworks.Api.Plugins;

namespace NavisAutomate
{
    [Plugin("NavisAutomate.ClashRunner", "RABJ", DisplayName = "ClashRunner")]
    public class ClashRunner : AddInPlugin
    {
        public override int Execute(params string[] parameters)
        {
          ...
        }
    }
}

In our Execute method the logic is pretty straightforward:

            //System.Windows.Forms.MessageBox.Show("ClashRunner plugin loaded!"); //check the plugin is loaded. Remove if everything works
            string outputFile = @"C:\Temp\clashes.csv";
            try
            {
                
            DateTime startTime = DateTime.Now;

            Document doc = Application.ActiveDocument;

            DocumentClash documentClash = doc.GetClash();

            StringBuilder sb = new StringBuilder();

            foreach (ClashTest ctest in documentClash.TestsData.Tests)
                {
                        if (ctest is ClashTest clashTest)
                    {
                            foreach (ClashResult result in clashTest.Children)
                            {
                                if (result.Status == ClashResultStatus.Active)
                                {
                                    // Process clash
                                    sb.AppendLine($"{ctest.DisplayName},{result.DisplayName},{result.CreatedTime.ToString()},{result.Status.ToString()},{result.Description},{startTime}");
                                }
                            }
                        }
                }
                string headers = "Test Name,Result Name,Created Time,Status,Description,Data Exported";
                File.WriteAllText(outputFile, headers + "\n");

                File.AppendAllText(outputFile, sb.ToString());
                return 0; //Success
                }
                catch (Exception ex)
            {
                File.WriteAllText(outputFile, ex.Message);
                return -1; //Fail
            }

Compile the addin and saved it in Navis ProgramData plugin folder:

"C:\ProgramData\Autodesk\Navisworks Manage 2024\Plugins\NavisAutomate\NavisAutomate.dll"

The command line command follows the format below and the list of switches can be found here https://help.autodesk.com/view/NAV/2022/ENU/?guid=GUID-3891FB9F-7BF1-4510-A1EE-121E975C0ACE

  • path to Navis executable
  • switch -NoGui (Start Navis without user interface. This is a faster option when the user interface is not required)
  • switch -OpenFile
  • path to our file that contains the models for the clash detection
  • switch -ExecuteAddinPlugin
  • Plugin name + Developer ID or GUID (see AddInPlugin) If you have NavisLookup installed, you can find these values by selecting your plugin from the plugins records list:

    image

  • switch -Exit to close Navis

The resulting command line command in this case is:

C:\Program Files\Autodesk\Navisworks Manage 2024\roamer.exe -NoGui -OpenFile "C:\Documents\Clash Check.nwf" -ExecuteAddinPlugin "NavisAutomate.ClashRunner.RABJ" -Exit

Our command can accept parameters so instead of hardcoding the output path of our .csv file, we can pass it as a parameter in the command line:

C:\Program Files\Autodesk\Navisworks Manage 2024\roamer.exe -NoGui -OpenFile "C:\Documents\Clash Check.nwf" -ExecuteAddinPlugin "NavisAutomate.ClashRunner.RABJ" "C:\TEMP\clashes.csv" -Exit

BONUS

Revit External Command to export multiple 3d views to .nwc,

public class ExportNwc : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {

            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            string outputFolder = @"C:\Temp\Navis";

            if (!Directory.Exists(outputFolder))
                Directory.CreateDirectory(outputFolder);

            // Collect all 3D views
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            var views3D = collector.OfClass(typeof(View3D))
                                .Cast<View3D>()
                                .Where(v => !v.IsTemplate)  // Ignore view templates
                                .ToList();

            if (!views3D.Any())
            {
                TaskDialog.Show("Export", "No 3D views found.");
                return Result.Cancelled;
            }

            string errors = "";
            int results = 0;

             foreach (var view in views3D)
            {
            // Build output file path
            string fileName = Path.Combine(outputFolder, $"{view.Name}.nwd");

            // Set up Navisworks export options
            NavisworksExportOptions options = new NavisworksExportOptions
            {
                ExportScope = NavisworksExportScope.View,
                ExportLinks = false,
                ExportRoomGeometry = false,
                ViewId = view.Id
            };

            try
            {
                doc.Export(outputFolder, $"{view.Name}",options);
                results ++;
                //TaskDialog.Show("Export", $"Exported view: {view.Name}");
            }
            catch (Exception ex)
            {
                errors += ex.Message + Environment.NewLine;
                //TaskDialog.Show("Error", $"Failed to export view {view.Name}:\n{ex.Message}");
            }
        }
            TaskDialog.Show("Export", $"{results} view(s) exported");

            return Result.Succeeded;
        }
    }
Written on February 21, 2026