BIM World
A Professional BIM Learning Platform


Reading Revit Detail Tables and Storing Data in SQL Server Using Python

Understanding Quantity Takeoff in BIM Operation and Maintenance
One crucial aspect of BIM (Building Information Modeling) operation and maintenance is accurately determining the quantity of work involved.

How can we read the engineering quantities?

1) Using the software’s built-in functions: What you see is what you get. This method relies on the software’s own calculation capabilities. For example, Revit provides detailed schedule tables for analysis.Revit detail table reading, storing detail table data to SQL Server database, Python reading database

2) Obtaining the calculated engineering quantities through plugins or custom-developed functions.

Today, I will briefly introduce the first approach and focus more on implementing the second. Since I’m more comfortable with SQL Server databases, I’ll demonstrate using this platform, although free alternatives like MySQL also work. While reading data with C# can be tedious, Python offers a more efficient solution. Many users report that those with some programming background can grasp Python within three days, and beginners typically within a week.

To start, we use the system’s built-in engineering sample and extract the detailed door schedule from Revit.Revit detail table reading, storing detail table data to SQL Server database, Python reading databaseRevit detail table reading, storing detail table data to SQL Server database, Python reading database

Next, we’ll use our database to read this detailed schedule.
Now, the question is: which is faster—reading directly from the project or accessing the database? I haven’t tested this yet, so I can’t say for sure. However, reading directly from the project requires extensive coding, which cannot be shared commercially. Therefore, the most convenient method is to read directly from the database, especially if the model project has already been completed.

Here are the steps:

1) Import Revit data into SQL Server.Revit detail table reading, storing detail table data to SQL Server database, Python reading databaseRevit detail table reading, storing detail table data to SQL Server database, Python reading database

Step by step, the project database is successfully imported into SQL Server.Revit detail table reading, storing detail table data to SQL Server database, Python reading database

Now, let’s analyze the door database. It contains the door type ID, which links to the door type and door name. To generate the comprehensive table shown earlier, we need to combine these two sets of data.Revit detail table reading, storing detail table data to SQL Server database, Python reading databaseRevit detail table reading, storing detail table data to SQL Server database, Python reading database

Finally, we use Python to read data from the SQL Server database. Python is highly effective for database operations. In this example, we use the PyMSSQL library to connect to SQL Server and the Pandas library to display results clearly.

This is the final output. Calculating sums and other operations rely on database knowledge and are straightforward, so I won’t cover them here.

Although this overview is brief, it covers a wide range of skills: Revit, database management, Python, and Pandas.Revit detail table reading, storing detail table data to SQL Server database, Python reading database

xuebim
Follow the latest BIM developments in the architecture industry, explore innovative building technologies, and discover cutting-edge industry insights.
← Scan with WeChat
Like(0) 打赏
BIM WORLD » Reading Revit Detail Tables and Storing Data in SQL Server Using Python

Comment Get first!

Must log in before commenting!

 

BIM World, A Professional BIM Learning Platform

Stay updated on the latest architecture trends and share new building technologies.

Contact UsAbout Us

觉得文章有用就打赏一下小编吧

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

Account Login

By signing in, you agree toUser Agreement

Sign Up