Revit secondary development skills (eight) --- database operation (take mySQL as an example)

Recently, the author is studying the rapid conversion of CAD data to Revit data. Many times we will use CAD drawings. Because there is a lot of information in the dwg file that is not in the RVT file, the author has been studying how to quickly convert the data in the CAD file. Enter effectively into Revit.

The author initially used Teigha’s third-party service tool, used the dll file in Teigha to re-develop, and collected CAD data directly into Revit. It was straightforward, but after doing a lot of projects, I found that many of the data are repeated and complex and regular. . For example, every project will have a building area, every project will have FM***, every project has the same things, and every time they are operating the same things, this is very stupid for developers.

The original idea was to use artificial intelligence to screen, but the author does not yet have enough basic data. Using a simple method to compromise the thinking method, I thought of using a database to store the data in the CAD and build a project library. In the future, Revit wants the data to be extracted directly from the database.

The following is the test process of the database:

1. Download a database management tool, here use Navicat;

 

2. Create a new table, and create the attribute values ​​you need in the table, as follows:

These can be manually operated in the software, of course, can also be implemented using code, depending on the reader's habits.

3. After the table is built, use the code to test, the database operation code is as follows:

 

4. The method of calling the database operation class in the revit operating environment is as follows:

 

5. Run in Revit after compilation, refresh the table in the database after success, the results are as follows:

 

The above is the entire content of the test, if you have any questions, you can leave a message to discuss!

 

The copyright belongs to the individual. Please indicate the URL: https://blog.csdn.net/fengmochen/article/details/87934172

 

 

 

Guess you like

Origin blog.csdn.net/fengmochen/article/details/87934172