The INavisworksExtension interface is specifically tailored for developing extensions in Navisworks, a popular software for Building Information Modeling (BIM). While many concepts from the more general IAssistantExtension guide still apply, there are key differences unique to Navisworks extensions.
For a foundational understanding of creating .NET extensions for Navisworks, you can refer to the Assistant .NET Extension Development Guide. This guide forms the basis for understanding .NET extensions, which you can customize for Navisworks.
Understanding the central distinctions between Navisworks extensions and general Assistant extensions is vital:
Navisworks Document Interaction: The INavisworksExtension is designed for interaction with Navisworks documents. In your extension's implementation, you can work with BIM data, gather information, and perform tasks relevant to the BIM domain.
Navisworks Context: The NavisworksExtensionContext provides a context tailored to Navisworks extensions.
Here's a basic example of an INavisworksExtension:
public class NavisworksExtensionCommand : INavisworksExtension<NavisworksExtensionArgs>
{
public IExtensionResult Run(INavisworksExtensionContext context, NavisworksExtensionArgs args, CancellationToken cancellationToken)
{
var document = Application.ActiveDocument;
if (document is null)
return Result.Text.Failed("Navisworks has no active model open");
// Get selected element ids in model
var selectedObjects = document.CurrentSelection.SelectedItems;
// Loop through selected elements
foreach (var selectedObject in selectedObjects)
{
// Get the element name
var elementName = selectedObject.DisplayName;
}
// Create a message with the input text
var message = $"Input = {args.TextInput}";
// Return a result with the message
return Result.Text.Succeeded(message);
}
}
This sample implementation illustrates the use of the INavisworksExtension to interact with Navisworks models.
For a more comprehensive understanding, please consult the Assistant .NET Extension Development Guide, adapting the principles for your Navisworks extensions.