By Naveen Kumar
Navisworks 2024 SDK has been posted on ADNOpen:
https://www.autodesk.com/developer-network/platform-technologies/navisworks
Navisworks 2024 is built against .NET Framework 4.8, which means the application with NET API supports .NET Framework 4.8 and above. The program will need to be compiled by Visual Studio 2022 and .NET Framework 4.8 and above.
In Navisworks 2024 API, We have found an issue of .NET control application.
Issue Description: Autodesk.Navisworks.Api.Controls.ApplicationControl.Initialize() will throw an exception: "External Component has thrown an exception".
Solution: This issue is scheduled to be fixed in future update.
For now, the workaround is to add the installation directory of Navisworks to the path before calling Autodesk.Navisworks.Api.Controls.ApplicationControl.Initialize();
(i.e) Environment.SetEnvironmentVariable("PATH",Environment.GetEnvironmentVariable("PATH")+ ";"+nwInstallDir);
where nwInstallDir has a value corresponding to where NW is installed.
Your sample code will look like this
static void XMain() { //Set Environment variable string nwInstallDir = @"C:\Program Files\Autodesk\Navisworks Manage 2024"; Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH")+";"+nwInstallDir); //Set to single document mode Autodesk.Navisworks.Api.Controls.ApplicationControl.ApplicationType=ApplicationType.SingleDocument; //Initialise the api Autodesk.Navisworks.Api.Controls.ApplicationControl.Initialize(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Viewer()); //Finish use of the API. Autodesk.Navisworks.Api.Controls.ApplicationControl.Terminate(); }