You can export model component data to an ODBC (Open Database Connectivity) database. The exported data can include project parameters that have been assigned to one or more element categories in the project. For each element category, Revit exports a database table for model types and another table for model instances.
ODBC export uses metric units only. If a project uses Imperial units, Revit converts all measurements to metric units before exporting to ODBC. When you use data from the resulting database, remember that the measurements reflect metric units. Use a database function to convert the measurements back to Imperial units if necessary.
Using ODBC, Revit creates tables for the following elements:
- Model Objects: Types and Instances
- Levels and Rooms: Instances only
- Key Schedules
- Assembly Codes: A single table containing assembly code data for the entire project
ODBC export creates specific relationships between tables in the database using primary keys and reference values. See Table Relationships Within the Database.
Revit can export to the same database multiple times. When exporting to an empty database, Revit creates new tables. When you export a project to a populated database, Revit updates table information to match the project. This allows you to customize the database and re-export data as the project changes.
Attention: Do not export different projects to the same database. Use a unique database for each project.
ODBC is a general export tool that works in conjunction with many software drivers. Revit has been tested with the following ODBC drivers:
- Microsoft® Access
- An ODBC export to Excel creates one table per worksheet.
- You can export to an Excel file only once. Multiple exports to Excel are not supported.
- Microsoft® SQL Server
- The Microsoft® Text Driver is not supported by Revit.
Revit DB Link allows you to export Revit project data to a database, where you can edit the data, import it back into the project.
There are two types of databases you can use with Revit DB Link: Microsoft Access or ODBC.
The database must already exist (for non-Microsoft Access databases) and have a DSN properly set up for connecting to it. See Accessing Revit DB Link.
The Microsoft Access or SQL Server database must allow for reading, writing, and table creation.
When Revit creates database tables during ODBC export, it adds relationships to the data tables using primary keys and reference values. In relational databases, a primary key is a unique value that identifies a record (row) in a table of the database. Reference values are columns in a table that refer to other tables.
Note: Database programs (such as Microsoft® Access) can interpret the table relationships. In spreadsheet programs like Microsoft® Excel, relationships are not supported, so Revit creates simple, unrelated tables.
The primary key in each element table is the column labeled “Id”. The following table illustrates how primary keys and reference values create relationships among tables in the database.
|Column (Field) of a Door Instance Table||Corresponds to…|
This is the unique identifier for this instance of a door.
Id column of the door Types table
Id column of the Levels table
Id column of the Rooms table
Id column of the Key Schedules table
The primary key in the Assembly Codes table is the Assembly Code column. The Assembly Code column in type tables references the Assembly Code column in the Assembly Codes table.
Revit does not create a reference for the Host Id column because the host may be a wall, floor, roof, or other such host, so there is no unique table to reference.
The relationships between tables are established only when Revit first creates the tables; if you use Revit to re-export to an existing database, no new relationships are created.
You can install the Autodesk Revit DB Link 2014 from your subscription site.
To export to an ODBC database
- In Revit, open the project to export.
- Click Export (ODBC Database).
- In the Select Data Source dialog, click New to create a new Data Source Name (DSN).
- In the Create New Data Source dialog:
- Select a driver, and click Next.
- This driver is associated with the software program you export to (for example, Microsoft® Access, dBase, or Paradox).
- Enter a DSN name, or navigate to the target folder and specify a file name. Click Next.
A confirmation dialog displays. If any information is incorrect, click Back and correct it.
- Click Finish.
- Create the database file.
- Depending on the driver selected, a dialog displays, requesting information about the database file to which you’re exporting. Use the dialog to specify the database to use or to create a new one. For example:
- For Microsoft® Access, click Select to select an existing database, or click Create to create a new, empty database to export data to.
- For Microsoft® Excel, first use Excel to create a new, empty workbook with the desired name. Then on the dialog, click Select Workbook, and navigate to the new workbook.
- In the Select Data Source dialog, click OK.
- In the ODBC Setup dialog, click OK.
Note: If the export fails with an error regarding a read-only database, click Options in the ODBC Microsoft Setup dialog. Clear the Read Only check box. Then try the export again.
Do not edit data in the database columns exported by Revit. Any changes to those columns are overwritten the next time the project is exported.
However, you can add columns to the tables created by Revit. The next time the project is exported, any data in the added columns is preserved.
You can update a Revit project with changes that were made to data in an external database, or that were directly edited during import.
- The appropriate Revit elements reflect any changes that were made to the database.
- The import table view allows changing of data immediately before import if desired.
- You can use Ctrl+0 to set a cell value to empty in the table view.
- It is not possible to delete, cut or modify an entire record (using copy and paste) if the corresponding element exists in Revit.
- Those tables that do allow creation of new types will have a new row record available. When filled out with all the required data, the ID displays a negative value which converts to a valid element ID after the import process.
- The Custom Parameters menu allows you to create Shared Parameters for your project. Click Add and specify the Name, Group, and Type, then select the Categories it will belong to. All selected categories that have an associated database table automatically appends the new parameter field to the table. This parameter data may then be edited in the drawing or the database and updated accordingly upon import or export.
Only import from the database originally exported to for a given project, or unpredictable results may occur.
Revit DB Link Workflows
Autodesk Revit DB Link provides a way to store Revit model information in a database where it can be modified and then returned to the Revit model. With Revit DB Link, you can:
- Create a database from data in a Revit project.
- Update an existing database with Revit data that has been changed.
- Update a Revit project with changes made in a database.