Development of an autogeneration program for building a clear height cloud map based on BIM

Because the clear height of a building involves many particularities of buildings, structures and equipment, the traditional design mode can only roughly estimate the clear height of a building and cannot fully reflect the distribution of the clear height of the whole building, which is not conducive to designers’ design and optimization of buildings. To solve this problem, the concept of a cloud map of the clear height of buildings was proposed for the first time. Based on Revit software, a BIM-based, automatic building clear height cloud map generation program, which realized the efficient analysis of BIM model clear height and can quickly obtain the building clear height cloud map, was developed, therefore enhancing the clear height analysis function of Revit. Compared with the traditional clear height area analysis color block diagram, the clear height cloud diagram of BIM was more accurate, which provides an effective technical means for designers to comprehensively evaluate the clear heights of buildings.


Introduction
The building clear height refers to the vertical distance from the floor or ground to the underside of the upper floor or ceiling (Fig. 1). The building clear height is a very important index in architectural design and indicates whether the function of a building meets the use demand, cost [1] of a project, comfort [2] of people's use, and sales positioning [3] of the building. Therefore, in the design stage, the accurate measurement of the clear height of a building is an important element to be analyzed in every aspect of architectural design. However, determining the clear height of a building involves several professions, including architecture, structure, HVAC, water supply and drainage; each profession is represented by different designers, and it is difficult for these designers to master the design contents [4] of other professions. In traditional design, the designers of each profession can only roughly measure the clear height of a typical area of a building through discussion and cannot comprehensively measure the clear height [5] of each point of the building.
The current clear height analysis using BIM technology is manually performed [6]; that is, the clear height of each functional area of a model is measured by means of elevation, section and other views in Revit software to obtain the clear height of each area. This working mode is not only inefficient but also ill-equipped to intuitively determine which areas of clear height do not meet the specification requirements.
Many researchers worldwide have conducted research on the use of BIM technology for headroom analysis. Fengchang [7] Jiang et al. optimized the vertical headroom of each functional area of a hospital building based on the elevation section view in Revit software by "combining" the BIM models of several specialties of the hospital building. Jiao [8] Ren et al. also utilized the BIM model to optimize the vertical headroom of an underground garage by applying BIM technology. The measurement tools in the BIM model were employed to independently measure the areas with possible clear height problems to check whether the measured clear height met the requirements. Wang Peiling [9] applied BIM technology to optimize the HVAC design of a building project and performed direct measurement of the clear height of each area within the project engineering to optimize the project clear height. Shi Hong [10] selected the optimization of a university library reading space design as an example, using BIM technology to optimize pipe synthesis and to effectively improve the clear height of the interior. Leite F [11] combined BIM software for automated collision checking with manual checking of results to supplement and compare. Korman T M [12], Wang J [13], and Khaddaj M [14] employed BIM technology to combine a comprehensive analysis of pipelines with architecture and structure. The combined analysis was carried out to achieve coordination among various disciplines.
However, the above studies use BIM technology to manually generate clear height, and the clear height generated by them is the clear height of each area block. However, the factors affecting clear height, such as pipelines and structural beams in a building, are

Methods
As the mainstream software of today's BIM system, Revit software is one of the most widely employed software programs in China's construction industry BIM system because of its development features, such as strong interactivity, IFC support, parametric modeling, and work sharing. To meet the differentiated needs of users, Revit provides an application programming interface (API), which is a secondary development interface for developers. Developers can develop corresponding functions according to their own needs through the invocation of the API interface and the reference to the completed classes of the package. Therefore, in this study, based on the building model of Revit software, we adopted the Revit API interface for secondary development to realize the function of building a clear height cloud map.

Demand analysis
To realize the intelligent generation of clear height clouds, we need to analyze the clear height of each point of the BIM model and calculate the clear height value of any part of the model through the call of Revit API-related classes to obtain the clear height point cloud dataset (including the location coordinates of points and clear height of points). Second, we processed the data, adopt different colors to mark different clear heights, and combine the data with the positioning of each point. Finally, a cloud map of building clear heights is generated, which can visually reflect the clear heights with different colors. The implementation of the program was based on the effective construction of two modules, namely, a front-end module for parameterization by the user and a backend module for back-end data processing and data image conversion.

Software and hardware environment
Since the building BIM model was three-dimensional and often large in volume, this program requires the analysis of each point, so the computer GPU and CPU running speed requirements were high, i.e., high-performance image processing capabilities and higher intensity of arithmetic were needed. The recommended minimum hardware configuration is Intel(R) Core(TM) I7-7700 or above for CPU, NVIDIA GeForce GTX 1080 or above for graphics, 32G or above for memory, and 4T or above for hard disk. The BIM software selected for the program was Revit 2018; the programming and development software is Visual Studio 2019; the development language is mainly C#; and the database is SQL Server 2018 version.

Architecture of the net high cloud map automatic generation program
This program adopts the more typical, three-level architecture in the monolithic architecture, front-end (PC side) + middle (logical application layer) + back-end (database layer), as shown in Fig. 2. The front end displays the BIM model on Revit software and shows the program running results. The logical application layer implements the corresponding functions according to the development requirements and establishes a connection between the model and the data. The back-end database enables the program to collect, store, and extract data.

Program functional modules of the net high cloud map automator
This program had four main modules according to the functional requirements, namely, the user interaction module, clear height analysis module, positioning module, and clear height cloud map output module. The function of the user interaction module is that the program automatically reads all the floor information in the BIM model and displays it in the Windows Presentation Foundation (WPF) form, which is convenient for the user to view and select. Simultaneously, the accuracy size of detection and the minimum clear height value can be set according to user needs. The suitable accuracy was selected for different project models, i.e., it can be adapted to the fineness requirements of different projects for clear height. The function of the clear height analysis module was described as follows: after the user selects the floor, when clicking on the analysis of The function of the positioning module was to compare the clear height requirements entered by the user with each clear height, obtain the measuring points whose clear height does not meet the requirements, and display them in the WPF window panel.
By clicking the measuring points in the panel that do not meet the requirements, one can directly locate the positions in the plan view and 3D view, which is convenient for users to quickly identify these positions when manually modifying the clear height of a structure. The function of the clear height cloud map module is described as follows: based on the point cloud data obtained after clear height analysis, these data were processed and transformed into intuitive color images, which can generate built-in cloud maps in the Revit software model and external cloud maps outside the software model. The whole procedure is shown in Fig. 3.

Ray algorithm
According to the definition of clear height, the clear height of a certain part shall be calculated, i.e., the distance from the upper surface of the floor to the bottom of the upper floor, beam, and equipment pipeline. Due to the complexity of the building model, it was impossible to accurately determine whether the upper structure was a ceiling or an equipment pipe, so this study used the ray method to obtain the clear height of a certain part. The specific implementation is shown in Fig. 4; i.e., a measurement point was taken on the floor, and then a ray was sent vertically upward. An intersection point was formed when the ray touches the upper floor, beam, equipment piping and other components, and the distance between this intersection point and the measurement point was calculated as the clear height. Because the actual clear height in the space is measured, the measured length was the distance between the rays emitted upward from the top floor to the lower surface of the first object. Therefore, it was not necessary to consider the thickness of the floor decoration and the thickness of the false ceiling.
In the code, we positioned the center of gravity on the upper surface, distributed the measurement points on the floor, stored the points in the points list, created the filter LogicalAndFilter, which can filter all family instances, and then substituted the coordinates of the measurement points and the filter into the ReferenceIntersector's FindNearest algorithm. The distance between the measurement point and the intersection point, which was the clear height that we need, was calculated. Refer to Fig. 5 for the specific code.

Selection of measurement points
To perform a clear height analysis for a particular floor of the model, the clear height of each part of the floor needs to be measured. Therefore, measurement points need to be set at each part. This algorithm calculated the clear height at each measurement point by laying equally spaced measurement points on the upper surface of the floor, and the spacing between the measurement points was controlled by the accuracy entered by the user. Therefore, the clear height of the whole floor was obtained. The specific implementation is shown in Fig. 6. When traversing the points of the whole floor, it is difficult to select the edge of the floor as the initial measurement point because the boundary of the floor was often irregular. Therefore, this study adopted the shape center of the upper surface of the floor as the first measurement point, and by changing its coordinate value, the measurement points are set in all directions. When the measurement point was not on the upper surface of the floor, it is an invalid measurement point, which effectively solves the problem of irregularity of the floor boundary. It is only necessary to count all the valid measuring points, and then the clear height can be calculated by the ray method. For details on how to filter invalid measurement points, please review the codes and relevant texts in Fig. 7. The Revit API does not have a direct method to identify the center of a surface, but it gives a method to identify the center of mass of a geometric form. Therefore, this study adopted a way to obtain the center of the upper surface of the floor slab: first obtain the coordinates of the center of mass of the whole floor slab and then change the Z coordinate of this center of mass so that the value of the Z coordinate of the center of mass was equivalent to the upper surface of the floor slab because the thickness of the floor slab was roughly uniform. Therefore, the center of the upper surface of the floor slab can be obtained. The shape center of the upper surface of the floor slab and its code are shown in Fig. 8.
The center of the upper surface of the floor slab was chosen as the first measurement point to facilitate the setting of a large number of measurement points in all directions. With the first measurement point as the center, other measurement points are set by changing the X coordinate value and Y coordinate value of the measurement point. Since a large number of measurement points have to be set and the size and shape of the floor slabs vary by project, to improve the efficiency of the program execution, it was necessary to choose a suitable laying range for different shapes of floor slabs so that the laying range can cover the whole floor slab without laying in the area outside the floor slab, thus reducing the number of program cycles and improving the program running speed. When laying measurement points, we need to input three parameters: the face of a floor to be measured, the point on the floor "point0" and the measurement accuracy. The program will extend a limited number of other points "point1" in the X and Y directions based on "point0". Some of these "point1" are on the floor, and some may exceed the range of the floor, so we connect "point1" with points (0, 0, 1) in turn. Only when "point 1" is within the range of the floor to be measured will this line intersect with "face", which is the measurement point we need. This intersection is not only the effective measurement point we need, but also the same coordinate as point1.  Presently, there are generally two kinds of commonly employed databases. The first kind of database is the stand-alone database that can be embedded in the SQLite database. The advantages of the stand-along database are that the file is small, occupies very few resources, and can be embedded in the program to become part of the program. The disadvantage of the stand-alone database is that the storage capacity is small, with a maximum of 100,000 levels of data storage. The second kind of database is the enterprise database, such as the MySQL database, SQL Server database, and Oracle database. The advantage of the enterprise database is that it has a very large storage volume; it can store 50 million levels of data. The disadvantages of the enterprise database are that it cannot be embedded into the software program and requires the use of additional database management tools. In the enterprise database, the SQL Server database developed by Microsoft has the best compatibility with C#. Therefore, this study compared the SQLite database and the SQL Server database. The program was run with these two databases, and their performance was compared, as shown in Table 1. The SQL Server database in this program was obviously attributed to the SQL Lite database because of the large number of database read and write operations involved in this study. Therefore, the SQL Server database was chosen for data storage of this program.

Positioning function implementation
After the program finishes the clear height analysis, the data were stored in the backend database and displayed in a WPF window panel for the user to browse. The window panel will display the location of each measurement point and the clear height information in a table. The information of the measurement points that do not meet the clear height requirements will be highlighted so that users can easily distinguish them. The information displayed in the panel was associated with the BIM model, allowing the user to select a row of measurement points on the panel to quickly locate the measurement points in the BIM model, which enables the user to modify the model at that location.

Plan view positioning and focus function
After the user selects a measurement point, to enable the user to quickly view the location of the point, this study provided the function of automatically switching and focusing the view to the vicinity of the measurement point in Revit. The plan positioning in the Revit model was mainly based on the axis network, which is a network composed of building axes; Ii is a tool for marking the detailed dimensions and positioning positions of components in architectural drawings. After the user selects the information of a measurement point, the program will extract the coordinate value of the measurement point, obtain the distance from the measurement point to the axis network according to the algorithm, and identify the nearest horizontal and vertical axis network to the measurement point so that the position of the measurement point in the plan view can be located. The program will automatically switch to the plan view and focus on this measurement point to realize the plan fast positioning function.

Three-dimensional view positioning function
This study provided the user with the ability to quickly access the 3D view of the selected measurement point, which is achieved by locating the positions of the nearby components. The program quickly locates the floor where the measurement point was located and the upper level components that intersect with the ray so that the user can quickly identify the nearby components and directly modify the model to target the parts where the clear height does not match. After the user selects a line of measurement point information, the program will extract the collision point location of the component ID, and according to the ID value, select the component. The component was temporarily isolated and added to the profile box so that the component will be directly displayed in the middle of the 3D view and directly positioned.

Built-in cloud map implementation method
The advantage of the method is that it can correspond with the real position of the model one by one, which enables users to understand the clear height of a specific position. The disadvantage of the method is that the generation speed is slow, which will increase the size of the BIM model and cause computer lag. The implementation method is described as follows: for each effective measurement point, the volume was generated in the BIM model according to the location of the measurement point. The volume cross-section was the mid-span between two measurement points as the side length, and the filling color of the volume cross-section is controlled according to the clear height of the measurement point.

BIM building clear height cloud map intelligent generation program
In this study, the feasibility of the procedure was verified using a single-story underground garage. The construction area of the underground garage is 3857 m2. The BIM model of each specialty of this underground garage was built, and the electromechanical model was linked to the building model. Figures 9 and 10 show the BIM building model and BIM electromechanical model, respectively, of this case.
(1) User interaction function: realize the interaction between the user and the software, select the floor to analyze through the information set and input by the user, and input the analysis accuracy and minimum clear height requirements (Fig. 11).   the minimum clear height of each measurement are compared, and the information on the information panel that does not fit the clear height is displayed in red, as shown in Fig. 12.
(3) Positioning function: The user selects a line of information on the panel, and the program will extract the coordinate information to feed back to the Revit software to position the components in the plan view and 3D view, as shown in Fig. 13.

Results and discussion
This study addressed the problem that the current architectural design cannot fully and accurately reflect the clear height of a building and proposes the concept of building a clear height cloud map for the first time. When using the C# programming language for Revit secondary development, combined with database and WPF technology, the func-  At this stage, due to the limited efficiency of the graphics card, the clear height cloud map had insufficient generation efficiency. It is best to use blocks when analyzing a large area basement or when one wants to generate a clear height cloud map of each floor of a residential building. Therefore, follow-up research can optimize the display strategy of cloud images and improve the demand and generation efficiency of cloud images for graphics cards.

BIM
Building information modeling SQL Structured Query Language WPF Windows Presentation Foundation