Method and system for rapid search of components and associated relationships based on BIM model
By using a multi-level 3D matrix index and a six-layer filtering method in the BIM model, the problems of low efficiency in searching components and complex intersection algorithms in existing 3D BIM models are solved, enabling fast and accurate searching of components and their relationships, thus improving design efficiency and engineering quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 深圳市斯维尔科技股份有限公司
- Filing Date
- 2025-10-22
- Publication Date
- 2026-07-21
Smart Images

Figure CN121350030B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of building engineering technology, and in particular to a method for rapid component search based on BIM (Building Information Modeling) models. Background Technology
[0002] In the design and application of BIM models, it is often necessary to search for components in the BIM model and their associated components (i.e., component relationships). Existing methods for searching components in 3D BIM models have the following technical problems:
[0003] 1. Low search efficiency: The time complexity of searching components in existing 3D BIM models is often high, far below 0(1) (0(1) is used to describe the behavior of a quantity gradually approaching zero as the parameter changes). This means that when facing large-scale 3D BIM models, searching for a specific component and its relationships may take a lot of time. For example, some search methods based on traversing the entire model data structure will have a linear or even exponential increase in search time as the number of components in the model increases, which seriously affects the efficiency of software use.
[0004] 2. Insufficient Utilization of Geometric Features: Most existing search methods fail to fully utilize the geometric features of BIM models for efficient searching. This is because they often focus only on certain specific attributes or simple geometric information of the model during the search, ignoring key geometric features such as the model's bottom outline. For example, when searching for components with specific spatial layouts or shape requirements, it is impossible to quickly and accurately locate the target. This is because an effective indexing mechanism based on key geometric features has not been established, making the search process untargeted and requiring a large number of unnecessary Boolean operations.
[0005] 3. Complex and Inefficient Intersection Algorithms: When performing intersection calculations in the search of components and their relationships, existing intersection algorithms are generally complex and inefficient. Complex algorithms not only increase computational resource consumption but are also prone to errors during calculation. For example, some traditional intersection algorithms require multiple iterations and complex geometric transformations when dealing with intersections of complex-shaped components, resulting in long computation times. Furthermore, they are not accurate enough in handling some boundary conditions, affecting the reliability of search results.
[0006] Therefore, there is a need to provide a rapid search method and system for components and their relationships based on BIM models, which can solve the above-mentioned technical problems. Summary of the Invention
[0007] The purpose of this invention is to provide a rapid search method and system for components and their relationships based on BIM models, which can solve the above-mentioned technical problems.
[0008] This invention is implemented as follows:
[0009] A fast search method for components and their relationships based on a BIM model includes the following steps:
[0010] Step 1: Initialize the core configuration parameters of the search engine;
[0011] Step 2: Initialize all matrix information;
[0012] Step 3: Load the floor information into the matrix from Step 2;
[0013] Step 4: Load the component information into the matrix from Step 3 and create a component index table;
[0014] Step 5: The user inputs polyline or component information, and the search begins;
[0015] Step 6: Calculate the search matrix directly and accurately based on the polyline information;
[0016] Step 7: Obtain a very small number of components from the search matrix in Step 6;
[0017] Step 8: Perform deduplication and fault tolerance processing on the components obtained in Step 7;
[0018] Step 9: Perform a six-layer rapid filtering process on the components after deduplication and fault tolerance in Step 8;
[0019] Step 10: Return the search results.
[0020] In step 1, the core configuration parameters of the search engine include matrix dimension, geometric calculation precision threshold, and caching strategy.
[0021] In step 1, the logging system is started when the search engine is initialized. The logging system is used to record key nodes in the search process of the search engine, including initialization time and search time.
[0022] Step 2 includes the following sub-steps:
[0023] Step 2.1: Define a multi-level three-dimensional matrix data structure, including two levels: "floor matrix" and "component matrix";
[0024] The method for defining the floor matrix is as follows: based on the bottom and top elevations of each floor of the building, the overall space of the building is divided into several floors along the height, and each floor corresponds to a unit of the matrix for macroscopic spatial indexing.
[0025] The method for defining the component matrix is as follows: within each floor, using the architectural coordinate system as a reference, the floor plan is divided into two-dimensional grid cells of fixed size. Each two-dimensional grid cell corresponds to a unique matrix coordinate, which is used to precisely locate the components within that floor.
[0026] Step 2.2: Define matrix indexing rules: Using the architectural coordinate system as the reference, a fixed-size grid division method is adopted:
[0027] In the vertical direction: the floor boundaries are determined by the bottom and top elevations of the floors, forming a floor matrix index;
[0028] In the planar direction: within each floor, the XY plane is divided into a grid of equal size, and each grid corresponds to a unique two-dimensional matrix coordinate (i,j);
[0029] Step 2.3: Initialize and dynamically expand matrix information;
[0030] In step 2.3, when initializing matrix information, default values are set for the floor matrix and component matrix, and storage space is pre-allocated according to the building scale; at the same time, a dynamic expansion interface is reserved to support real-time refreshing of the floor matrix and component matrix data when the BIM model is updated.
[0031] Step 3 includes the following sub-steps:
[0032] Step 3.1: Parse the floor attribute data of the BIM model. The floor attribute data includes floor number, elevation range, and plane boundary coordinates.
[0033] Step 3.2: Based on the floor plan boundary, map the floor attribute data parsed in Step 3.1 to the corresponding area of the floor matrix, and establish a bidirectional index between the floor and the matrix unit.
[0034] Step 4 includes the following sub-steps:
[0035] Step 4.1: Extract the core attributes of all components in the BIM model;
[0036] The core attributes of each component include: unique identifier (ID), floor, component type, bounding box parameters, and bottom outer contour vertex coordinates;
[0037] The component types include: walls, beams, and columns; the bounding box parameters include: minimum X coordinate, minimum Y coordinate, minimum Z coordinate, maximum X coordinate, maximum Y coordinate, and maximum Z coordinate.
[0038] Step 4.2: Based on the spatial position of the bottom outer contour line of the component, map it to the two-dimensional grid cell of the component matrix of the corresponding floor, and record the association between the unique identifier ID of the component and the matrix coordinates to realize the establishment of the component index table;
[0039] Step 4.3: Standardize the geometric data of the components.
[0040] Step 5 includes the following sub-steps:
[0041] Step 5.1: Receive parameters input by the user;
[0042] The system supports two main input modes:
[0043] Mode 1: Polyline input, the input content is one or more polylines, which are closed polygons or open polylines representing planar areas, and each polyline has bottom elevation and top elevation information, thereby defining a prism search range in three-dimensional space;
[0044] Mode 2: Component information input, the input content is the unique identifier ID of the target component or the component type or association type; spatial range source: the system automatically extracts the bottom elevation and top elevation of the component based on its own geometric data, and generates the three-dimensional bounding box of the component by combining the component's planar projection;
[0045] Step 5.2: Parameter validation. If the parameter validation passes, proceed to step 5.3. If the parameter validation fails, the system will return an error message and terminate the search.
[0046] Before performing the search, the system verifies the validity of the parameters input in step 5.1 to ensure that the data is legal and complete. This validity verification includes: polyline input verification and component information input verification. Among them, polyline input verification includes closure check, coordinate validity, and geometric validity, while component information input verification includes component existence, attribute integrity, and legality of association relationships.
[0047] Closure check: If the user's intent is a planar area search, the polyline they input must be closed; non-closed polylines are used in line scan mode.
[0048] Coordinate validity: Check whether the coordinates of all vertices of the polyline are within the global coordinate range of the BIM model, and whether the bottom elevation of the component is less than or equal to the top elevation of the component;
[0049] Geometric validity: The number of vertices of the input polyline is ≥3; there are no self-intersecting or anomalous segments;
[0050] Component Existence: Query the BIM model database based on the component's unique identifier ID to confirm that the component exists and has not been deleted;
[0051] Attribute integrity: Check whether the geometric data of the component is complete, that is, whether the bottom elevation, top elevation and planar range of the component can be extracted;
[0052] Association validity: If an association type is specified, verify that the association type has been defined in the system;
[0053] If any of the above parameters fail the validation, an error message will be returned and the search will be terminated.
[0054] Step 5.3: Search execution;
[0055] When performing a search, the system converts the features of the component search into polylines, and then performs subsequent polyline searches in a unified manner.
[0056] Step 6 includes the following sub-steps:
[0057] Step 6.1: Geometric analytic polylines;
[0058] Step 6.1 includes the following sub-steps:
[0059] Step 6.1.1: Parse the polyline data input by the user and extract the X, Y, and Z coordinates of all vertices of the polyline. The Z coordinate is used to determine the bottom and top elevations of the polyline.
[0060] Step 6.1.2: Calculate the minimum bounding box;
[0061] Calculate the minimum coordinates (minX, minY) and maximum coordinates (maxX, maxY) of the polyline on the XY plane:
[0062] Where, minX = min(px for p in vertices);
[0063] maxX=max(px for p in vertices);
[0064] minY=min(py for p in vertices);
[0065] maxY=max(py for p in vertices);
[0066] Step 6.1.3: Combining the bottom and top elevations of the polyline, obtain the Z range of the polyline's 3D bounding box: Z_min = bottom_elevation;
[0067] Z_max = top_elevation;
[0068] Step 6.1.4: Convert the architectural coordinates of the 3D bounding box of the polyline to matrix index coordinates. The conversion formula is as follows:
[0069] i=floor((X-originX) / gridSize)
[0070] j=floor((Y-originY) / gridSize)
[0071] k=floor((Z-originZ) / gridSize)
[0072] Where originX, originY, and originZ are the origins of the building coordinate system, and gridSize is the size of the two-dimensional grid cell;
[0073] Step 6.2: Floor matrix matching;
[0074] Step 6.2 includes the following sub-steps:
[0075] Step 6.2.1: Based on the Z range of the polyline (Z_min~Z_max), traverse the floor matrix and match all floors that intersect with the Z range;
[0076] Step 6.2.2: The bottom and top elevations of each floor are recorded, and the coverage relationship can be determined by simple comparison.
[0077] if(floor.bottom<=Z_max)and(floor.top>=Z_min):
[0078] Add to the candidate floor list;
[0079] Step 6.2.3: For each candidate floor in the candidate floor list, obtain its corresponding component matrix, i.e., the two-dimensional grid cell index;
[0080] Step 6.3: Generate the search matrix;
[0081] Step 6.3 includes the following sub-steps:
[0082] Step 6.3.1: For the component matrix of each candidate floor, calculate the corresponding two-dimensional mesh element range based on the projection range of the polyline in the XY plane (minX~maxX, minY~maxY):
[0083] start_i=floor((minX-originX) / gridSize)
[0084] end_i=floor((maxX-originX) / gridSize)
[0085] start_j=floor((minY-originY) / gridSize)
[0086] end_j=floor((maxY-originY) / gridSize);
[0087] Step 6.3.2: Generate the search matrix, which is a set of two-dimensional grid cells consisting of (floor index, i, j) triples. These two-dimensional grid cells are candidate regions for subsequent precise search.
[0088] In step 6.3.2, the size of the search matrix is only 0.1% to 5% of the total matrix size in the entire BIM model.
[0089] Step 7 includes the following sub-steps:
[0090] Step 7.1: Each two-dimensional grid cell in the search matrix has a component index table established in the preprocessing stage, which records the unique identification ID of the components contained or intersecting within the two-dimensional grid cell;
[0091] Step 7.2: Traverse all two-dimensional grid cells of the search matrix and collect the unique identification IDs of the components into a candidate set;
[0092] Step 7.3: The selected set is stored using a hash set to avoid duplicate unique identifiers;
[0093] In step 8, the deduplication process includes: when the same component is matched by multiple two-dimensional mesh cells in the candidate set, deduplication is performed using a hash table or ordered list to ensure that each component retains only one record in the candidate results;
[0094] The fault tolerance processing steps include: setting a fault tolerance threshold for boundary cases; if the minimum distance between a component and the search area is less than the fault tolerance threshold, it is considered a "potential intersection" and retained in the candidate results; if the minimum distance between a component and the search area is greater than or equal to the fault tolerance threshold, it is not retained in the candidate results.
[0095] In step 9, the six-layer fast filtering and screening process includes floor filtering and screening, component type filtering and screening, outer bounding box filtering and screening, Z-axis filtering and screening, outer contour line filtering and screening, and Boolean collision filtering and screening.
[0096] When filtering by floor, only components belonging to the floor located by the search matrix are retained;
[0097] When filtering by component type, filter according to the component type specified by the user and exclude components of irrelevant types;
[0098] During the bounding box filtering process, a fast intersection detection is performed on the 3D bounding boxes of candidate components and the 3D bounding boxes of polylines, and components whose 3D bounding boxes do not intersect are directly eliminated.
[0099] When filtering along the Z-axis, the Z-range of the component is checked to see if it overlaps with the search range, based on the height range specified by the user. Components that are completely higher or lower than the search range are removed.
[0100] During the outer contour filtering process, for components that have passed the first four layers of filtering, their two-dimensional outer contours are extracted. A polygon intersection algorithm is used to determine whether the two-dimensional outer contours intersect or contain the polygons. Components that intersect or contain are retained, and components that only intersect with the three-dimensional bounding boxes but do not actually overlap are further removed.
[0101] Step 10 includes the following sub-steps:
[0102] Step 10.1: Organize the search results for components that have passed the six-layer fast filtering and extract their key information;
[0103] The key information extracted from the components includes: ① the component's unique identifier ID, name, type, and floor; ② the component's bottom and top elevations; ③ the component's spatial coordinates; ④ the component's bottom outline data; ⑤ a list of strongly related components; and ⑥ a calculated matching index.
[0104] Step 10.2: Sort and output the search results from high to low according to the calculated matching degree, and prioritize displaying the components with the highest overlap with the search area;
[0105] Step 10.3: Handling exceptions and empty results;
[0106] If the candidate set is empty or all components are filtered, the system returns an empty result set and prompts: "No matching components found".
[0107] If an error occurs during geometric calculation, the system will return an error log, which will include the error type, location, and suggested repair methods.
[0108] A fast search system for a method of quickly searching components and their relationships based on a BIM model includes a memory and a processor. The memory stores the program of the method of quickly searching components and their relationships based on a BIM model, and the processor executes the program of the method of quickly searching components and their relationships based on a BIM model.
[0109] Compared with the prior art, the present invention has the following advantages:
[0110] 1. The search method of the present invention has a constant search time for a specific component and its associated relationships. It is not limited to the size and number of components of the 3D BIM model. It can quickly obtain the required component information and associated relationships. For example, it can quickly find a certain cast-in-place slab (component) and all the walls associated with it on a specific floor. This greatly improves design efficiency and is conducive to completing more design scheme iterations and optimizations in a shorter time. It achieves a search time complexity of O(1).
[0111] 2. This invention focuses on the bottom outer contour line of the model for searching, fully utilizing the model's geometric features. The bottom outer contour line intuitively reflects the model's basic shape and positional relationship in space, making the search highly targeted. When searching for building components with specific shape requirements, such as windows of special shapes or irregularly shaped support structures, it can quickly locate components that meet the criteria, avoiding the processing of a large amount of irrelevant data, thereby improving the accuracy and precision of the search.
[0112] 3. This invention achieves extremely high intersection efficiency through six-layer filtering and optimization. When intersection operations are involved in component relationships, it can quickly and accurately calculate the intersection between different components. For example, when analyzing the connection relationship between beams (components) and columns (components) in a building structure, it can quickly determine which beams and columns intersect, and the calculation results are accurate and reliable. This not only reduces the waste of computing resources but also provides an efficient and accurate data foundation for subsequent collision detection and other work, which is conducive to improving the quality and reliability of the entire project. Attached Figure Description
[0113] Figure 1 This is a flowchart of the fast search method for components and their relationships based on a BIM model according to the present invention. Detailed Implementation
[0114] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0115] Please see the appendix Figure 1 A fast search method for components and their relationships based on a BIM model includes the following steps:
[0116] Step 1: Initialize the core configuration parameters of the search engine.
[0117] In step 1, the core configuration parameters of the search engine include matrix dimension, geometric calculation precision threshold, caching strategy, etc.
[0118] In step 1, the logging system is started when the search engine is initialized. The logging system is used to record key nodes in the search process of the search engine, including initialization time, search time, etc.
[0119] Step 2: Initialize all matrix information.
[0120] Step 2 includes the following sub-steps:
[0121] Step 2.1: Define a multi-level three-dimensional matrix data structure, including two levels: "floor matrix" and "component matrix".
[0122] The method for defining the floor matrix is as follows: based on the bottom elevation and top elevation of each floor of the building, the overall space of the building is divided into several floors along the height direction (i.e., the Z-axis direction), and each floor corresponds to a unit of the matrix for macroscopic spatial indexing.
[0123] The method for defining the component matrix is as follows: within each floor, using the building coordinate system as a reference, the floor plan is divided into two-dimensional grid units of fixed size. Each two-dimensional grid unit corresponds to a unique matrix coordinate, which is used to precisely locate the components within that floor.
[0124] Step 2.2: Define matrix indexing rules.
[0125] Specifically, based on the architectural coordinate system, a fixed-size grid division method is adopted:
[0126] In the vertical direction: the floor boundaries are determined by the bottom and top elevations of the floors, forming a floor matrix index.
[0127] In the planar direction: within each floor, the XY plane is divided into grids of equal size, and each grid corresponds to a unique two-dimensional matrix coordinate (i,j).
[0128] Step 2.3: Initialize and dynamically expand matrix information.
[0129] In step 2.3, when initializing matrix information, default values (such as null or zero values) are set for the floor matrix and component matrix, and storage space is pre-allocated according to the building scale. At the same time, a dynamic expansion interface is reserved to support real-time refreshing of the floor matrix and component matrix data when the BIM model is updated (such as automatically adjusting the dimensions of the floor matrix and component matrix and re-indexing when adding a floor or component).
[0130] In 3D models in the field of architecture (such as BIM models and building digital twin models), "components" are the "smallest functional and identifiable units" that make up the whole building, which are equivalent to the "digital building blocks" of the building. They contain geometric shape information and are associated with attributes such as building function, materials, and specifications. They can also achieve precise spatial positioning through the "floor matrix + component matrix" defined in step 2.1.
[0131] Step 3: Load the floor information into the matrix from Step 2.
[0132] Step 3 includes the following sub-steps:
[0133] Step 3.1: Parse the floor attribute data of the BIM model. The floor attribute data includes floor number, elevation range, plane boundary coordinates, etc.
[0134] Step 3.2: Based on the floor plan boundary, map the floor attribute data parsed in Step 3.1 to the corresponding area of the floor matrix, and establish a bidirectional index between the floor and the matrix unit.
[0135] The area where a matrix unit is located can be quickly located by the floor plan boundary; conversely, the floor to which a matrix unit belongs can be looked up by the matrix unit.
[0136] Step 4: Load the component information into the matrix from Step 3 and create a component index table.
[0137] Step 4 includes the following sub-steps:
[0138] Step 4.1: Extract the core attributes of all components in the BIM model.
[0139] The core attributes of each component (stored through the BIM model database) include: unique identifier ID, floor, component type, outer bounding box parameters, and coordinates of the bottom outer contour vertex.
[0140] The component types include: walls, beams, columns, etc., and the bounding box parameters include: minimum X coordinate, minimum Y coordinate, minimum Z coordinate, maximum X coordinate, maximum Y coordinate, maximum Z coordinate, etc.
[0141] Step 4.2: Based on the spatial position of the bottom outer contour line of the component, map it (by determining whether the bottom outer contour line contains or intersects with the two-dimensional grid cell) to the two-dimensional grid cell of the component matrix of the corresponding floor, and record the association between the unique identifier ID of the component and the matrix coordinates to realize the establishment of the component index table.
[0142] Step 4.3: Standardize the geometric data of the component, such as its outer bounding box and bottom outline, for example, unify the coordinate accuracy to the millimeter level, in order to prepare for subsequent rapid calculations.
[0143] Step 5: The user inputs parameters such as polylines or component information, and the search begins.
[0144] Step 5 is used to receive the search criteria input by the user, execute different spatial retrieval logic according to the input type, and return the component results that meet the criteria.
[0145] Step 5 includes the following sub-steps:
[0146] Step 5.1: Receive parameters input by the user.
[0147] The system supports two main input modes, which users can choose according to their needs:
[0148] Mode 1: Polyline Input (Spatial Region Search). The input content is one or more polylines. The polyline can be a closed polygon (representing a planar region) or an open polyline. Each polyline has bottom elevation and top elevation information, so a prism search range can be defined in three-dimensional space (the prism is composed of the projection of the polyline on the XY plane and the height range Zmin~Zmax).
[0149] Mode 1 is applicable to the following scenarios: searching for all components within a specified spatial area (e.g., searching for all air ducts and water pipes between the elevations of 3.6m and 6.6m in a 10m×8m room on the east side of the 3rd floor).
[0150] Mode 2: Component information input (precise association search), the input content is the unique identifier ID of the target component (such as component ID).
[0151] The input content for component information can also be: component type (such as beam, column, air duct, wall, etc.) and relationship type (such as "support", "intersection", "containment", etc.).
[0152] Spatial extent source: The system automatically extracts the bottom and top elevations of the component based on its own geometric data, and generates the component's three-dimensional bounding box by combining the component's planar projection.
[0153] Applicable scenarios for Mode 2:
[0154] ① Search for other components that "collide (intersect)" with the specified component.
[0155] ② Search for components that are related to the specified component (such as columns that support it, pipes that connect to it, walls that it passes through, etc.).
[0156] Step 5.2: Parameter validation. If the parameter validation passes, proceed to step 5.3. If the parameter validation fails, the system will return an error message and terminate the search.
[0157] Before executing the search, the system needs to validate the parameters input in step 5.1 to ensure the data is legal and complete. This validation includes: polyline input validation and component information input validation. Polyline input validation includes closure checks, coordinate validity, and geometric validity, while component information input validation includes component existence, attribute completeness, and the legality of relationships. Specific rules are as follows:
[0158] Closure check: If the user's intent is to search a planar region, the polyline they input must be closed; non-closed polylines can be used in line scan mode.
[0159] Coordinate validity: Check whether the coordinates of all vertices of the polyline are within the global coordinate range of the BIM model (i.e., within the height range of the BIM model), and whether the bottom elevation of the component is less than or equal to the top elevation of the component.
[0160] Geometric validity: The number of vertices of the input polyline is ≥3 (closed region); there are no self-intersecting or abnormal line segments (such as line segment length is 0).
[0161] Component Existence: Query the BIM model database based on the component's unique identifier ID to confirm that the component exists and has not been deleted.
[0162] Attribute integrity: Check whether the geometric data of the component is complete, that is, the bottom elevation, top elevation and planar range of the component can be extracted.
[0163] Association validity: If an association type is specified, it must be verified that the association type has been defined in the system (such as "support", "intersection", "containment" etc.).
[0164] If any of the above parameter validations fails, an error message will be returned (such as "polyline not closed", "component's unique identifier ID does not exist", "elevation range is invalid", etc.), and the search will be terminated.
[0165] Step 5.3: Search execution.
[0166] When performing a search, the system converts the features of the component search into polylines, and then performs subsequent polyline searches in a unified manner.
[0167] Step 6: Calculate the search matrix directly and accurately based on the polyline information.
[0168] Step 6 is used to efficiently map the spatial range of the polyline input by the user to a pre-established multi-level three-dimensional matrix index structure, generating a "search matrix", which contains only a set of two-dimensional mesh cells that may contain the target component, thereby greatly reducing the amount of subsequent geometric calculations.
[0169] Step 6 includes the following sub-steps:
[0170] Step 6.1: Geometric analysis of polylines.
[0171] Step 6.1 includes the following sub-steps:
[0172] Step 6.1.1: Parse the polyline data input by the user and extract the X, Y, and Z coordinates of all vertices of the polyline. The Z coordinate is used to determine the bottom and top elevations of the polyline.
[0173] Step 6.1.2: Calculate the minimum bounding box (AABB).
[0174] Specifically, calculate the minimum coordinates (minX, minY) and maximum coordinates (maxX, maxY) of the polyline on the XY plane:
[0175] Where, minX = min(px for p in vertices);
[0176] maxX=max(px for p in vertices);
[0177] minY=min(py for p in vertices);
[0178] maxY=max(py for p in vertices).
[0179] Step 6.1.3: Combining the polyline's built-in bottom elevation and top elevation, obtain the Z-range of the polyline's 3D bounding box:
[0180] Z_min = bottom_elevation;
[0181] Z_max = top_elevation.
[0182] Step 6.1.4: Convert the architectural coordinates (meters, millimeters, etc.) of the polyline's 3D bounding box into matrix index coordinates. The conversion formula is as follows:
[0183] i=floor((X-originX) / gridSize)
[0184] j=floor((Y-originY) / gridSize)
[0185] k=floor((Z-originZ) / gridSize)
[0186] Where originX, originY, and originZ are the origins of the building coordinate system, and gridSize is the size of the two-dimensional grid cell.
[0187] Step 6.2: Floor matrix matching.
[0188] Step 6.2 includes the following sub-steps:
[0189] Step 6.2.1: Based on the Z range of the polyline (Z_min~Z_max), traverse the floor matrix and match all floors that intersect with the Z range.
[0190] Step 6.2.2: The bottom and top elevations of each floor are recorded, and the coverage relationship can be determined by simple comparison.
[0191] if(floor.bottom<=Z_max)and(floor.top>=Z_min):
[0192] Add to the candidate floor list.
[0193] Step 6.2.3: For each candidate floor in the candidate floor list, obtain its corresponding component matrix (i.e., two-dimensional grid cell index).
[0194] Step 6.3: Generate the search matrix.
[0195] Step 6.3 includes the following sub-steps:
[0196] Step 6.3.1: For the component matrix of each candidate floor, calculate the corresponding two-dimensional mesh element range based on the projection range of the polyline in the XY plane (minX~maxX, minY~maxY):
[0197] start_i=floor((minX-originX) / gridSize)
[0198] end_i=floor((maxX-originX) / gridSize)
[0199] start_j=floor((minY-originY) / gridSize)
[0200] end_j=floor((maxY-originY) / gridSize).
[0201] Step 6.3.2: Generate the search matrix, which is a set of two-dimensional grid cells consisting of (floor index, i, j) triples. These two-dimensional grid cells are candidate regions for subsequent precise search.
[0202] In step 6.3.2, the size of the search matrix is usually only 0.1% to 5% of the total matrix size in the BIM model, which achieves extremely rapid focusing of the spatial range.
[0203] Step 7: Obtain a very small number of components from the search matrix in Step 6.
[0204] Step 7 includes the following sub-steps:
[0205] Step 7.1: Each two-dimensional grid cell in the search matrix has a component index table established in the preprocessing stage (i.e., steps 2 to 4), which records the unique identification ID of the components contained or intersecting within the two-dimensional grid cell.
[0206] Preferably, the component index table can be a hash table or an array.
[0207] Step 7.2: Traverse all two-dimensional grid cells of the search matrix and collect the unique identification IDs of the components into a candidate set.
[0208] Since the search matrix range is very small (for example, in a BIM model with hundreds of thousands of components, the candidate set is usually less than 0.1% of the total number of components), this step can significantly reduce the amount of subsequent geometric calculations.
[0209] Step 7.3: The candidate set can be stored using a hash set to avoid duplicate unique identification IDs (although deduplication will be performed in step 8, avoiding duplicates in advance can further improve efficiency).
[0210] Step 8: Perform deduplication and fault tolerance processing on the components obtained in Step 7.
[0211] In step 8, the deduplication process includes: In the candidate set, there may be cases where the same component is matched by multiple 2D grid cells (e.g., a component spans multiple 2D grid cells). Deduplication is performed using a hash table or ordered list to ensure that each component retains only one record in the candidate results. The number of 2D grid cells matched by a component can be recorded for subsequent matching degree ranking (the more 2D grid cells covered, the higher the possible overlap with the search area).
[0212] In step 8, the error tolerance processing steps include: for boundary conditions, such as minor deviations between the outer contour of a component and the boundary of a polyline (e.g., modeling errors in a construction model), setting an error tolerance threshold (e.g., 50mm; the error tolerance threshold can be user-defined or automatically set according to project accuracy requirements). If the minimum distance between the component and the search area is less than the error tolerance threshold, it is considered a "potential intersection" and retained in the candidate results; if the minimum distance between the component and the search area is greater than or equal to the error tolerance threshold, it is not retained in the candidate results.
[0213] Step 9: Perform a six-layer fast filtering process on the components after deduplication and fault tolerance in Step 8.
[0214] In step 9, the six-layer fast filtering process includes floor filtering, component type filtering, outer bounding box filtering, Z-axis filtering, outer contour filtering, and Boolean collision filtering (optional).
[0215] These six layers of fast filtering are executed in order of increasing computational complexity, gradually narrowing down the candidate set and ultimately retaining only highly relevant components.
[0216] During floor filtering, only components belonging to the floors located by the search matrix are retained. By utilizing fast comparison of floor IDs, the time complexity can be achieved to O(1).
[0217] When filtering by component type, the filter excludes components of irrelevant types based on the component type specified by the user (such as "column", "beam", "duct").
[0218] The component type is stored in the attribute table when the BIM model is loaded, and filtering can be achieved directly through hash lookup, with a time complexity of O(1).
[0219] During the outer bounding box filtering process, a fast intersection detection (i.e., AABB-AABB test) is performed on the 3D bounding boxes of candidate components and the 3D bounding boxes of polylines. Components whose 3D bounding boxes do not intersect are directly eliminated, and the time complexity can reach O(1).
[0220] When filtering along the Z-axis, the system checks whether the Z-range of the component overlaps with the search range based on the user-specified height range (e.g., floor bottom elevation ±500mm), and removes components that are completely higher or lower than the search range.
[0221] During the outer contour filtering process, for components that have passed the first four layers of filtering, their two-dimensional outer contours (projections on the corresponding floor plan) are extracted. A polygon intersection algorithm (such as Sutherland-Hodgman clipping or Bentley-Ottmann algorithm) is used to determine whether the two-dimensional outer contours intersect or contain the polylines. Components that intersect or contain are retained, and components that only intersect in three-dimensional bounding boxes but do not actually overlap in geometry can be further removed.
[0222] Boolean operations can be implemented using open-source libraries (such as CGAL and Clipper), but the computational cost is high, so they are only an optional final step. If the user enables precise collision checking, then 3D Boolean operations or precise intersection tests are performed on the remaining components that have passed the first five layers of filtering. Components that pass the Boolean collision filtering and are deemed "true intersections" are retained.
[0223] Boolean collision is a commonly used collision checking method in this field, and its calculation process will not be elaborated here.
[0224] Step 10: Return the search results.
[0225] Step 10 includes the following sub-steps:
[0226] Step 10.1: Organize the search results for the components that have passed the six-layer fast filtering and extract their key information.
[0227] In step 10.1, the key information of the extracted components includes: ① the component's unique identification ID, name, type, and floor; ② the component's bottom and top elevations; ③ the component's spatial coordinates (center point coordinates or bounding box vertex coordinates); ④ the component's bottom outer contour data; ⑤ a list of strongly related components (such as supports, connections, and containment relationships); and ⑥ calculated matching indexes, such as the percentage of overlapping contour areas, the percentage of intersecting volumes, and the number of two-dimensional grid cells covered by the search matrix.
[0228] Step 10.2: Sort and output the search results from high to low according to the calculated matching degree, and prioritize displaying the components with the highest overlap with the search area.
[0229] Taking a structured format (JSON / XML) return as an example:
[0230] json
[0231] {
[0232] "Component ID":"BEAM-12345",
[0233] Name: Main Beam - 200x400
[0234] Type: "Beam"
[0235] Floor: "3F"
[0236] Bottom elevation: 3.6
[0237] Top elevation: 4.0
[0238] Spatial Relationship: "Partial Intersection"
[0239] Match score: 0.85
[0240] }
[0241] Step 10.3: Handling of exceptions and empty results.
[0242] Specifically, if the candidate set is empty or all components are filtered, the system returns an empty result set and prompts: "No matching component found".
[0243] If an anomaly occurs during geometric calculations (such as coordinate overflow or polygon self-intersection), the system will return an error log. The error log will contain the error type, location, and suggested repair methods to facilitate debugging.
[0244] A fast search system for components and their relationships based on a BIM model includes a memory and a processor, such as a computer device and its storage medium. The memory is used to store a program for a fast search method for components and their relationships based on a BIM model, and the processor is used to execute the program for the fast search method for components and their relationships based on a BIM model, i.e., steps 1 to 10 above.
[0245] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the invention. Therefore, any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A fast search method for components and their relationships based on a BIM model, characterized by: Includes the following steps: Step 1: Initialize the core configuration parameters of the search engine; Step 2: Initialize all matrix information; Step 2 includes the following sub-steps: Step 2.1: Define a multi-level three-dimensional matrix data structure, including two levels: "floor matrix" and "component matrix"; The method for defining the floor matrix is as follows: based on the bottom and top elevations of each floor of the building, the overall space of the building is divided into several floors along the height, and each floor corresponds to a unit of the matrix for macroscopic spatial indexing. The method for defining the component matrix is as follows: within each floor, using the architectural coordinate system as a reference, the floor plan is divided into two-dimensional grid cells of fixed size. Each two-dimensional grid cell corresponds to a unique matrix coordinate, which is used to precisely locate the components within that floor. Step 2.2: Define matrix indexing rules: Using the architectural coordinate system as the reference, a fixed-size grid division method is adopted: In the vertical direction: the floor boundaries are determined by the bottom and top elevations of the floors, forming a floor matrix index; In the planar direction: within each floor, the XY plane is divided into a grid of equal size, and each grid corresponds to a unique two-dimensional matrix coordinate (i,j); Step 2.3: Initialize and dynamically expand matrix information; In step 2.3, when initializing matrix information, default values are set for the floor matrix and component matrix, and storage space is pre-allocated according to the building scale; at the same time, a dynamic expansion interface is reserved to support real-time refreshing of the floor matrix and component matrix data when the BIM model is updated; Step 3: Load the floor information into the matrix from Step 2; Step 4: Load the component information into the matrix from Step 3 and create a component index table; Step 5: The user inputs polyline or component information, and the search begins; Step 6: Calculate the search matrix directly and accurately based on the polyline information; Step 7: Obtain a very small number of components from the search matrix in Step 6; Step 8: Perform deduplication and fault tolerance processing on the components obtained in Step 7; Step 9: Perform a six-layer rapid filtering process on the components after deduplication and fault tolerance in Step 8; Step 10: Return the search results.
2. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: In step 1, the core configuration parameters of the search engine include matrix dimension, geometric calculation precision threshold, and caching strategy. In step 1, the logging system is started when the search engine is initialized. The logging system is used to record key nodes in the search process of the search engine, including initialization time and search time.
3. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: Step 3 includes the following sub-steps: Step 3.1: Parse the floor attribute data of the BIM model. The floor attribute data includes floor number, elevation range, and plane boundary coordinates. Step 3.2: Based on the floor plan boundary, map the floor attribute data parsed in Step 3.1 to the corresponding area of the floor matrix, and establish a bidirectional index between the floor and the matrix unit.
4. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: Step 4 includes the following sub-steps: Step 4.1: Extract the core attributes of all components in the BIM model; The core attributes of each component include: unique identifier (ID), floor, component type, bounding box parameters, and bottom outer contour vertex coordinates; The component types include: walls, beams, and columns; the bounding box parameters include: minimum X coordinate, minimum Y coordinate, minimum Z coordinate, maximum X coordinate, maximum Y coordinate, and maximum Z coordinate. Step 4.2: Based on the spatial position of the bottom outer contour line of the component, map it to the two-dimensional grid cell of the component matrix of the corresponding floor, and record the association between the unique identifier ID of the component and the matrix coordinates to realize the establishment of the component index table; Step 4.3: Standardize the geometric data of the components.
5. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: Step 5 includes the following sub-steps: Step 5.1: Receive parameters input by the user; The system supports two main input modes: Mode 1: Polyline input, the input content is one or more polylines, which are closed polygons or open polylines representing planar areas, and each polyline has bottom elevation and top elevation information, thereby defining a prism search range in three-dimensional space; Mode 2: Component information input, the input content is the unique identifier ID of the target component or the component type or association type; spatial range source: the system automatically extracts the bottom elevation and top elevation of the component based on its own geometric data, and generates the three-dimensional bounding box of the component by combining the component's planar projection; Step 5.2: Parameter validation. If the parameter validation passes, proceed to step 5.
3. If the parameter validation fails, the system will return an error message and terminate the search. Before performing the search, the system verifies the validity of the parameters input in step 5.1 to ensure that the data is legal and complete. This validity verification includes: polyline input verification and component information input verification. Among them, polyline input verification includes closure check, coordinate validity, and geometric validity, while component information input verification includes component existence, attribute integrity, and legality of association relationships. Closure check: If the user's intent is a planar area search, the polyline they input must be closed; non-closed polylines are used in line scan mode. Coordinate validity: Check whether the coordinates of all vertices of the polyline are within the global coordinate range of the BIM model, and whether the bottom elevation of the component is less than or equal to the top elevation of the component; Geometric validity: The number of vertices of the input polyline is ≥3; there are no self-intersecting or anomalous segments; Component Existence: Query the BIM model database based on the component's unique identifier ID to confirm that the component exists and has not been deleted; Attribute integrity: Check whether the geometric data of the component is complete, that is, whether the bottom elevation, top elevation and planar range of the component can be extracted; Association validity: If an association type is specified, verify that the association type has been defined in the system; If any of the above parameters fail the validation, an error message will be returned and the search will be terminated. Step 5.3: Search execution; When performing a search, the system converts the features of the component search into polylines, and then performs subsequent polyline searches in a unified manner.
6. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: Step 6 includes the following sub-steps: Step 6.1: Geometric analytic polylines; Step 6.1 includes the following sub-steps: Step 6.1.1: Parse the polyline data input by the user and extract the X, Y, and Z coordinates of all vertices of the polyline. The Z coordinate is used to determine the bottom and top elevations of the polyline. Step 6.1.2: Calculate the minimum bounding box; Calculate the minimum coordinates (minX, minY) and maximum coordinates (maxX, maxY) of the polyline on the XY plane: Where, minX = min(px for p in vertices); maxX = max(px for p in vertices); minY = min(py for p in vertices); maxY = max(py for p in vertices); Step 6.1.3: Combining the bottom and top elevations of the polyline, obtain the Z range of the polyline's 3D bounding box: Z_min = bottom_elevation; Z_max = top_elevation; Step 6.1.4: Convert the architectural coordinates of the 3D bounding box of the polyline to matrix index coordinates. The conversion formula is as follows: i = floor((X - originX) / gridSize) j = floor((Y - originY) / gridSize) k = floor((Z - originZ) / gridSize) Where originX, originY, and originZ are the origins of the building coordinate system, and gridSize is the size of the two-dimensional grid cell; Step 6.2: Floor matrix matching; Step 6.2 includes the following sub-steps: Step 6.2.1: Based on the Z range of the polyline (Z_min~Z_max), traverse the floor matrix and match all floors that intersect with the Z range; Step 6.2.2: The bottom and top elevations of each floor are recorded, and the coverage relationship can be determined by simple comparison. if(floor.bottom <= Z_max) and (floor.top >= Z_min): Add to the candidate floor list; Step 6.2.3: For each candidate floor in the candidate floor list, obtain its corresponding component matrix, i.e., the two-dimensional grid cell index; Step 6.3: Generate the search matrix; Step 6.3 includes the following sub-steps: Step 6.3.1: For the component matrix of each candidate floor, calculate the corresponding two-dimensional mesh element range based on the projection range of the polyline in the XY plane (minX~maxX, minY~maxY): start_i = floor((minX - originX) / gridSize) end_i = floor((maxX - originX) / gridSize) start_j = floor((minY - originY) / gridSize) end_j = floor((maxY - originY) / gridSize); Step 6.3.2: Generate the search matrix, which is a set of two-dimensional grid cells consisting of (floor index, i, j) triples. These two-dimensional grid cells are candidate regions for subsequent precise search. In step 6.3.2, the size of the search matrix is only 0.1% to 5% of the total matrix size in the BIM model.
7. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: Step 7 includes the following sub-steps: Step 7.1: Each two-dimensional grid cell in the search matrix has a component index table established in the preprocessing stage, which records the unique identification ID of the components contained or intersecting within the two-dimensional grid cell; Step 7.2: Traverse all two-dimensional grid cells of the search matrix and collect the unique identification IDs of the components into a candidate set; Step 7.3: The selected set is stored using a hash set to avoid duplicate unique identifiers; In step 8, the deduplication process includes: when the same component is matched by multiple two-dimensional mesh cells in the candidate set, deduplication is performed using a hash table or ordered list to ensure that each component retains only one record in the candidate results; The fault tolerance processing steps include: setting a fault tolerance threshold for boundary cases; if the minimum distance between a component and the search area is less than the fault tolerance threshold, it is considered a "potential intersection" and retained in the candidate results; if the minimum distance between a component and the search area is greater than or equal to the fault tolerance threshold, it is not retained in the candidate results.
8. The fast search method for components and their relationships based on a BIM model according to claim 1, characterized in that: In step 9, the six-layer fast filtering and screening process includes floor filtering and screening, component type filtering and screening, outer bounding box filtering and screening, Z-axis filtering and screening, outer contour line filtering and screening, and Boolean collision filtering and screening. When filtering by floor, only components belonging to the floor located by the search matrix are retained; When filtering by component type, filter according to the component type specified by the user and exclude components of irrelevant types; During the bounding box filtering process, a fast intersection detection is performed on the 3D bounding boxes of candidate components and the 3D bounding boxes of polylines, and components whose 3D bounding boxes do not intersect are directly eliminated. When filtering along the Z-axis, the Z-range of the component is checked to see if it overlaps with the search range, based on the height range specified by the user. Components that are completely higher or lower than the search range are removed. During the outer contour filtering process, for components that have passed the first four layers of filtering, their two-dimensional outer contours are extracted. A polygon intersection algorithm is used to determine whether the two-dimensional outer contours intersect or contain the polygons. Components that intersect or contain are retained, and components that only intersect with the three-dimensional bounding boxes but do not actually overlap are further removed. Step 10 includes the following sub-steps: Step 10.1: Organize the search results for components that have passed the six-layer fast filtering and extract their key information; The key information extracted from the components includes: ① the component's unique identifier ID, name, type, and floor; ② the component's bottom and top elevations; ③ the component's spatial coordinates; ④ the component's bottom outline data; ⑤ a list of strongly related components; and ⑥ a calculated matching index. Step 10.2: Sort and output the search results from high to low according to the calculated matching degree, and prioritize displaying the components with the highest overlap with the search area; Step 10.3: Handling exceptions and empty results; If the candidate set is empty or all components are filtered, the system returns an empty result set and prompts: "No components matching the criteria were found"; If an error occurs during geometric calculation, the system will return an error log, which will include the error type, location, and suggested repair methods.
9. A rapid search system for a rapid search method based on BIM models of components and their relationships as described in any one of claims 1-8, characterized in that: It includes a memory and a processor. The memory is used to store a program for a fast search method for components and their relationships based on the BIM model, and the processor is used to execute the program for the fast search method for components and their relationships based on the BIM model.