A method, device, and electronic equipment for full BIM data parsing and database entry.
By parsing and storing all data from IFC files, component attributes are obtained and merged, relationship information is constructed, and spatial location and elevation are calculated. This solves the problems of incomplete data, inaccurate elevation, and low storage efficiency in existing technologies, and achieves efficient and accurate data storage and querying.
Patent Information
- Application Number
- CN202611627416.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-21
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies for extracting BIM data from IFC files suffer from problems such as insufficient data integrity, inaccurate elevation calculations, lack of structured database mapping mechanisms, and incomplete relationship parsing. These issues result in low data entry efficiency and an inability to meet the accuracy requirements of engineering applications.
This paper presents a method for parsing and storing full BIM data. By acquiring the target building file, parsing the basic information of the components, extracting and merging attribute information, constructing relationship information, calculating spatial location and elevation information, and determining the material type through a two-level search strategy, the data is finally written into a structured database.
It achieves full data coverage of IFC files, ensuring data integrity and accuracy, improving data entry efficiency, and supporting comprehensive information query and analysis.
Smart Images

Figure CN123115099A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, and electronic device for full BIM data parsing and database entry. Background Technology
[0002] Building Information Modeling (BIM) technology has become a core support for building lifecycle management, while Industry Foundation Classes (IFC) standards, as open data exchange formats, are widely used for data interoperability between different BIM software. In practical engineering applications, it is often necessary to extract geometric and non-geometric data of building components from IFC files and write them into a structured database to support subsequent applications such as schedule management, cost accounting, and spatial analysis.
[0003] In current engineering practice, data extraction from IFC files mainly relies on two types of technical solutions: The first is the data export solution from professional BIM software, which provides an Application Programming Interface (API) allowing users to write C# or Python scripts to extract component attributes line by line. However, this solution requires users to implement the traversal logic, attribute filtering, and database entry themselves, resulting in high development costs and difficulty in cross-platform reuse. The second type is a secondary development solution based on open-source IFC parsing libraries. For example, open-source libraries such as IfcOpenShell provide Python / C++ programming interfaces, supporting IFC file loading and entity traversal. Developers can call their APIs to obtain basic component information. However, these open-source libraries only provide low-level model loading and basic parsing capabilities; users must implement all high-level logic such as attribute extraction, relation expansion, coordinate calculation, and database entry themselves. In particular, their geometric calculation interfaces (such as create_shape) generate triangular mesh data for rendering, not directly providing precise elevation information of components in the global coordinate system, which is insufficient to meet the accuracy requirements of engineering applications for elevation data. Summary of the Invention
[0004] This application provides a method, apparatus, and electronic device for full BIM data parsing and storage, which can extract complete and accurate component information from multiple dimensions and achieve efficient parsing and storage of IFC file data.
[0005] This application provides a method for parsing and storing full BIM data, including: Obtain the target building file and parse the target building file to obtain basic component information, which includes at least the component identifier; The attributes associated with the component identifier are extracted from the multiple attribute sets of the target building file, and the extracted attributes are merged and deduplicated to obtain the component attribute information; Traverse the relation entities in the target building file, perform multi-attribute detection and parsing on the relation entities to construct a triple of relation type, relation subject, and relation object to obtain component relation information. The relation entities represent the semantic association between different components. Based on the spatial positioning chain, the spatial coordinates of the component in the global coordinate system are generated to obtain the spatial position of the component. The spatial positioning chain refers to the transformation chain formed by the local spatial positioning entity of the component through recursive reference to the parent spatial positioning entity. Calculate the Z-axis interval of the component in the global coordinate system, and perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs, to obtain the component elevation information; Obtain the category to which the component belongs, and determine the material type and material attributes of the component through a two-level search strategy to obtain the component classification and material information; The basic information of the component, the attribute information of the component, the relationship information of the component, the spatial location of the component, the elevation information of the component, and the classification and material information of the component are written into a structured database for storage.
[0006] Optionally, the attributes associated with the component identifier are extracted from multiple attribute sets of the target building file, and the extracted attributes are merged and deduplicated to obtain component attribute information, including: The association between the preset attribute set and the component is located from the target building file through a reverse lookup mechanism, and the first attribute set of the component is extracted from the preset attribute set. Traverse the association between the preset quantity set and the component in the target building file, extract the engineering quantity value corresponding to the preset measurement type of the component from the preset quantity set, and obtain the second attribute set of the component; Based on the mapping relationship between component types and component instances, the type-common attributes defined on the component type are inherited and associated with the corresponding component instance to obtain the third attribute set of the component; Extract the original attributes of the component itself to obtain a fourth attribute set, and merge the first, second, third and fourth attribute sets to eliminate duplicate attributes generated during the merging process, thereby obtaining the component attribute information.
[0007] Optionally, based on the spatial positioning chain, the spatial coordinates of the component in the global coordinate system are generated to obtain the spatial position of the component, including: The spatial positioning chain is recursively traversed, and the local translation and rotation transformation information recorded by each level of the spatial positioning chain is combined into a global transformation matrix. Based on the translation components in the global transformation matrix, the spatial coordinates of the component in the global coordinate system are determined, and the spatial position of the component is obtained.
[0008] Optionally, the Z-axis interval of the component in the global coordinate system is calculated, and the relative elevation of the Z-axis interval is converted based on the reference elevation of the floor to which the component belongs to obtain the component's elevation information, including: Obtain the geometric representation tree corresponding to the component, and determine the geometric entity type of the geometric representation tree; Based on the recursive transformation strategy corresponding to the geometric entity type and the global transformation matrix, the Z-axis interval of the component in the global coordinate system is calculated. The Z-axis interval includes the global Z-axis minimum value and the global Z-axis maximum value. Calculate the difference between the global Z-axis minimum value and the reference elevation of the floor to which the component belongs to obtain the bottom relative elevation, and calculate the difference between the global Z-axis maximum value and the reference elevation to obtain the top relative elevation; The elevation information of the component is obtained based on the bottom relative elevation and the top relative elevation.
[0009] Optionally, based on the recursive transformation strategy corresponding to the geometric entity type and the global transformation matrix, the Z-axis interval of the component in the global coordinate system is calculated, including: When the geometric entity type is a mapping type, the spatial transformation parameters in the mapping target are parsed to construct the mapping transformation matrix, and the local coordinate transformation parameters in the mapping source are parsed to construct the mapping source transformation matrix; Based on the current local transformation matrix, the mapping transformation matrix, and the mapping source transformation matrix, the cumulative local transformation matrix of the component is generated. The current local transformation matrix refers to the local coordinate transformation matrix passed from the parent node to the current node during the recursive traversal of the geometric representation tree. The sub-geometric entities in the mapping source are recursively processed, and each coordinate point in the sub-geometric entity is transformed to the global coordinate system by the cumulative local transformation matrix and the global transformation matrix. After statistical transformation, the Z-axis components of the coordinate points are statistically analyzed, and the global minimum and maximum Z-axis values are extracted to obtain the Z-axis interval of the component in the global coordinate system.
[0010] Optionally, recursively processing the sub-geometric entities in the mapping source, transforming each coordinate point in the sub-geometric entity to the global coordinate system using the cumulative local transformation matrix and the global transformation matrix, includes: When the geometric entity type of the sub-item geometric entity is an extrusion type, extract the cross-sectional position coordinates and cross-sectional rotation matrix of the sub-item geometric entity, and obtain the cross-sectional bounding box based on the cross-sectional position coordinates; The stretching direction of the sub-item geometric entity is transformed based on the cross-section rotation matrix, and a stretching vector is generated by combining the stretching depth. For each corner point of the cross-sectional boundary frame, the local coordinates of the corner point are used as the starting point of the stretching, and the local coordinates of the corner point are added to the stretching vector to obtain the local coordinates of the stretching endpoint. The local coordinates of the stretching start point and stretching end point are transformed to the global coordinate system sequentially through the cumulative local transformation matrix and the global transformation matrix.
[0011] Optionally, recursively processing the sub-geometric entities in the mapping source, transforming each coordinate point in the sub-geometric entity to the global coordinate system using the cumulative local transformation matrix and the global transformation matrix, includes: When the geometric entity type of the sub-item geometric entity is a face set type, traverse the vertex coordinate list of the sub-item geometric entity and convert each vertex coordinate into a homogeneous coordinate vector; Each homogeneous coordinate vector is transformed into the global coordinate system by the cumulative local transformation matrix and the global transformation matrix in sequence.
[0012] Optionally, a two-level search strategy is used to determine the material type and material properties of the component, thereby obtaining component classification and material information, including: Traverse the material association entities, parse the associated material objects, and obtain the material type to which the component belongs. The material association entities represent the association between the component instance and the material type. For components whose material type has not been resolved, the material type corresponding to the component type to which the component belongs is inherited to the component to obtain the material type to which the component belongs; Extract the material attributes corresponding to the material type to obtain the material information of the component.
[0013] This application also provides a device for full BIM data parsing and storage, including: The basic information module is used to acquire the target building file and parse the target building file to obtain basic component information, which includes at least the component identifier. The attribute information module is used to extract the attributes associated with the component identifier from multiple attribute sets of the target building file, and to merge and deduplicate the extracted attributes to obtain the component attribute information. The relation information module is used to traverse the relation entities in the target building file, perform multi-attribute detection and parsing on the relation entities to construct a triple of relation type, relation subject and relation object to obtain component relation information. The relation entities represent the semantic association between different components. The spatial location module is used to generate the spatial coordinates of the component in the global coordinate system based on the spatial location chain, thereby obtaining the spatial location of the component. The spatial location chain refers to the transformation chain formed by the local spatial location entity of the component through recursive reference to the parent spatial location entity. The elevation information module is used to calculate the Z-axis interval of the component in the global coordinate system, and to perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs, so as to obtain the component elevation information; The material information module is used to obtain the category to which the component belongs, and to determine the material type and material attributes of the component through a two-level search strategy, thereby obtaining the component classification and material information; The storage module is used to write the basic information of the component, the attribute information of the component, the relationship information of the component, the spatial location of the component, the elevation information of the component, and the classification and material information of the component into a structured database for storage.
[0014] This application also provides an electronic device, including a memory storing multiple instructions; the processor loads the instructions from the memory to execute the steps in any of the BIM full data parsing and database entry methods provided in this application.
[0015] This application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in any of the BIM full data parsing and database entry methods provided in this application.
[0016] This application also provides a computer-readable storage medium storing multiple instructions adapted for loading by a processor to execute steps in any of the BIM full data parsing and import methods provided in this application.
[0017] This application embodiment can obtain target building files and parse them to obtain basic component information; extract the attributes associated with component identifiers from multiple attribute sets in the target building files, and merge and deduplicate the extracted attributes to obtain component attribute information; traverse the relational entities in the target building files, perform multi-attribute detection and parsing on the relational entities to construct a triplet of relation type, relation subject, and relation object to obtain component relation information; generate the spatial coordinates of the component in the global coordinate system based on the spatial positioning chain to obtain the component spatial position; calculate the Z-axis interval of the component in the global coordinate system, and perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs to obtain the component elevation information; obtain the category item to which the component belongs, and determine the material type and material attributes of the component through a two-level search strategy to obtain component classification and material information; and write the basic component information, component attribute information, component relation information, component spatial position, component elevation information, component classification and material information into a structured database for storage.
[0018] Because this solution can comprehensively cover multiple data dimensions such as basic information, attributes, relationships, spatial location, elevation, classification and material of components, and adopts differentiated parsing and storage strategies for different data types, it can effectively improve the completeness of BIM full data parsing and the efficiency of data entry. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating a method for parsing and storing full BIM data provided in an embodiment of this application. Figure 2 This is a schematic diagram of the structure of a BIM full data parsing and storage device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] In current engineering practice, data extraction from IFC files mainly suffers from the following shortcomings: (1) Insufficient data integrity. Existing solutions typically only cover basic component information and some attributes when extracting data, omitting key data dimensions such as quantity set, detailed material layer information, classification information, and semantic relationships between components, resulting in the data entering the database being unable to support comprehensive information query and analysis.
[0023] (2) Inaccurate elevation calculation. Existing tools and open-source libraries do not provide a precise elevation calculation method based on recursive accumulation of transformation matrices. Commercial software APIs typically only return the local coordinates of components, and the geometric interfaces of open-source libraries generate rendered meshes rather than precise boundaries. Neither can directly output the top and bottom elevations of components in the global coordinate system, leading to deviations in subsequent spatial analysis and quantity surveying.
[0024] (3) Lack of a structured database mapping mechanism. The existing solution does not support the automatic mapping of the full IFC data to a relational database. Users need to manually write scripts to extract and insert data one by one. This method is not only inefficient, but also difficult to handle the dynamically changing attribute set structure in IFC, and cannot achieve efficient batch data import and flexible querying.
[0025] (4) Incomplete relationship parsing. Existing solutions typically only handle spatial containment relationships when parsing component relationships, omitting various semantic relationships such as aggregation, nesting, and openings. This makes it impossible to fully restore the logical topology between components in the BIM model, thus limiting in-depth application based on relationships.
[0026] Therefore, there is an urgent need for a parsing and data entry method that can cover all dimensions of IFC data, accurately calculate the spatial location and elevation of components, and automatically map them to a structured database, in order to solve the problems of incomplete data, inaccurate elevation, low data entry efficiency, and missing relationships in the existing technologies mentioned above.
[0027] Specifically, this application provides a method for parsing and storing full BIM data. Please refer to [link / reference]. Figure 1 The specific process for this BIM full data parsing and database entry method can be as follows: S110. Obtain the target building file and parse the target building file to obtain basic component information.
[0028] Among them, the target building file refers to the structured data file that carries information about the entire life cycle of the building project. For example, it can be a .ifc format file that conforms to the Industrial Foundation Class (IFC) standard (such as "a commercial complex project.ifc"); or it can be other BIM data exchange format files, such as .ifcXML, .ifcZIP, etc. Basic component information refers to the inherent identifier and core characteristic data of the smallest manageable unit (i.e., building component) in the building information model. It is used to uniquely determine the identity of the component in the model and record its most basic physical and logical attributes.
[0029] Basic component information includes at least the component identifier, such as a globally unique identifier, used to uniquely mark the component in the entire dataset. Additionally, it may include: entity type (entity_type), used to identify the entity category to which the component belongs in the Building Information Model (BIM) to distinguish between different categories such as structural components, architectural components, and MEP components; component name (Name attribute), used to record readable descriptive text assigned to the component by the user or system to assist in manual identification and retrieval, such as "F1-Core Tube-Shear Wall-01"; project information, used to identify the overall building project to which the component belongs, enabling data isolation and traceability in multi-project concurrent environments; site information, used to identify the geographical area or logical site range where the component is located, supporting spatial data filtering and statistics by site dimension; and stage information, used to identify the stage attribute of the component in the building design, construction, or operation and maintenance lifecycle, providing a data foundation for phased management.
[0030] In this embodiment, firstly, the system receives the file path input by the user or automatically scans the specified storage directory to locate and read the target building file, such as an .ifc file in IFC format. Then, the file format is validated to confirm it is a supported BIM data format, and the file content is loaded into a memory buffer. Next, the target building file is parsed line by line or segment by segment. The parsing process may include: identifying file header information (such as model version and encoding method), traversing all entity instance records with a GlobalId (component identifier) attribute in the file body, and extracting basic component information for each entity. For example, the entity type (i.e., the entity category label to which the component belongs) is obtained through entity.is_a(), the component name is obtained by extracting the Name attribute, the project information is obtained through IfcProject, the site information is obtained through IfcSite, and the phase information is obtained by extracting the Phase attribute.
[0031] S120. Extract the attributes associated with the component identifier from the multiple attribute sets of the target building file, and merge and deduplicate the extracted attributes to obtain component attribute information.
[0032] An attribute set is a structured data collection used to organize and store non-geometric information of building components. It encapsulates data items describing component characteristics (such as physical properties, material properties, engineering parameters, functional classifications, etc.) into one or more sets of associated attributes through logical grouping. In the target building file, attribute sets are not from a single source but are distributed across multiple data dimensions, including but not limited to: preset attribute sets directly bound to the component through association (describing the component's functional characteristics), preset quantity sets bound to the component through association (recording the component's geometric or physical measurement values), type-specific attributes defined on the component's type entity (inherited downwards through the mapping relationship between type and instance), and native attribute fields carried by the component entity itself. Each attribute set exists in the form of key-value pairs or attribute lists, providing multi-dimensional information descriptions for the component.
[0033] In some embodiments, the attributes associated with the component identifier are extracted from multiple attribute sets of the target building file, and the extracted attributes are merged and deduplicated to obtain component attribute information, including: S120-1. Locate the association between the preset attribute set and the component in the target building file through a reverse lookup mechanism, and extract the first attribute set of the component from the preset attribute set.
[0034] The preset attribute set (corresponding to the first attribute set) refers to a set of attributes predefined in the target building file to describe the functional characteristics or performance parameters of components. These attributes are bound to one or more components through association relationships. For example, the "fire resistance performance" attribute group describing a wall component might contain key-value pairs such as "fire resistance duration: 2 hours," "combustion performance rating: Class A," and "smoke density rating: s1"; or the "thermal performance" attribute group describing a window component might contain attributes such as "heat transfer coefficient: 2.5 W / (m³)." 2 •K)”, “shading coefficient: 0.6”, etc.
[0035] When extracting the first attribute set, each preset attribute set entity (IfcPropertySet) in the target building file can be traversed. The IfcRelDefinesByProperties relational entity (i.e., the data object representing the binding relationship between the attribute set and the component) referencing the attribute set can be found through back references (such as the get_inverse function). From this, a list of associated component identifiers (RelatedObjects) can be obtained. For example, assuming there is a preset attribute set entity (IfcPropertySet) in the target building file describing the "fire resistance performance" of a wall component, the system uses the get_inverse function to find the IfcRelDefinesByProperties relational entity referencing this attribute set and obtains its RelatedObjects list. This list contains the GlobalId (component identifier) of multiple associated components, such as F1-Wall-001, F1-Wall-002, etc.
[0036] Subsequently, the component identifier (GlobalId) of the current target component is matched against each item in the list to confirm whether the preset attribute set is associated with the component. For preset attribute sets that are confirmed to be associated, the set of attribute items (HasProperties) contained therein is further traversed, and for each attribute item (IfcPropertySingleValue), the attribute name (Name), attribute value (NominalValue.wrappedValue), unit of measurement (Unit), and data type are extracted.
[0037] The data type identification covers a variety of predefined data types, including but not limited to: IfcInteger, IfcReal, IfcString, IfcBoolean, IfcLogical, IfcIdentifier, IfcLabel, IfcText, IfcDate, IfcDateTime, IfcTime, IfcDuration, IfcPositiveLengthMeasure, IfcLengthMeasure, IfcPositiveRatioMeasure, IfcRatioMeasure, IfcAreaMeasure, IfcVolumeMeasure, IfcMassMeasure, and IfcThermodynamicTemperatureMeasure. Specifically, the `is_a()` method can be used to determine the data type of each attribute value, ensuring that the extracted attribute information has an accurate data format and providing a structured first attribute set for subsequent merging and deduplication.
[0038] S120-2. Traverse the association between the preset quantity set and the component in the target building file, extract the engineering quantity value corresponding to the preset measurement type of the component from the preset quantity set, and obtain the second attribute set of the component.
[0039] The preset quantity set (corresponding to the second attribute set) refers to the set of attributes predefined in the target building file for recording the geometric dimensions or physical measurement values of components. These attributes are bound to the components through association relationships, providing a quantitative data foundation for applications such as quantity surveying and cost estimation. For example, the "concrete quantity" group describing a beam component includes measurement values such as "volume: 2.5 cubic meters," "surface area: 15 square meters," and "weight: 6.25 tons," which correspond one-to-one with preset measurement types (such as volume, area, and length).
[0040] When extracting the second attribute set, the association between the preset quantity set and the component in the target building file can be traversed, and the engineering quantity value corresponding to the preset measurement type to which the component belongs can be identified and extracted from the associated preset quantity set.
[0041] Specifically, the preset quantity set contains a variety of predefined measurement categories, and the corresponding numerical fields can be extracted for each category: for IfcQuantityLength (length measurement type), extract its LengthValue (length value); for IfcQuantityArea (area measurement type), extract its AreaValue (area value); for IfcQuantityVolume (volume measurement type), extract its VolumeValue (volume value); for IfcQuantityCount (count measurement type), extract its CountValue (quantity value); for IfcQuantityWeight (weight measurement type), extract its WeightValue (weight value); and for IfcQuantityTime (time measurement type), extract its TimeValue (time value).
[0042] During the extraction of the second attribute set, it is also necessary to determine the accurate unit of measurement for each quantity value. Specifically, the following unit inference strategy can be adopted: First, read the Unit attribute definition carried by the quantity object itself; if the quantity object does not define a unit, then match the project-level unit setting according to the preset measurement type. Specifically, the length measurement type matches entries in IfcSIUnit where UnitType is LENGTHUNIT, the area measurement type matches AREAUNIT, the volume measurement type matches VOLUMEUNIT, the mass measurement type defaults to kg, and the time measurement type defaults to s. Project-level units can be obtained by traversing the UnitsInContext under IfcProject (project entity), supporting two unit types: IfcSIUnit (International Standard Unit) and IfcConversionBasedUnit (conversion-based unit).
[0043] The unit inference strategy described above can automatically complete or correct the units of measurement for the extracted engineering quantity values, ensuring that the quantitative data in the second attribute set has complete dimensional information. Subsequently, the engineering quantity values are associated and classified with the component identifier according to the measurement type, forming a structured second attribute set.
[0044] S120-3. Based on the mapping relationship between component type and component instance, the type general attributes defined on the component type are inherited and associated with the corresponding component instance to obtain the third attribute set of the component.
[0045] Among them, the type-common attributes (corresponding to the third attribute set) refer to the set of attributes defined on the component type entity, which are used to describe the common characteristic parameters of all component instances under that type. These attributes are inherited by each component instance through the mapping relationship between type and instance. For example, the "structural characteristics" attribute group defined on a standard column type entity includes "axial compression bearing capacity: 5000kN", "seismic resistance level: Level 1", "section shape: rectangular", etc. All component instances under this type can inherit these attributes.
[0046] When extracting the third attribute set, the data objects representing type definition relationships (such as the IfcRelDefinesByType relationship entity) are first traversed to establish a mapping from the global type identifier to the list of global instance identifiers (i.e., the type_to_instances mapping table). Then, all type entities ending with "Type" are traversed, and their contained attribute set references (such as the IfcPropertySet attribute in HasPropertySets) are extracted. For each attribute item (such as IfcPropertySingleValue), the attribute name (Name), attribute value (NominalValue.wrappedValue), unit of measurement (Unit), and data type are extracted according to the same logic as the preset attribute set parsing in step S120-1. The extracted attributes are then associated with all component instance identifiers (GlobalId) under that type, thus completing the inheritance of type-general attributes to component instances and obtaining a structured third attribute set.
[0047] S120-4. Extract the original attributes of the component itself to obtain a fourth attribute set, and merge the first attribute set, second attribute set, third attribute set and fourth attribute set to eliminate duplicate attributes generated during the merging process, and obtain the component attribute information.
[0048] Native attributes (corresponding to the fourth attribute set) refer to basic feature fields that are directly attached to the component entity itself and stored along with the entity definition, as opposed to attributes inherited from external attribute sets or type entities through association relationships. These attributes typically describe the inherent physical dimensions, classification labels, or identification information of the component and can be read directly without reverse lookup or relation traversal. For example, fields inherent to the component entity such as "Creation Date: 2024-03-15", "Version Number: V2.1", and "Designer: Zhang San" are examples.
[0049] When extracting the fourth attribute set, you can iterate through the original attribute fields of the component entity itself and put the above-listed attributes (such as ObjectType, OverallHeight, OverallWidth, etc.) into a preset attribute set (such as an attribute group named "Element Specific") as the fourth attribute set of the component.
[0050] Subsequently, the first, second, third, and fourth attribute sets extracted in steps S120-1 to S120-4 are merged. During the merging process, to eliminate duplicate attribute items arising from different data sources (for example, the same "fire resistance performance" attribute may appear simultaneously in both the preset attribute set and the type inheritance attribute), a triplet deduplication method can be used: A set of seen keys (seen_keys) is constructed using a triplet consisting of the component's global identifier (global_id), the attribute set name (pset_name), and the attribute name (property_name). The entire list of attributes to be merged is traversed, retaining only the first occurrence of each triplet, thus filtering out subsequent duplicate attributes with the same name. This results in clean, complete, and non-redundant component attribute information, providing a reliable data foundation for subsequent writing to the structured database.
[0051] S130. Traverse the relation entities in the target building file, perform multi-attribute detection and parsing on the relation entities to construct a triplet of relation type, relation subject, and relation object to obtain component relation information.
[0052] Among them, relational entities represent the semantic associations between different components, that is, data objects used to describe the logical connections between components, between components and spaces, or between components and types in the Building Information Model. For example: connection relationship entities representing physical connection relationships between components (such as IfcRelConnectsElements), containment relationship entities representing spatial containment relationships (such as IfcRelContainedInSpatialStructure), opening entity entities representing opening relationships (such as IfcRelVoidsElement), and covering entity entities representing covering relationships (such as IfcRelCoversBldgElements), etc.
[0053] Component relationship information refers to the data set extracted from the above-mentioned relationship entities, which is used to completely restore the logical topology between components in the BIM model. It includes at least the relationship type (such as connection relationship, spatial containment relationship, opening relationship, and covering relationship), relationship subject, and relationship object, providing a basis for subsequent collision detection, quantity statistics, and spatial analysis.
[0054] When extracting component relationship information, all entities in the target building file whose entity type names begin with "IfcRel" (relationship entity prefix) can be traversed. For each relationship entity, a multi-attribute probing strategy is used to obtain the relationship subject and relationship object. Specifically: Relationship subject retrieval: The system sequentially checks if the current relation entity contains any of the following attributes with a GlobalId (globally unique identifier) value. The first matching result is taken as the relation subject identifier (relating_global_id): RelatingObject (related object) → RelatingElement (related component) → RelatingStructure (related structure) → RelatingSpace (related space) → RelatingBuildingElement (related building component). For example, if the relation entity contains a RelatingObject attribute and the component it points to has a GlobalId, then that attribute is directly used as the relation subject.
[0055] Retrieval of related objects: The following attributes are checked sequentially, and the first existing and non-empty attribute value is taken as the related object identifier list (the `related_global_id` list): `RelatedObjects` (list of related objects, a list type; iterate through and extract the GlobalId of each object) → `RelatedElements` (list of related components) → `RelatedBuildingElement` (related building component, a single object) → `RelatedOpeningElement` (related opening component, a single object) → `RelatedFillElement` (related filling component, a single object). Then, processing is done according to the attribute type: if it's a list type, iterate through each object in the list and extract its GlobalId; if it's a single object, directly extract the object's GlobalId.
[0056] Each relation record contains a relation type (rel_type, i.e., the type name of the relation entity), a relation name (name, the name attribute of the relation entity), a relation subject (relating_global_id), and a list of relation objects (a list of related_global_id). When writing component relation information into a structured database, the one-to-many relationship (one relation subject corresponding to multiple relation objects) that naturally exists in the IFC file can be expanded into multiple one-to-one records. Each record contains a triple (rel_type, relating_global_id, related_global_id) (i.e., a triple of relation type, relation subject, and relation object). The database's unique constraints (such as a composite unique index) ensure that the same relation triples are not entered into the database repeatedly, thus obtaining clean and complete component relation information.
[0057] S140. Based on the spatial positioning chain, generate the spatial coordinates of the component in the global coordinate system to obtain the spatial position of the component.
[0058] The spatial positioning chain refers to a transformation chain formed by the local spatial positioning entities of the component recursively referencing the parent spatial positioning entity. For example, for a concrete column component located on the second floor, the PlacementRelTo (a reference attribute pointing to the parent placement) of its local spatial positioning entity (IfcLocalPlacement) points to the spatial positioning entity of the second floor slab. The spatial positioning entity of the second floor slab further points to the spatial positioning entity of the main building through PlacementRelTo. The spatial positioning entity of the main building then points to the world coordinate system (WorldCoordinateSystem) of the entire project. Thus, a complete spatial positioning chain is formed by tracing back from the component itself layer by layer to the global coordinate system.
[0059] The process of generating the spatial coordinates of the component in the global coordinate system based on the spatial positioning chain and obtaining the spatial position of the component may include: recursively traversing the spatial positioning chain and combining the local translation and rotation transformation information recorded by each level of the spatial positioning chain into a global transformation matrix; determining the spatial coordinates of the component in the global coordinate system based on the translation components in the global transformation matrix, and obtaining the spatial position of the component.
[0060] In practical implementation, the spatial positioning of IFC components can be achieved through recursive references of local placement entities (IfcLocalPlacement). The PlacementRelTo attribute of each placement entity points to the parent placement entity, thus forming the aforementioned spatial positioning chain. For example, by calling a recursive traversal function (such as the get_local_placement function) to traverse upwards along the PlacementRelTo chain layer by layer, the translation components (Location coordinates in RelativePlacement) and rotation components (Axis direction vector and RefDirection reference direction in RelativePlacement, which are orthogonalized to construct a rotation matrix) recorded in each level of local placement entity (IfcLocalPlacement) are combined level by level into a 4×4 homogeneous transformation matrix to obtain the global transformation matrix.
[0061] During the recursive traversal, the cumulative effect of rotation and translation transformations in the positioning chain is automatically handled by sequentially multiplying the local transformation matrix of each node with its inherited cumulative local transformation matrix. When the recursion reaches the top level (i.e., PlacementRelTo is null, pointing to the global coordinate system), the final cumulative multiplication result is the global transformation matrix of the component in the global coordinate system, which fully represents the pose of the component in the global coordinate system. Subsequently, the translation component (i.e., the element value in the fourth column of the first three rows of the matrix) is extracted from the global transformation matrix to obtain the (x, y, z) coordinates of the component in the global coordinate system, thereby determining the spatial position of the component.
[0062] S150. Calculate the Z-axis interval of the component in the global coordinate system, and perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs, to obtain the component elevation information.
[0063] Among them, the component elevation information refers to the data set used to characterize the specific position of the component in the vertical space of the building, obtained by calculating the spatial coordinate range of the component along the vertical direction (Z-axis) in the global coordinate system (i.e., the Z-axis interval, which is a closed interval formed by the coordinate values of the lowest and highest points of the component's geometric entity in the Z-axis direction) and performing relative elevation conversion based on the reference elevation of the floor to which the component belongs (i.e., the reference zero point Z-axis coordinate of the floor in the global coordinate system).
[0064] The component elevation information includes both the absolute Z-axis range (absolute elevation range) of the component in the global coordinate system and the local elevation value (relative elevation) relative to the floor it belongs to, providing a key vertical positioning basis for subsequent component query, statistics and spatial analysis by floor and elevation range.
[0065] For example, a concrete frame beam has a Z-axis range of [10.5m, 10.8m] in the global coordinate system (i.e., the global coordinate of the beam bottom is 10.5m and the global coordinate of the beam top is 10.8m). The floor to which this beam belongs is the "second floor," and the reference elevation of the second floor is 10.0m (i.e., the Z-axis coordinate of the second floor in the global coordinate system). Based on this reference elevation, a relative elevation conversion is performed on the Z-axis range, resulting in a relative elevation of +0.5m for the bottom of the beam and +0.8m for the top of the beam relative to the second floor. The beam's elevation information thus fully includes the aforementioned global Z-axis range [10.5m, 10.8m] and the converted relative elevation data (beam bottom +0.5m, beam top +0.8m). Therefore, after being entered into the database, it supports search operations based on the relative elevation of the floor, such as "querying all beams with second-floor elevations between 0.5m and 0.8m."
[0066] In some embodiments, the process of calculating the Z-axis interval of the component in the global coordinate system and performing relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs to obtain the component's elevation information may include: S150-1. Obtain the geometric representation tree corresponding to the component, and determine the geometric entity type of the geometric representation tree.
[0067] The geometric representation tree refers to a hierarchical tree-like data set in the target building file that organizes the geometric information of components. Its root node corresponds to the geometric representation item of the component, and its child nodes expand sequentially into various geometric entities, Boolean operation nodes, coordinate transformation nodes, and basic geometric elements (such as vertices, edges, and faces). Each node in the tree encapsulates data for a specific geometric construction operation or basic geometric object, and the parent-child relationship between nodes represents the logical order of geometric combinations, nested transformations, or Boolean clipping. By recursively traversing the geometric representation tree, coordinate transformations can be parsed and accumulated level by level, ultimately calculating the precise geometric boundaries of the component in the global coordinate system (including the extreme coordinates in the Z-axis direction).
[0068] For example, the geometric representation tree of a rectangular concrete column member can be represented as follows: Root node: Shape representation (e.g., IfcShapeRepresentation), defining the geometric representation context of the member; First-level child node: Extruded solid node (e.g., IfcExtrudedAreaSolid), describing the three-dimensional solid generated by extruding a two-dimensional section along a specified direction; Second-level child node - Section Profile: Rectangular section definition node (e.g., IfcRectangleProfileDef), recording the section width (e.g., 500mm) and depth (e.g., 500mm); Second-level child node - Extrusion Direction: Direction vector node (e.g., IfcDirection), defining the extrusion direction as the positive Z-axis (0, 0, 1); Second-level child node - Extrusion Depth: Numerical node, recording the extrusion height (e.g., 3000mm); Second-level child node - Position Transformation: Local Placement node (e.g., IfcLocalPlacement), containing the translation and rotation information of the extruded solid in the parent coordinate system.
[0069] The geometric entity types of a geometric representation tree can include: mapping type, stretching type, and face set type.
[0070] S150-2. Based on the recursive transformation strategy corresponding to the geometric entity type and the global transformation matrix, calculate the Z-axis interval of the component in the global coordinate system. The Z-axis interval includes the global Z-axis minimum value and the global Z-axis maximum value.
[0071] In some embodiments, the Z-axis range (minimum Z_min and maximum Z_max) of a component in the global coordinate system can be calculated by recursively traversing the constructed geometric representation tree. This process can be performed recursively on at least the following three geometric entity types: When the geometric entity type is a mapping type, the spatial transformation parameters in the mapping target are parsed to construct a mapping transformation matrix, and the local coordinate transformation parameters in the mapping source are parsed to construct a mapping source transformation matrix. Based on the current local transformation matrix, the mapping transformation matrix, and the mapping source transformation matrix, the cumulative local transformation matrix of the component is generated. The current local transformation matrix refers to the local coordinate transformation matrix passed from the parent node to the current node during the recursive traversal of the geometric representation tree. The sub-geometric entities in the mapping source are recursively processed, and each coordinate point in the sub-geometric entity is transformed to the global coordinate system through the cumulative local transformation matrix and the global transformation matrix. The Z-axis components of the transformed coordinate points are statistically analyzed, and the global Z-axis minimum and global Z-axis maximum values are extracted to obtain the Z-axis interval of the component in the global coordinate system.
[0072] Specifically, the following sub-steps can be performed: Step A: Analyze the IfcCartesianTransformationOperator3D (3D Cartesian coordinate transformation operator) in the MappingTarget to construct a 4×4 mapping transformation matrix (mapping_transform). For example, obtain the translation components from the LocalOrigin attribute and fill them into the translation column of the matrix (the first three elements of the fourth column); obtain the XYZ direction vectors from the Axis1, Axis2, and Axis3 attributes, normalize them, fill them into the first three columns of the matrix respectively, and multiply by the scaling factor Scale (Scale attribute value) to obtain the complete mapping transformation matrix.
[0073] Step B: Parse the MappingOrigin of the MappingSource to obtain the local coordinate transformation matrix of the mapping source, i.e., the mapping source transformation matrix (mapping_origin_matrix). For example, the mapping source transformation matrix can be constructed by extracting the translation component from the Location attribute.
[0074] Step C: Calculate the new cumulative local transformation matrix. Multiply the current local transformation matrix (local_transform) in turn with the mapping transformation matrix (mapping_transform) obtained in Step A and the mapping source transformation matrix (mapping_origin_matrix) obtained in Step B to obtain the new cumulative local transformation matrix: new_local_transform = local_transform × mapping_transform × mapping_origin_matrix.
[0075] Step D: Recursively process the child geometric entities in the MappedRepresentation, passing new_local_transform (cumulative local transformation matrix) as the current local transformation matrix (local_transform). That is, the child entity sees the updated cumulative local transformation matrix. During the recursive traversal, for each coordinate point in the child geometric entity, it undergoes two levels of transformation: the cumulative local transformation matrix (new_local_transform) and the component global transformation matrix (component_transform, i.e., the global transformation matrix obtained in step S140), accurately mapping the coordinate point to the global coordinate system.
[0076] Finally, all transformed coordinate points are statistically analyzed, their Z-axis components are extracted, and the global minimum and maximum Z-axis values are found, thus obtaining the Z-axis interval of the component in the global coordinate system.
[0077] Further, regarding step D, the process of recursively processing the sub-geometric entities in the mapping source and transforming each coordinate point in the sub-geometric entities to the global coordinate system using the cumulative local transformation matrix and the global transformation matrix can include: When the geometric entity type of the sub-item geometric entity is extrusion type, the cross-sectional position coordinates and cross-sectional rotation matrix of the sub-item geometric entity are extracted, and the cross-sectional bounding box is obtained based on the cross-sectional position coordinates; the extrusion direction of the sub-item geometric entity is transformed based on the cross-sectional rotation matrix, and an extrusion vector is generated by combining the extrusion depth; for each corner point of the cross-sectional bounding box, the local coordinates of the corner point are used as the extrusion start point, and the local coordinates of the corner point are added to the extrusion vector to obtain the local coordinates of the extrusion end point; the local coordinates of the extrusion start point and the extrusion end point are transformed to the global coordinate system in sequence through the cumulative local transformation matrix and the global transformation matrix.
[0078] Specifically, the following sub-steps can be performed: Step A: Extract the cross-section position coordinates and rotation matrix. Obtain the cross-section position coordinates and rotation matrix from the Position property (IfcAxis2Placement3D, i.e., the 3D coordinate axis placement definition) of the extruded type entity. For example, obtain the Z-axis direction vector through Axis (axial direction property), obtain the X-axis direction vector through RefDirection (reference direction property), and calculate the Y-axis direction vector using the Gram-Schmidt orthogonalization method to construct a 3×3 rotation matrix. This rotation matrix represents the orientation of the local coordinate system of the cross-section relative to the parent coordinate system.
[0079] Step B: Obtain the section bounding box. Extract the section profile from the SweptArea (scan area property) of the extruded type entity and calculate its interface bounding box. For example, it supports extraction of five common profile types: if it is IfcPolyline, it iterates through its Points (point list) to extract the coordinates of each vertex; if it is IfcIndexedPolyCurve, it extracts the coordinate sequence from IfcCartesianPointList2D / 3D (two-dimensional / three-dimensional Cartesian point list); if it is IfcRectangleProfileDef, it calculates the local coordinates of the four corner points based on XDim (X-direction dimension) and YDim (Y-direction dimension); if it is IfcCircleProfileDef, it calculates the coordinates of its circumscribed rectangle based on Radius; if it is IfcArbitraryClosedProfileDef, it recursively extracts the coordinates of points on its OuterCurve (outer boundary curve) to obtain the section bounding box.
[0080] Step C: Generate the stretch vector. Process the ExtrudedDirection (stretch direction attribute) of the stretch type entity using the 3×3 rotation matrix constructed in Step A above, and then multiply the direction by the stretch depth (Depth attribute value) to obtain the complete stretch vector (i.e., the spatial displacement of the cross section along the stretch direction).
[0081] Step D: Calculate the global coordinates of the starting and ending points and count the extreme values of the Z-axis. For each corner point of the cross-sectional bounding box obtained in Step B, use the coordinates of that corner point in the local coordinate system of the cross-section as the starting point of the stretching, and add the coordinates of that corner point to the stretching vector obtained in Step C to obtain the local coordinates of the stretching ending point. Subsequently, the local coordinates of the stretching starting point and the stretching ending point are transformed into the global coordinate system through two levels of transformation: the cumulative local transformation matrix (new_local_transform, i.e., the current local transformation matrix passed by the parent node in the geometry tree recursion) and the global transformation matrix (component_transform, i.e., the component global transformation matrix obtained in Step S140). Finally, collect the Z-axis components of all transformed points, extract the global Z-axis minimum and global Z-axis maximum values, and thus update the Z-axis interval of the component in the global coordinate system.
[0082] Alternatively, for step D, the process of recursively processing the sub-geometric entities in the mapping source to transform each coordinate point in the sub-geometric entity to the global coordinate system using the cumulative local transformation matrix and the global transformation matrix may include: When the geometric entity type of the sub-item geometric entity is a face set type, the vertex coordinate list of the sub-item geometric entity is traversed, and each vertex coordinate is converted into a homogeneous coordinate vector; each homogeneous coordinate vector is then transformed into the global coordinate system by the cumulative local transformation matrix and the global transformation matrix in sequence.
[0083] Specifically, the face set type (IfcPolygonalFaceSet) is a geometric representation method that describes the surface of a 3D solid using an explicit vertex list and face index. It is often used to represent irregularly shaped or finely modeled components (such as irregular decorative components, complex nodes, etc.). When the geometric entity type of the sub-item geometric entity is a face set type, the Coordinates (vertex coordinate list, corresponding to the CoordList property of the IfcCartesianPointList3D entity) of the face set entity can be directly traversed. This list stores the 3D local coordinates (x, y, z) of all vertices in order.
[0084] For each vertex coordinate in the list, it is first converted into a homogeneous coordinate vector (i.e., a 4×1 column vector) for multiplication with a 4×4 transformation matrix. Then, each homogeneous coordinate vector is mapped to the global coordinate system through two levels of transformation: First, the homogeneous coordinate vector is multiplied by the cumulative local transformation matrix (i.e., the current local transformation matrix passed from the parent node in the geometry tree recursion, which is new_local_transform in the mapping type scenario), transforming the vertex coordinates from the local coordinate system of the face set itself to the component local coordinate system; second, the result from the first level is multiplied by the global transformation matrix (component_transform, i.e., the component global transformation matrix obtained recursively through the spatial positioning chain in step S140), finally obtaining the complete coordinates (x_global, y_global, z_global) of the vertex in the global coordinate system.
[0085] Finally, collect the Z-axis components of all transformed vertices, and compare and update the global Z-axis minimum and maximum values in real time. After traversing the vertex list, the Z-axis interval of the geometric entity of this face set type in the global coordinate system can be obtained.
[0086] For example, the mapping source of an irregularly shaped decorative surface component contains an IfcPolygonalFaceSet, whose Coordinates list contains 8 vertices with local coordinates of (0,0,0), (2,0,0), (2,1,0), (0,1,0), (0,0,3), (2,0,3), (2,1,3), and (0,1,3). After converting each vertex to homogeneous coordinates, it is transformed sequentially by new_local_transform and component_transform. Assuming that the global Z coordinates of the 8 vertices after transformation are 10.0m, 10.0m, 10.0m, 10.0m, 13.0m, 13.0m, 13.0m, and 13.0m respectively, then Z_min=10.0m and Z_max=13.0m are extracted, and this Z-axis interval is included in the calculation of the overall elevation information of the component.
[0087] S150-3. Calculate the difference between the minimum global Z-axis value and the reference elevation of the floor to which the component belongs to obtain the bottom relative elevation, and calculate the difference between the maximum global Z-axis value and the reference elevation to obtain the top relative elevation.
[0088] S150-4. Based on the bottom relative elevation and the top relative elevation, obtain the elevation information of the component.
[0089] Specifically, the baseline elevation of the floor to which the component belongs is first obtained. By traversing data objects representing spatial containment relationships (such as the IfcRelContainedInSpatialStructure relation entity), the floor to which the component belongs (such as the IfcBuildingStorey floor entity) is found from the component, and the Elevation attribute value of that floor entity is read as the floor baseline elevation. Subsequently, the global Z-axis minimum and maximum values calculated in step S150-2 are extracted, and the differences are calculated with the floor baseline elevation respectively: bottom relative elevation = global Z-axis minimum value - floor baseline elevation; top relative elevation = global Z-axis maximum value - floor baseline elevation. Thus, the local elevation value of the component relative to its floor is obtained, that is, the elevation information of the component.
[0090] Furthermore, if a component spans multiple floors, the distance from the component to each relevant floor slab can be calculated separately. This distance data is also included in the component's elevation information, so that the elevation information not only reflects the relative position of the component to its own floor, but also characterizes the vertical spatial relationship between the component and adjacent floors, further enriching the semantic dimension of the BIM data.
[0091] S160. Obtain the category to which the component belongs, and determine the material type and material attributes of the component through a two-level search strategy to obtain the component classification and material information.
[0092] The classification information for components can be parsed through classification association entities (such as the IfcRelAssociatesClassification relationship entity). Specifically, all entities in the target building file that are classified as associations can be traversed. For each relationship entity, its RelatedObjects list is traversed to obtain the global identifier (GlobalId) of the component associated with that classification item, thus establishing the correspondence between classification items and components. Subsequently, the references to classification objects in the relationship entity (RelatingClassification attribute) are parsed, and different extraction strategies are used according to the actual type of the classification object.
[0093] The classification object supports two types: The first type is the classification reference type (IfcClassificationReference), which can extract fields such as Name, Reference, Identification, and Description, and trace back to the parent classification system entity (such as IfcClassification) through the ReferencedSource attribute to further obtain the classification system name, source address (Location), and version information (Edition), thereby completely restoring the path of the component in the hierarchical classification system; The second type is the direct classification type (IfcClassification), which can directly extract fields such as Name, Location (source address), and Edition (version), and use the classification system itself as the classification affiliation of the component.
[0094] Thus, one or more classification items are accurately extracted for each component, and each classification item includes at least a classification code, a classification name, and an identifier of the classification system to which it belongs, thereby obtaining the component's classification information.
[0095] For the material information of a component, a two-level search strategy can be used to determine the material type and material attributes of the component, thus obtaining the component classification and material information. This process may include: Traverse the material association entities, parse the associated material objects, and obtain the material type to which the component belongs. The material association entities represent the association between the component instance and the material type. For components whose material type has not been parsed, inherit the material type corresponding to the component type to which the component belongs to the component to obtain the material type to which the component belongs. Extract the material attributes corresponding to the material type to obtain the material information of the component.
[0096] Specifically, the two-level search strategy works as follows: Level 1 – Direct Association Lookup: Traverse all material association entities (such as IfcRelAssociatesMaterial) in the target building file. For each entity, parse the material object pointed to by its RelatingMaterial property, i.e., the material type. Material objects support five types, processed separately: IfcMaterial (single material), extract its Name property; if IfcMaterialLayerSet (material layer set), traverse its MaterialLayers list, extract the material name of each layer and concatenate them with commas; if IfcMaterialConstituentSet (composition material set), traverse its MaterialConstituents list to extract information for each composition material; if IfcMaterialList (material list), traverse its Materials list to extract material items; if IfcMaterialProfileSet (profile material set), traverse its MaterialProfiles list to extract profile material information.
[0097] Level Two – Type Inheritance Lookup: For components without a directly associated material, the `IfcRelDefinesByType` entity can be found through the component's `IsDefinedBy` (definition relationship) attribute to obtain the GlobalId of the type entity to which the component belongs. Simultaneously, a type-to-material mapping table (`type_to_material`) is pre-built: all `IfcRelDefinesByType` relationships are traversed, and for each type entity, a reverse reference lookup function (such as `get_inverse`) is called to check if it is referenced by the `IfcRelAssociatesMaterial` relationship. If so, the material information of that type entity is recorded. When a component is not directly associated with a material, the corresponding material information is looked up and inherited from `type_to_material` by type GlobalId, thus completing the second-level resolution of the material type.
[0098] After determining the material type of a component, the corresponding material attributes (i.e., material layer detailed information parsing) can be further extracted. For example, the five material types can be processed separately: if it is IfcMaterial, extract the single material name and category (Category attribute); if it is IfcMaterialLayerSet, traverse the MaterialLayers list and extract the layer name, layer number, material name, thickness (LayerThickness), visibility (Visible), and priority (Priority) for each layer; if it is IfcMaterialConstituentSet, traverse the MaterialConstituents list and extract the constituent material information; if it is IfcMaterialList, traverse the Materials list and extract the material list; if it is IfcMaterialProfileSet, traverse the MaterialProfiles list and extract the profile material information.
[0099] Additionally, a reverse index can be constructed using layer assignment entities (such as IfcPresentationLayerAssignment) to establish a mapping relationship between the ShapeRepresentation ID and the layer name, thereby associating the geometric representation of a component with the CAD layer. If the component itself is not directly associated with a layer, the geometric representation of its type entity is found through the IfcRelDefinesByType relationship, inferring the layer affiliation from the type hierarchy to ensure that the component has the correct layer attributes in visualization and layer management.
[0100] S170. The basic information of the component, the attribute information of the component, the relationship information of the component, the spatial location of the component, the elevation information of the component, and the classification and material information of the component are written into a structured database for storage.
[0101] Specifically, a relational database schema can be pre-designed based on IFC entity semantics, and a batch insertion and transaction management mechanism can be used to route the various types of data obtained in steps S110 to S160 to the corresponding database tables, thereby achieving the complete implementation of BIM full data from file parsing to structured storage. This process may include: S170-1, Database Schema Design and Data Routing. For example, a relational database schema containing 9 core tables can be constructed, with each table forming a tree-like storage structure based on components through foreign key constraints: The `project_info` table stores project-level metadata independently; the `entity_types` table stores component type definitions, with a unique constraint on `entity_type`; and the `property_sets` table stores attribute set definitions, with a unique constraint on `pset_name`. The building_elements table serves as the main table for basic component information, storing data generated in step S110, such as the component's global identifier (global_id, with a unique constraint), component type label, name, project and site information, etc. The entity_type field is linked to the entity_types table via a foreign key. The element_properties table uses an EAV (Entity-Attribute-Value) key-value pair schema to store component attribute information (i.e., the result of the first to fourth attribute sets generated in step S120 after deduplication). It is linked to the building_elements table and the property_sets table through the foreign keys global_id and pset_name, respectively, and a unique constraint is set with the triple (global_id, pset_name, property_name) to ensure that the attribute is not repeated. The element_relationships table stores component relationship information (triples generated in step S130). It is linked to the building_elements table through both relating_global_id and related_global_id as foreign keys, and a unique constraint is set with the (rel_type, relating_global_id, related_global_id) triple to ensure the uniqueness of the relationship record. The element_locations table stores the spatial location and elevation information of components (global coordinates in step S140 and Z-axis interval and relative elevation in step S150), with global_id as the unique constraint. The element_classifications table and the element_materials table store the component classification information and material layer details produced in step S160, respectively. All sub-tables point to the main table `building_elements` via the `global_id` foreign key, thus constructing a complete referential integrity system at the database level.
[0102] S170-2, Batch Insertion. For example, the `executemany` batch insert method can be used to write thousands of records from the same table in a single database operation, significantly reducing I / O overhead. Before inserting, enable WAL mode (execute the `PRAGMA journal_mode=WAL` command) to allow concurrent read and write operations and improve the efficiency of parallel parsing of multiple files; simultaneously enable foreign key constraints (execute `PRAGMA foreign_keys=ON`) to ensure that the `global_id` referenced when inserting data into a sub-table must exist in the `building_elements` main table. Data is inserted in batches by table, and the transaction is committed immediately after each batch is inserted, ensuring data consistency and avoiding database lock contention caused by excessively long transactions.
[0103] S170-3, Transaction Cascading Cleanup. When the target building file is re-parsed (e.g., file version updated), a transaction cascading cleanup mechanism can be used to first delete the historical data associated with that file before executing the new data entry. The cleanup process is as follows: After starting a database transaction, first query the `building_elements` table for all global_ids corresponding to the file path (file_path field); then, sequentially delete the records associated with these global_ids from the sub-tables such as `element_locations`, `element_classifications`, `element_relationships` (covering related records in both directions of `relating_global_id` and `related_global_id`), `element_properties`, and `element_materials`; finally, delete the corresponding basic information records of the components in the `building_elements` main table. All deletion operations are completed within the same transaction. If any step fails, a transaction rollback is triggered to ensure that no incomplete or dirty data remains in the database. After cleanup, the latest parsing results are written using the batch entry method described above.
[0104] Thus, through the collaborative operation of the aforementioned database schema design, batch writing, and cascading cleanup, efficient, reliable, and traceable structured storage of all BIM data is achieved, providing a solid data foundation for subsequent component queries, quantity statistics, collision detection, and visualization applications.
[0105] This solution comprehensively extracts data from multiple dimensions, including basic component information, attribute sets (including type attribute inheritance and entity native attributes), quantity sets, spatial location and elevation, component relationships, detailed material layer information, classification information, and layer information. Validation on IFC files exported from Revit sample files shows a 100% accuracy rate in parsing and importing 6,823 components, 20,287 attributes, and 557 spatial and structural relationship records. Furthermore, the global coordinate and elevation calculation method based on recursive accumulation of transformation matrices accurately handles spatial positioning chains with rotational transformations, and the elevation calculation results are consistent with professional software such as BIMcollab. Compared to IfcOpenShell's create_shape interface, which only generates a rendering mesh and does not directly provide elevation information, this solution achieves accurate calculation of component top and bottom elevations. Additionally, the batch insertion strategy reduces the import time for 6,823 component information records and 20,287 attribute records to approximately 1 second, and the complete parsing and import of a 16MB IFC file to approximately 8 seconds. WAL mode allows query operations to be performed simultaneously during the write process.
[0106] To better implement the above methods, this application also provides a BIM full-data parsing and database entry device. This device can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet, smart Bluetooth device, laptop, or personal computer; the server can be a single server or a server cluster composed of multiple servers.
[0107] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the BIM full data parsing and warehousing device specifically integrated into the server as an example.
[0108] For example, such as Figure 2 As shown, the BIM full data parsing and storage device may include: The basic information module 210 is used to acquire the target building file and parse the target building file to obtain basic component information, wherein the basic component information includes at least the component identifier. The attribute information module 220 is used to extract the attributes associated with the component identifier from multiple attribute sets of the target building file, and to merge and deduplicate the extracted attributes to obtain component attribute information; The relation information module 230 is used to traverse the relation entities in the target building file, perform multi-attribute detection and parsing on the relation entities to construct a triplet of relation type, relation subject and relation object to obtain component relation information. The relation entities represent the semantic association between different components. The spatial positioning module 240 is used to generate the spatial coordinates of the component in the global coordinate system based on the spatial positioning chain, thereby obtaining the spatial position of the component. The spatial positioning chain refers to the transformation chain formed by the local spatial positioning entity of the component through recursive reference to the parent spatial positioning entity. The elevation information module 250 is used to calculate the Z-axis interval of the component in the global coordinate system, and to perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs, so as to obtain the component elevation information. The material information module 260 is used to obtain the category to which the component belongs, and to determine the material type and material attributes of the component through a two-level search strategy, so as to obtain the component classification and material information; The storage module 270 is used to write the basic information of the component, the attribute information of the component, the relationship information of the component, the spatial location of the component, the elevation information of the component, and the classification and material information of the component into a structured database for storage.
[0109] The specific functions and signal flow relationships of each module correspond one-to-one with the steps described above, and will not be repeated here.
[0110] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0111] This application also provides an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0112] In some embodiments, the BIM full data parsing and storage device can also be integrated into multiple electronic devices. For example, the BIM full data parsing and storage device can be integrated into multiple servers, and the BIM full data parsing and storage method of this application can be implemented by multiple servers.
[0113] In this embodiment, as Figure 3 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically: The electronic device may include components such as a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, a power supply 330, an input module 340, and a communication module 350. Those skilled in the art will understand that... Figure 3 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 310 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 320, and by calling data stored in the memory 320, it performs various functions and processes data, thereby performing overall detection of the electronic device. In some embodiments, the processor 310 may include one or more processing cores; in some embodiments, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 310.
[0114] The memory 320 can be used to store software programs and modules. The processor 310 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 320 may also include a memory controller to provide the processor 310 with access to the memory 320.
[0115] The electronic device also includes a power supply 330 that supplies power to the various components. In some embodiments, the power supply 330 can be logically connected to the processor 310 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 330 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0116] The electronic device may also include an input module 340, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0117] The electronic device may also include a communication module 350. In some embodiments, the communication module 350 may include a wireless module, through which the electronic device can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 350 can be used to help users send and receive emails, browse web pages, and access streaming media.
[0118] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 310 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 320 according to the following instructions, and the processor 310 runs the applications stored in the memory 320, thereby realizing the various functions in the above-mentioned BIM full data parsing and database entry method.
[0119] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0120] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute the steps in any of the BIM full data parsing and database entry methods provided in embodiments of this application.
[0121] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0122] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the BIM full data parsing and database entry method provided in the above embodiments.
[0123] Since the instructions stored in the storage medium can execute the steps in any of the BIM full data parsing and import methods provided in the embodiments of this application, the beneficial effects that any of the BIM full data parsing and import methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0124] The foregoing has provided a detailed description of a BIM full data parsing and database entry method, apparatus, and electronic device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for parsing and storing full BIM data, characterized in that, The method includes: Obtain the target building file and parse the target building file to obtain basic component information, which includes at least the component identifier; The attributes associated with the component identifier are extracted from the multiple attribute sets of the target building file, and the extracted attributes are merged and deduplicated to obtain the component attribute information; Traverse the relation entities in the target building file, perform multi-attribute detection and parsing on the relation entities to construct a triple of relation type, relation subject, and relation object to obtain component relation information. The relation entities represent the semantic association between different components. Based on the spatial positioning chain, the spatial coordinates of the component in the global coordinate system are generated to obtain the spatial position of the component. The spatial positioning chain refers to the transformation chain formed by the local spatial positioning entity of the component through recursive reference to the parent spatial positioning entity. Calculate the Z-axis interval of the component in the global coordinate system, and perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs, to obtain the component elevation information; Obtain the category to which the component belongs, and determine the material type and material attributes of the component through a two-level search strategy to obtain the component classification and material information; The basic information of the component, the attribute information of the component, the relationship information of the component, the spatial location of the component, the elevation information of the component, and the classification and material information of the component are written into a structured database for storage.
2. The method for parsing and storing full BIM data as described in claim 1, characterized in that, The process involves extracting the attributes associated with the component identifier from multiple attribute sets in the target building file, merging and deduplicating the extracted attributes to obtain component attribute information, including: The association between the preset attribute set and the component is located from the target building file through a reverse lookup mechanism, and the first attribute set of the component is extracted from the preset attribute set. Traverse the association between the preset quantity set and the component in the target building file, extract the engineering quantity value corresponding to the preset measurement type of the component from the preset quantity set, and obtain the second attribute set of the component; Based on the mapping relationship between component types and component instances, the type-common attributes defined on the component type are inherited and associated with the corresponding component instance to obtain the third attribute set of the component; Extract the original attributes of the component itself to obtain a fourth attribute set, and merge the first, second, third and fourth attribute sets to eliminate duplicate attributes generated during the merging process, thereby obtaining the component attribute information.
3. The method for parsing and storing full BIM data as described in claim 1, characterized in that, The process of generating the spatial coordinates of the component in the global coordinate system based on the spatial positioning chain to obtain the spatial position of the component includes: The spatial positioning chain is recursively traversed, and the local translation and rotation transformation information recorded by each level of the spatial positioning chain is combined into a global transformation matrix. Based on the translation components in the global transformation matrix, the spatial coordinates of the component in the global coordinate system are determined, and the spatial position of the component is obtained.
4. The method for parsing and storing full BIM data as described in claim 3, characterized in that, The calculation of the Z-axis interval of the component in the global coordinate system, and the relative elevation conversion of the Z-axis interval based on the reference elevation of the floor to which the component belongs, to obtain the component elevation information, includes: Obtain the geometric representation tree corresponding to the component, and determine the geometric entity type of the geometric representation tree; Based on the recursive transformation strategy corresponding to the geometric entity type and the global transformation matrix, the Z-axis interval of the component in the global coordinate system is calculated. The Z-axis interval includes the global Z-axis minimum value and the global Z-axis maximum value. Calculate the difference between the global Z-axis minimum value and the reference elevation of the floor to which the component belongs to obtain the bottom relative elevation, and calculate the difference between the global Z-axis maximum value and the reference elevation to obtain the top relative elevation; The elevation information of the component is obtained based on the bottom relative elevation and the top relative elevation.
5. The method for parsing and storing full BIM data as described in claim 4, characterized in that, The calculation of the Z-axis interval of the component in the global coordinate system based on the recursive transformation strategy corresponding to the geometric entity type and the global transformation matrix includes: When the geometric entity type is a mapping type, the spatial transformation parameters in the mapping target are parsed to construct the mapping transformation matrix, and the local coordinate transformation parameters in the mapping source are parsed to construct the mapping source transformation matrix; Based on the current local transformation matrix, the mapping transformation matrix, and the mapping source transformation matrix, the cumulative local transformation matrix of the component is generated. The current local transformation matrix refers to the local coordinate transformation matrix passed from the parent node to the current node during the recursive traversal of the geometric representation tree. The sub-geometric entities in the mapping source are recursively processed, and each coordinate point in the sub-geometric entity is transformed to the global coordinate system by the cumulative local transformation matrix and the global transformation matrix. After statistical transformation, the Z-axis components of the coordinate points are statistically analyzed, and the global minimum and maximum Z-axis values are extracted to obtain the Z-axis interval of the component in the global coordinate system.
6. The method for parsing and storing full BIM data as described in claim 5, characterized in that, The recursive processing of the sub-geometric entities in the mapping source, transforming each coordinate point in the sub-geometric entity to the global coordinate system using the cumulative local transformation matrix and the global transformation matrix, includes: When the geometric entity type of the sub-item geometric entity is an extrusion type, extract the cross-sectional position coordinates and cross-sectional rotation matrix of the sub-item geometric entity, and obtain the cross-sectional bounding box based on the cross-sectional position coordinates; The stretching direction of the sub-item geometric entity is transformed based on the cross-section rotation matrix, and a stretching vector is generated by combining the stretching depth. For each corner point of the cross-sectional boundary frame, the local coordinates of the corner point are used as the starting point of the stretching, and the local coordinates of the corner point are added to the stretching vector to obtain the local coordinates of the stretching endpoint. The local coordinates of the stretching start point and stretching end point are transformed to the global coordinate system sequentially through the cumulative local transformation matrix and the global transformation matrix.
7. The method for parsing and storing full BIM data as described in claim 5, characterized in that, The recursive processing of the sub-geometric entities in the mapping source, transforming each coordinate point in the sub-geometric entity to the global coordinate system using the cumulative local transformation matrix and the global transformation matrix, includes: When the geometric entity type of the sub-item geometric entity is a face set type, traverse the vertex coordinate list of the sub-item geometric entity and convert each vertex coordinate into a homogeneous coordinate vector; Each homogeneous coordinate vector is transformed into the global coordinate system by the cumulative local transformation matrix and the global transformation matrix in sequence.
8. The method for parsing and storing full BIM data as described in claim 1, characterized in that, The process involves determining the material type and material attributes of the component using a two-level search strategy, thereby obtaining component classification and material information, including: Traverse the material association entities, parse the associated material objects, and obtain the material type to which the component belongs. The material association entities represent the association between the component instance and the material type. For components whose material type has not been resolved, the material type corresponding to the component type to which the component belongs is inherited to the component to obtain the material type to which the component belongs; Extract the material attributes corresponding to the material type to obtain the material information of the component.
9. A device for parsing and storing full BIM data, characterized in that, The device includes: The basic information module is used to acquire the target building file and parse the target building file to obtain basic component information, which includes at least the component identifier. The attribute information module is used to extract the attributes associated with the component identifier from multiple attribute sets of the target building file, and to merge and deduplicate the extracted attributes to obtain the component attribute information. The relation information module is used to traverse the relation entities in the target building file, perform multi-attribute detection and parsing on the relation entities to construct a triple of relation type, relation subject and relation object to obtain component relation information. The relation entities represent the semantic association between different components. The spatial location module is used to generate the spatial coordinates of the component in the global coordinate system based on the spatial location chain, thereby obtaining the spatial location of the component. The spatial location chain refers to the transformation chain formed by the local spatial location entity of the component through recursive reference to the parent spatial location entity. The elevation information module is used to calculate the Z-axis interval of the component in the global coordinate system, and to perform relative elevation conversion on the Z-axis interval based on the reference elevation of the floor to which the component belongs, so as to obtain the component elevation information; The material information module is used to obtain the category to which the component belongs, and to determine the material type and material attributes of the component through a two-level search strategy, thereby obtaining the component classification and material information; The storage module is used to write the basic information of the component, the attribute information of the component, the relationship information of the component, the spatial location of the component, the elevation information of the component, and the classification and material information of the component into a structured database for storage.
10. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to execute the steps in the BIM full data parsing and import method as described in any one of claims 1-8.
