Automating Model Coordination for Navisworks

Today’s post is one of those topics that I can’t believe we haven’t covered or done yet.  Most of us use Navisworks to coordinate our project information.  If you don’t, you should.

 

When you get to working with a lot of models, you need a way to pull everything together for review.  Navisworks facilitates that review and coordination process.

One of the best features of Navisworks is the ability to publish a .nwd file which compacts all the models that are loaded (xrefs and all) into a single file.  With the .nwd, you don’t have to share a bunch of dwg files or references.

As we all know, projects change rapidly. For people trying to coordinate among multiple locations, generating a new .nwd every day is one of the tedious tasks that we can address.

The solution has two parts.  First, we will create a batch file that can publish the .nwd, and then we will use Windows Scheduler to run the batch file at a certain time.

Creating a batch file

The best place to find the information for this particular task is the help file.  In the Navisworks help, go to Quick Start > Command Line options.

The key bit will be using the –nwd option:

image

In our example, we are only going to publish one dwg.  However, you can add as many files as you need and they will get appended together.

Here’s the text for the batch file

::colons are comments
::use this line if you want to just put a file name in the current directory
::or you can use the full file path, I use file paths in variables so it’s easier to see what the command is doing
set file=”C:\Users\dave.wolfe.S-VILLE-ECAD\Documents\ProjectsDev\Navisworks Publish NWD\PPG-PIPING-01.dwg”
set file1=”C:\Users\dave.wolfe.S-VILLE-ECAD\Documents\ProjectsDev\Navisworks Publish NWD\STR-BUILDING.dwg”
set roamerpath=”C:\Program Files\Autodesk\Navisworks Manage 2012\roamer.exe”
::can be a full path to a file or if just a file name it will be in the folder with the batch file
set publishfilename=Project1.nwd
set publishfile=”%~dp0%publishfilename%”
::include a log file (logs are EXTREMELY detailed)
::set log=%~dp0publish.log
::%roamerpath% -log “%log%” -nwd “project.nwd” %file%
::just publish our .nwd
%roamerpath% -nwd %publishfile% %file%
::publish multiple .dwg to an .nwd
::%roamerpath% -nwd %publishfile% %file% %file1%

Create a text file and change the extension to .bat.  You can copy/paste the text above or just type it. Save the text file.

 

Scheduling our Batch File

At this point you should be able to run your batch file and have it create the nwd.  The trick now is to have that run automatically.

We are going to use the Windows Task Scheduler to run our batch.  Go to the start menu (now the Windows Icon> All Programs > Accessories > System Tools > Task Scheduler

image

Click Create Task:

image

Fill in the name and description of the task

SNAGHTML19bed05

Go to the Trigger tab and select new.

Set the task to Daily and specify your preference for time:

SNAGHTML19df2fd

Go to Actions and click New.

Select Start  Program and then browse to the location of the batch file you created.

SNAGHTML1a1b16c

Once you click ok, the task should be created and you can find it under Active Tasks.

image

Double-click your task, and you should be taken to the task library where you can run the task to test it.

image