Connecting your Navisworks model to a database can be a maze for the non-expert. Working in support I get asked alot about DataTools connections, linking to Excel, Access, Text files, SQL Databases and more. It's a difficult area, we want to provide the best help we can, but you know the data better than we do, you know the environment you are on, due to the amount of variables we can only guide you. Any changes to that environment or data can kill the connection to your model, so here's some guidance for those working with DataTools to get it set up.
We ALWAYS recommend that you know SQL and the database you are connecting to, otherwise you'll get lost quite easily. Get your IT department involved if you do not know how to connect to the database yourself.
Golden Rules
- If this doesn't work outside of Navisworks, it definitely won't work inside Navisworks
- We will only recognize 32 bit ODBC drivers on 32 bit machines, if you have a 64 bit machine; you need a 64 bit ODBC driver
ODBC Drivers
You will need a suitable ODBC data source for your type of database (Excel, Access, Text, CSV), this needs to appear in Administrative Tools > Data Sources. These can either be pre-configured as a DSN or used directly via the driver.
If the source appears in one of the DSN tabs then there should be a wizard to set up the connection string supplied by ODBC. When setting up a new DSN, this wizard should create a working link to the database. The menus to create the connection will vary from driver to driver as well. You can refer directly to this DSN through Navisworks, in which case there is no further connection configuration needed.
Alternatively you can also set up a connection directly in Navisworks using the ODBC driver itself, if you select a driver in the ODBC Driver field in DataTools, clicking setup will launch the same wizard as used to make DSN's in Windows. This allows you to configure the connection directly in Navisworks.
SQL string
Once you have a connection string configured you still need to specify how the database will be queried. This is done via an SQL SELECT Query.
This would typically be comprised of three parts, but will vary depending on your precise needs. Our examples will assume a simple use case accessing a single table.
There's whole books and websites dedicated to creating SQL strings, and because of the huge variety of ODBC Drivers available, and Data that can be linked to, we cannot give an explicit 'this will work' sample for you but here is a simple single table Access query to get you started. When actually entering this in DataTools this needs to be a single line terminated with a semi colon.
SELECT (this is where you enter the field names you want to query) FROM (this is the name of the table) WHERE (this is where you enter the condition for which data to bring through – typically this would include a Navisworks tag which fetches model data to participate in the condition);
SELECT weight FROM entity_data WHERE name=%prop('Item','Name');
This assumes a table called entity_data with two fields, weight and Name, where Name is the same as the Name of Items in the Navisworks model, %prop is one of the tags that can be used in an SQL string in Navisworks DataTools to retrieve model data for conditional matching, more can be found in the Help file in the product.
Once you've got fields selected by your SELECT statement, to get them to show in Navisworks, you have to list the fields with a display name in the right-hand pane of DataTools.
If you have any tips, or recommendations specific to different files types, please Submit a Tip
Hi Sherif, Yes as long as you get the ODBC driver and have a suitable string to query the data
Posted by: Lee Mullin | 08/18/2016 at 02:47 PM
Is it possible to link Navisworks to mySQL DB
Posted by: sherif | 08/18/2016 at 02:10 PM
As long as you have a unique ID there's nothing to prevent you linking at any level of the selection tree
Posted by: Lee Mullin | 03/31/2016 at 05:29 PM
Many thanks. very valuable and useful information!
Just wondered if the linkage is only for objects? I think Object is the minimum element in BIM. As in Navisworks a model's hierarchy is like 'project', 'site', etc, I am wondering if we could link some information in Excel or Access to the higher levels (i.e. project, site) instead of only the object?
Posted by: Yang Zou | 03/27/2016 at 04:29 PM
Apologies for any confusion. It's just not currently supported for Freedom to view these Database properties. We do know about this and there's an enhancement request to support this in a later version.
Posted by: Lee Mullin | 12/15/2011 at 10:45 AM
Lee - I'm going to quote directly from the Navisworks Manage 2012 help file:
Quote:
Database links can be saved inside Autodesk Navisworks files (NWF and NWD). You can also save database links globally, making them persistent across all Autodesk Navisworks sessions. The global connection information is saved on the local machine. If the associated database is available on loading the NWF/NWD file, the link automatically establishes itself when an object is selected. On selecting an object, if the database is available, and there is data associated with the object, Autodesk Navisworks adds an appropriate database tab to the Properties window, and displays the appropriate data.
Data linked from a database connection can be extracted and embedded as static data within the published NWD file.
/End Quote
If the ability to embed the data statically exists, why can't Freedom see it?
Posted by: Bishop Brown | 12/02/2011 at 06:54 PM
Hi Yuri, It isn't currently possible to embed database properties in an NWD, the other user would need access to the Database and a version of Simulate or Manage.
Hi Demmy, I think I may have seen you post this elsewhere but if not try asking on the Navisworks API forum where they should be able to help. http://forums.autodesk.com/t5/Autodesk-Navisworks-API/bd-p/600
Posted by: Lee Mullin | 11/24/2011 at 02:16 PM
If the model is saved in nwd after link the database and i send this file to my client which has the freedom version of navisworks the properties of database is avable?
Posted by: Yury | 11/17/2011 at 05:45 PM
I tried out your idea on linking navisworks to the MS database and it worked. But i tried to open the same database through a plugin and it isn't opening. Why is that? The reason why i am doing this is to create a textbox and use the textbox to update the database when a botton is clicked. I am using C#. Can you help try this out to see it it works?
Posted by: Demmy | 10/20/2011 at 04:33 PM
It's not currently possible to edit properties or CAD data inside Navisworks. You'd need to have the two running alongside each other and changes in the Database should be reflected when you refresh the model in Navisworks.
Posted by: Lee Mullin | 10/20/2011 at 09:27 AM
This is a very nice presentation. It works on a 64 bit system.
But my question is this: How do you update or change the database properties from navisworks? Isn't there a way to write back to the database form navisworks?
Posted by: Demmy | 10/20/2011 at 09:07 AM
Hi Teresa, Unfortunately yes it does. It was only last summer before 64 bit ODBC drivers were available which caused quite alot of frustration. The Office 2007 drivers were 32 bit drivers that would work on 64 bit, not 64 bit themselves.
Posted by: Lee Mullin | 09/16/2011 at 12:01 PM
Thanks for the information! With 64bit ODBC, I am assuming this means an upgrade to Windows Office 2010 which has full 64bit drivers as opposed to MS Office 2007 which only had compatible but not 'real' 64bit ODBC?
Posted by: Teresa | 09/15/2011 at 06:55 PM