Wednesday, November 11, 2009

Creating new tables in the project which are accessible in the Access Database


I decided to create a table for 'Entourage'. This includes human beings, vehicles and other such objects in the Revit Library. So, this was started by once again opening the RDBLink.cs proj in Visual C#. The project was studied in detail by using an Instance of Door to see how the table was created for it.
The first step to creating a new table was to add Entourage as a new Instance in the RDBLinkData.resx code tab. Next the new table name was added as data in another RDBLinkData.resx code tab where the various new tables are added by their name values.


Next the RDBMetaDataInitialisation.cs code tab was opened and (using the Door Instance as example) new columns for ID, Design Options, Model Comments and Level were added. The ID column was specified as the Primary Key and the Design Option and Level were designated as Foreign Keys.



The RDBLinkDataDesigner.cs would then automatically generate the required codes for it when the project is compiled using Build. Then the project is exported into the ODBC Database once again using RDBLink in Revit Architecture as done earlier.
Finally, the MS Access database is opened to check if the Entourage table has been created. Also the Room Associations table can be used to compare the IDs with respect to the doors, windows and entourage table.



Project 2- BIM API and DataBase




1. Creating new rows in Tables exported from a Revit Project to an MS Access Database

This was done by first opening the RDBLink.scproj in VisualC# Express Edition from the RDBLink folder in the Samples folder of Revit SDK 2010. Next the term 'RoomAssociation' was searched to find out the places where code was written for the project.

In the NonCreatableElemenrList.cs tab, the public class for RoomAssociations was found. The BuilInCategory was studied to see what different elements were presently included in it.
Then the same code was copied and posted thrice to add in .OST_Doors, .OST_Windows & .OST_Entourage as shown in the picture below. Then the project was compiled by pressing Build.
Next Project 1 was opened in Revit Architecture and then it was exported into the ODBC Database by using the RDB Link in the Data Exchange tab in RvtSamples under AddIns. Then the Access Database was opened and found to have the additions of doors, windows and entourage in the RoomAssociations table