Setting Appearance Profiler dat file via Navisworks API

By Naveen Kumar

Description: The Appearance Profiler allows you to set up custom appearance profiles based on sets (search and selection) and property values. You can use them to color-code objects in the model to differentiate system types and visually identify their status. It can be saved as .dat files and shared between other Autodesk Navisworks users.

Autodesk Navisworks 2023 provides a command for appearance profiles. You can use Navisworks automation API and plugin to set appearance profiler to multiple Navisworks files.

Sample Code:

class Program
{
[STAThread]
static void Main(string[] args)
{
String runtimeName = Resolver.TryBindToRuntime(RuntimeNames.NavisworksManage);
if (String.IsNullOrEmpty(runtimeName))
{
throw new Exception("Failed to bind to Navisworks runtime");
}
XMain();
}
private static void XMain()
{
NavisworksApplication navisApp = new NavisworksApplication();
navisApp.AppendFile(@"....InputFile.nwd");
navisApp.ExecuteAddInPlugin("AutoAppearanceLoader.Navisworks", @"....AppearanceProfiler.dat");
navisApp.SaveFile(@"....OutputFile.nwd");
navisApp.Dispose();
}
}

The command can also work within plugin:

Autodesk.Navisworks.Api.Application.Plugins.ExecuteAddInPlugin("AutoAppearanceLoader.Navisworks", "c:\temp\AppearanceProfiler .dat");

Comments

3 responses to “Setting Appearance Profiler dat file via Navisworks API”

  1. bara salah Avatar
    bara salah

    Thank you for the info great addition to Navisworks
    I Have an issue running built-in plugins from the Resolver in console app the plugins are not loaded and i can’t locate them to load them
    navisApp.ExecuteAddInPlugin(“NativeExportPluginAdaptor_LcDwfExporterPlugin_Export.Navisworks”, @”….\AppearanceProfiler.dwfx”);
    i am trying to run this it says
    Execute is Disabled via CanExecute
    it works as plugin in Navisworks but not in console

  2. Hi bara salah,
    I tested with the below code, I was able to create the .dwfx file without any issue.
    NavisworksApplication navisApp = new NavisworksApplication();
    //NWC or NWD
    navisApp.AppendFile(@”C:\Users\InputFile.nwd”);
    navisApp.ExecuteAddInPlugin(“NativeExportPluginAdaptor_LcDwfExporterPlugin_Export.Navisworks”, @”C:\Users...\OutputFile.dwfx”);
    navisApp.Dispose();
    Could you please post your issue in the Navisworks API forum for further discussion of this issue?

  3. I’m having trouble loading the built-in plugins from the Resolver console interface; they’re not loading and I can’t seem to find where to load them.

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading