Class Handout CS226911 Make NavisWORK For You Intro To The Navisworks API Jake Lovelace
Class Handout CS226911 Make NavisWORK For You Intro To The Navisworks API Jake Lovelace
Jesse Creech
Brasfield & Gorrie
Learning Objectives
• Explain the overall structure of the Navisworks API
• Implement a basic "Hello World" plugin
• Develop concepts of custom functionality and describe how the Navisworks API
can be used to achieve them
• Identify the right learning path and resources to learn to code Navisworks plugins
Description
Are you a BIM professional looking to get more out of Navisworks? As you probably know, BIM
workflows can vary greatly from firm to firm, creating large gaps between the generalized
functionality of mass-market BIM software and the custom needs of a particular group. Enter the
world of programming. Daunting as it may seem for people who have never written a line of
code, I'm here to tell you that with some effort you can be writing Navisworks add-ins in 6 weeks
or less. We'll be focusing on three main topics: a high-level overview of the API structure, a case
study of a real-world plugin built by Brasfield & Gorrie to track issues in the coordination
process, and some helpful resources to get you started coding and writing your own plugins.
You'll leave with inspiration and ideas for your own coding projects, along with confidence to
take the next step.
Speaker(s)
Jake graduated from Auburn University College of Engineering with a Bachelor of Civil
Engineering. After gaining experience in estimating, project management, and field supervision,
Jake assumed his current role as a VDC Coordinator for the Virtual Design + Construction
Group at Brasfield & Gorrie, a general contractor based in Birmingham, Alabama. He oversees
MEP trade coordination for multiple construction projects, assists estimators in the use of
model-based takeoff, and provides BIM implementation across all phases of the construction
process. Naturally restorative and driven by a passion for continuous improvement, Jake
identified a need expand functionality of BIM software his department uses every day. Diving
head-first into the world of software development, he specializes in creating custom software
integrations to help his team alleviate manual/repetitive tasks and promote more
automated/efficient workflows.
Page 1
Jesse Creech graduated from Auburn University College of Architecture, Design and
Construction with a Bachelor of Building Construction. Jesse has worked in the construction
industry for over 7 years, joining Brasfield & Gorrie in 2014 with previous exposure to both field
operations and in preconstruction services. His hands-on field experience gives him a unique
perspective of what is feasible/realistic when applying 3D models and emerging technologies to
existing construction processes. In his current role of Senior VDC Coordinator, he is a vital part
of B&G’s workflows starting in marketing and continuing through project turnover. Jesse
specializes in management of MEP coordination on multiple projects, is passionate about
advancement of reality capture techniques, and has been integral in introducing and immersing
our field engineering department into model-based layout processes.
Page 2
Table of Contents
Page 3
Introduction
Page 4
Navisworks API Structure
About Navisworks
Navisworks (originally called JetStream) was acquired by Autodesk in 2007. It comes in three
flavors: Manage, which is the full package; Simulate, which is basically everything except the
clash detective; and Freedom, which is a free viewer. The program is comprised of several
modules, including:
• Roamer – core module for viewing and navigating model
• Publisher
• Clash Detective
• Renderer
• Quanification
• Timeliner
• Animator
• Scripter
There are several different types of API applications, but the two most popular are the AddIn
plugin, which provides a button on the Navisworks ribbon to launch a command, and the Dock
Pane plugin, which allows you to create your own custom dock pane.
The Automation part of the .NET API is a small assembly that can be referenced by developer
applications. It contains enough to start Navisworks and perform some basic actions (open,
append, save, etc), however complex actions should be achieved using a plug-in which can still
be called through Automation.
The Controls API provides .NET controls that can be added to your own applications to view
and interact with the models.
NwCreate is a separate C++ library that provides means for creating Navisworks models.
However it cannot modify geometry in an existing model.
Page 5
Class Structure
The .NET API is organized similar to the GUI. Below is a tree chart showing the hierarchy of the
major classes and properties:
Page 6
Application Class
Provides access to the active document, GUI, plugins, etc.
Document Class
Provides access to all document-related data, such as models, current selection,
viewpoints, selection sets, etc.
Model Class
Represents a loaded file within the document
ModelItem Class
Represents a single item in the model. ModelItems are structured in hierarchical nodes,
and are visually represented in the selection tree. The ModelItem class has access to
geometry, properties, and child nodes.
SavedItem Class
Base class for saved items in document. Some examples of classes that inherit from
SavedItem:
• ClashResult
• SavedViewpoint
• SelectionSet
• TimelinerDataSource
What is .NET?
.NET is an application framework developed by Microsoft to aid in making applications. It
provides several different services:
• Libraries of basic functions
• Communicates between software
• Provides utility services to applications (i.e. garbage collection, etc)
• Compiles code written in multiple languages into a Common Language Runtime, which
can then be compiled to machine code.
• Supports C#, F#, Visual Basic, and managed C++
Page 7
Let’s Make a Plugin!
Step 1: Open Visual Studio and Create a New C# Class Library Project
Page 8
Step 3: Reference the Windows Forms assembly (this is for the MessageBox control that
displays “Hello World”)
Page 9
Step 4: Copy this block of code into Class1.cs, overwriting the code already in the file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
using System.Windows.Forms;
namespace HelloWorldPlugin
{
[PluginAttribute("HelloWorld",
//Plugin name
"ADSK",
//character Developer ID or GUID
ToolTip = "Hello World",
//The tooltip for the item in the ribbon
DisplayName = "HelloWorld")]
//Display name for the Plugin in the Ribbon
public class HelloWorld:AddInPlugin
{
public override int Execute(params string[]
parameters)
{
MessageBox.Show("Hello World");
return 0;
}
}
}
Page 10
Step 5: Save and build your solution (Ctrl + Shift + B)
Step 6: Copy the output dll (\HelloWorldPlugin\bin\Debug) into a new folder with the same name
in C:\Program Files\Autodesk\Navisworks Manage 2018\Plugins
Page 11
Step 7: Open Navisworks and run plugin from button on “Tool add-ins 1” toolbar
If your plugin requires any external dependencies, they must go in the Dependencies folder
C:\Program Files\Autodesk\Navisworks Manage 2018\Dependencies
Windows Forms is a library of UI controls that wraps native Windows interfaces. These are the
controls you’ve used since the Windows 95 era. WinForms is very dated but it does have the
benefit of extensive documentation online. It also has a nice drag-and-drop form creator in
Visual Studio, making it the best option for quick turnaround and low learning curve.
Windows Presentation Foundation (WPF) is the next-generation UI platform. It offers a lot more
flexibility, but at the cost of being more complicated and harder to learn. The layout is based on
XAML. For a clean, professional UI, use WPF.
Page 12
Deployment
In our department we have a saying when we are evaluating new software: “If it takes a project
manager more than two clicks to use it, they won’t use it”. The same is true for people installing
and using your plugin. Having them copy the dll manually is too complicated, so make it easy for
them by writing an install wizard. I have found that Inno Setup
(http://www.jrsoftware.org/isinfo.php) is a good solution for this. It is a free install wizard maker
that uses a simple scripting language. Just write an installer that adds a copy of the dll into the
Plugins folder when run.
Naturally you will be updating and maintaining plugins that you write, so you will also need a
solution for deploying updates. Rather than having users manually install updates, you can add
automatic update functionality to your plugin using AutoUpdater.NET, a library for .NET that will
check for updates when Navisworks opens and notify the user if there is an update available. If
there is, they will be able to update with one click. To make AutoUpdater check for updates on
startup, you will need to include an EventWatcherPlugin in your project.
Page 13
Case Study: Development of the IssueTrack Plugin
In our VDC department at Brasfield & Gorrie, we identified a need to track issues in our MEP
coordination process. The project that became IssueTrack started as an idea to create a
Navisworks plugin that could generate issue reports based on either saved viewpoints or
clashes. As the idea became further developed, we realized that in order to produce these
reports, we needed a way to add data fields to issues, so representing them merely as
viewpoints or clashes in the model was not sufficient. IssueTrack was developed as the
solution.
IssueTrack is organized around pieces of data called “issues”. An issue has multiple fields
associated with it: Date Created, Description, Notes, Due Date, Coordination Zone, Location,
Responsible Company, and Trade – along with the associated viewpoints, clashes, or external
images that supplement the issue.
One important requirement for IssueTrack was flexibility. Very quickly we realized that it would
have to accommodate the many different workflows our coordinators use, as our department is
still developing standard operating procedures. IssueTrack was designed to be flexible to these
workflows and as much as possible not disturb the current workflows in use. Issues in
IssueTrack can be batch-created from viewpoints, clashes, or manually. Once created, they can
be kept in sync with clash statuses if created from clashes, or kept in sync with the viewpoint
folder structure in Navisworks if created from viewpoints. The integrated SmartMap technology
allows users to specify issue field values for certain viewpoint folders, and can maintain 2-way
consistency, making updates to issue field as their linked viewpoints are moved between
folders, and moving viewpoints when their issue fields are changed. This feature sets
IssueTrack apart from existing software, as our subcontractors can continue to use the
viewpoints in weekly NWDs for reference in their work rather than having to get on board with
external software. The plugin also provides an interface for pushing out issue reports with the
click of a button. Report templates can be saved for future use, along with preset sort and filter
options.
Additional Resources
• General programming tutorials – LinkedIn Learning (https://www.linkedin.com/learning)
Page 14