Adding a Column to RDBLink Export

Probably the most complex Revit SDK sample of all is the RDBLink one.
We mentioned it briefly in Anthony Hauck’s note on

integration with a database or ERP system
,
but provided no additional details.
Like all the SDK samples, RDBLink comes with its own readme document, which is actually a lot more extensive than most others due to the size and complexity of this sample.
In brief, RDBLink demonstrates how to export Revit model data into an ODBC database and how to import data back from a database into Revit, possibly modifying or creating new Revit elements.
Here is a simple question on that topic, answered by my colleague Joe Ye:

Question: I am using RDBLink to export Revit data to a database.
I would like to add a few custom columns to the generated tables.
How can I do that?

Also, when I dump the data, it overwrites all the previous data.
Can I append data to existing tables?

Answer: First the short answer to your second question:

Unfortunately, RDBLink cannot append to existing tables.
It always synchronises the Revit document with the exported database.

It is however possible to add custom columns to the exported database.
Which table do you want to add columns to?
Would you please tell me the table name?

Question: I would like to add a column “Facility Id” to the tables:

  • CurtainSystems
  • DistributionSystems
  • DuctSystems
  • FurnitureSystems
  • PipingSystems
  • [dbo].[ElectricalEquipment]

Answer: To add the columns you require, you can add shared parameters to the respective elements.
Then RDBLink will automatically generate new columns populated by the values of these shared parameters.
The readme file ReadMe_RDBLink.rtf provides more information on this:

<

p style=”color:darkblue”>Create shared parameters: In the database editing form, user can add shared parameters to current document, and after
that new fields in the related tables for the elements will be created, user can give values to these new fields.
After importing, these new parameters will be updated.

Question: I am quite new to this.
Can you please give me some more details?
Is there some other documentation available for it?

Answer: I just tested adding a shared parameter named ‘test’ to all doors in a project document and
then called the RDBLink external command to export the model data to an access database file.
The database contains a new column ‘test’ generated by this shared parameter, and populates it with the shared parameter values.
Here is the parameter that I added to the Revit BIM:

Shared parameter

Here is the exported data displayed in the database table:

Database column

The shared parameter can be created using the Revit user interface.
The command is described in the Revit product help file HelpArchitectureENU.chm in the Program subfolder, where you can find it through
Revit Architecture 2010 User’s Guide > Customizing Project Settings > Custom Parameters.

Thank you, Joe, for these answers!

Shared parameters can also be created programmatically, and here are some pointers to previous posts on related topics:


Comments

14 responses to “Adding a Column to RDBLink Export”

  1. Hi Jeremy,
    Hope, you are fine.
    Got a question today : (I search in vain)
    Is it possible to do a zoom out via API?
    I can do using a SendKeys but, in 2009 API, is it possible via a command?
    Cheers!

  2. Dear Pierre,
    Yes, I’m great. Well, actually not, I have a terribly sore throat, and am trying very hard to contain it so it does not spread and infect my whole head and lungs. But I still feel happy and am optimistic, and think that it is good to have it now rather than later on when I am travelling for Autodesk University and other conferences. I hope you are well also.
    Thank you for taking the trouble to search for an answer.
    I am sorry that I am not aware of any possibility to zoom to extents via the API, either in 2009 or 2010, so SendKeys sounds like your best bet for achieving this.
    Cheers, Jeremy.

  3. All right, thx for your answer.
    And, take care of you, and hope you’ll be quickly ok!
    Have a nice day.

  4. Hi jeremy,
    Is it possible to create a ListBox button instead of a simple Button in a toolbar menu?
    PS : Do you feeel better today?
    Cheers!

  5. Dear Pierre,
    Maybe a little bit better, it still remains to be seen how it will develop.
    Nope, all the things that can be done with the ribbon through the Revit API are demonstrated by the Ribbon SDK sample.
    Cheers, Jeremy.

  6. All right. Thx for your answer. Take care.
    Cheers!

  7. Daniel Stonecipher Avatar
    Daniel Stonecipher

    Hello Jeremy,
    I hope all is well! I saw this post, and after searching and searching for info, decided to post this question in hopes you can point me in the right direction.
    I am trying to use the RDB link to connect to MSAccess and MSExcel, however, the only driver available to create a new data source is SQL. If I open the ODBC Data Source Administrator (from c:\windows\syswow64\odbcad32.exe), I can create a DSN, however it is not availble (or visible)in the RDB Link Select Data Source dialog.
    I am using Windows XP (64Bit) for an OS, and there appears to be a lack of drivers developed for 64bit ODBC
    The only option I get is for SQL Server and I am not having any luck finding anything on Microsoft’s site on how to get these drivers (for Access or Excel) installed.
    Any help would be greatly appreciated!
    Thanks Jeremy,
    Best Regards,
    Daniel

  8. Dear Daniel,
    Here are two suggestions from colleagues of mine, although one of them is the option you already know:
    Stephen’s usual suggestion is wrapping the 32 bit driver functionality in a 32 bit stand-alone COM server that, since it’s stand alone, could also be used from a 64 bit process.
    “I understand that Microsoft do not issue a 64-bit version of the ODBC driver for MS Access. The 32-bit driver can’t load into the AutoCAD 64-bit process space, so the only solution I can suggest is to create a 32-bit standalone executable that exposes a COM server to act as an intermediary between your AutoCAD application and Access.”
    Joe’s usual suggestion is using another driver e.g. SQL Server:
    “Last we checked, Microsoft does not provide an ODBC driver for Access or Excel in their 64-bit operating systems. I believe this is listed in the Known Issues document for Revit 64. You might be able to work around this by using the ODBC export driver (assuming it exists) for SQL Server and then using SQL Server Express to view and change the data.”
    Thank you Stephen and Joe for these, and Adam for pointing them out to me!
    Cheers, Jeremy.

  9. Hi Jeremy,
    I have managed to set up the RDBLink and having a great time in Access and SQL….
    Do you know if the Room Associations (for Doors) should be exported? I want to be able to push the room number into the door instances after some update statments in the exported database.
    When exporting from Revit i get the tables RoomAssociations and RoomFromToAssociations but they are both blank?any idea’s?
    Thanks in advance

  10. Dear Toby,
    Congratulations on getting it up and running and having fun there.
    Nope, sorry, I don’t know that off-hand. Have you had a look at the documentation in ReadMe_RDBLink.rtf in the Revit SDK? That is a pretty comprehensive document, and I would have assumed that all associations were documented there.
    It also says that “some new relationships will be created, such as area load on slab, line load on beam, window on wall etc. These tables and relationships do not exist in Revit ODBC exported database.”
    Since you have the full source code, you can debug that and find out what is going on for yourself, and even add other additional relationships if you require them.
    Cheers, Jeremy.

  11. Niles Avatar
    Niles

    Hello,
    I want to add new record in a database. Means I want to add new row in a table. How can I achieve it? Please tell me the detailed steps

  12. Dear Niles,
    I am happy to tell you frankly that I have not the slightest idea.
    Cheers, Jeremy.

  13. […] to export and potentially modify and re-import as well. It might be worthwhile checking whether RDBLink does anything like that… RDBLink was originally part of the Revit 2008, 2009 and 2010 SDKs, […]

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading