IFC file compression method, device, electronic equipment and storage medium
By constructing an IFC instance reference network graph and iteratively simplifying it, redundant information is identified and removed, and IFC-SPF files are converted into IFC-HDF files. This solves the problems of low compression ratio and low data access efficiency in existing technologies, and achieves efficient file compression and lossless conversion.
Patent Information
- Application Number
- CN202410556056.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-05-07
AI Technical Summary
Existing IFC file compression algorithms have low compression ratios, resulting in high file occupancy and low data access efficiency. Furthermore, some compression algorithms suffer from information loss.
By constructing an IFC instance reference network graph, iterative simplification is performed to identify and remove redundant information, converting the IFC-SPF file into an IFC-HDF file, and achieving secondary compression.
It significantly improves file compression ratio, reduces file size, and enhances data access efficiency, achieving lossless compression and random access characteristics. It is suitable for compression and conversion of all versions of IFC files.
Smart Images

Figure CN118331936B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information technology, and in particular to an IFC file compression method, device, electronic equipment and storage medium. Background Art
[0002] The IFC data exchange standard is a completely open and unrestricted data exchange format. This standard is widely used in the fields of energy, transportation, water conservancy, construction, pipelines and fire protection. Especially for the transportation field, it provides a unified data exchange standard, which facilitates the efficient and accurate exchange of data in many transportation engineering projects involving a large amount of Building Information Modeling (BIM) data, and provides a technical foundation for the realization of informatization and intelligence in the transportation field.
[0003] IFC files have a huge amount of data. To facilitate management and reading, there are currently two main solutions: file-based and database-based. In the file system-based management solution, the size of a single model file basically exceeds 1GB, the data reading efficiency is low, and the 3D visualization speed is even slower. In the database-based management solution, the corresponding table structure is created in various types of databases through schema mapping to store IFC data, but the access performance of the data model provided by the existing schema mapping method still cannot meet the requirements.
[0004] Currently, there are four methods for compressing IFC files: (1) Use a plain text compression tool to directly compress IFC files. BuildingSMART officially provides the file format IFC-ZIP with the extension .ifcZIP to reduce the size of IFC files. The size of its IFC-ZIP file is actually about 20% of the size of its original IFC file. This method does not consider the content of IFC, and redundant instances are still retained. It is only suitable for storage or network transmission scenarios; (2) Extract part of the model or information from the original complete IFC file. During the life cycle of a building project, different participants will add model information at different stages, which may cause the IFC file to be too large. In this case, the problem can be alleviated by sub-model extraction. However, since the partial model extracted by this method is incomplete, it is not suitable for applications that require complete building model information or other necessary information; (3) Convert to Extensible Markup Language (XML) format and perform XML compression. After converting the IFC-SPF file to XML format, the XML compression method can be used to compress the IFC file. This type of method has poor applicability and still does not consider the content of the building model and cannot eliminate redundant instances; (4) Compress the IFC instance according to its structure. The commercial IFC optimization software Solibri IFC Optimizer can delete redundant elements from the IFC file by updating the reference. In essence, it deletes certain types of redundant information to reduce the file size. However, its actual effect does not meet expectations.
[0005] The existing IFC file compression algorithm has a low compression rate, which leads to high IFC file occupancy rate and low data access efficiency, and information loss after the execution of some compression algorithms. Summary of the invention
[0006] In view of this, it is necessary to provide an IFC file compression method, device, electronic device and storage medium to solve the problems of high occupancy rate and low data access efficiency of existing IFC files.
[0007] In order to solve the above problem, the present invention provides an IFC file compression method, comprising:
[0008] Based on the original IFC-SPF file, build the IFC instance reference network diagram;
[0009] Iteratively simplify the instance reference network diagram to obtain a simplified instance reference network diagram;
[0010] The instance type in the simplified instance reference network diagram is identified, and the original IFC-SPF file is converted into an IFC-HDF file.
[0011] In a possible implementation, constructing an IFC instance reference network diagram based on the original IFC-SPF file includes:
[0012] Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version;
[0013] Locate the instance data based on the instance identifier, and obtain the type identifier of the IFC entity corresponding to the instance data;
[0014] Obtaining a corresponding type definition in the IFC_schema definition based on the type identifier;
[0015] Based on the type definition, construct an instance object;
[0016] Based on the instance object, the IFC instance reference network diagram is constructed.
[0017] In a possible implementation, constructing the IFC instance reference network diagram based on the instance object includes:
[0018] Locating the attribute offset of the instance object based on the type definition of the instance object;
[0019] Determining an instance attribute of the instance object based on the attribute offset;
[0020] Based on the instance attributes, a forward reference relationship or a reverse reference relationship is established between two instance objects;
[0021] Based on the forward reference relationship or the reverse reference relationship, the IFC instance reference network diagram is constructed.
[0022] In a possible implementation, iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram includes:
[0023] Traversing the instance reference network graph to construct a non-redundant instance object set;
[0024] Based on the non-redundant instance object set, the simplified instance reference network graph is obtained.
[0025] In a possible implementation, traversing the instance reference network graph to construct a non-redundant instance object set includes:
[0026] Determine, based on the hash value corresponding to each instance object, a first redundant instance object having the same instance attribute and instance type;
[0027] Iterating from the end of the instance reference network graph to determine a logically equivalent second redundant instance object;
[0028] The non-redundant instance object set is determined based on the first redundant instance object and the second redundant instance object.
[0029] In a possible implementation, identifying the instance type in the simplified instance reference network diagram and converting the original IFC-SPF file into an IFC-HDF file includes:
[0030] Determining an instance type of an instance object based on the simplified instance reference network diagram;
[0031] Based on the instance type, create a corresponding HDF composite type;
[0032] Based on the HDF composite type, create corresponding groups and data sets;
[0033] The data set is traversed to obtain the IFC-HDF file.
[0034] In a possible implementation, traversing the data set to obtain the IFC-HDF file includes:
[0035] Get the instance type, HDF5 composite type and instance object list corresponding to the data set;
[0036] Obtaining an unvisited instance object in the instance object list;
[0037] Based on the attribute definition of the unaccessed instance object and the HDF5 composite type definition, writing the instance attribute of the unaccessed instance object into a buffer;
[0038] The data in the buffer is written into the created HDF5 file to obtain the IFC-HDF file.
[0039] The present invention also provides an IFC file compression device, comprising:
[0040] A construction module is used to construct an IFC instance reference network diagram based on the original IFC-SPF file;
[0041] A simplification module, used for iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram;
[0042] The conversion module is used to identify the instance type in the simplified instance reference network diagram and convert the original IFC-SPF file into an IFC-HDF file.
[0043] On the other hand, the present invention also provides an electronic device, including a memory and a processor, wherein:
[0044] The memory is used to store programs;
[0045] The processor is coupled to the memory, and is used to execute the program stored in the memory to implement the IFC file compression method described in any of the above implementations.
[0046] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the IFC file compression method described in any of the above implementations is implemented.
[0047] The beneficial effects of the present invention are as follows: the IFC file compression method provided by the present invention realizes preliminary compression of the original IFC-SPF file by constructing an IFC instance reference network diagram according to the original IFC-SPF file, iteratively simplifying the instance reference network diagram, and identifying the instance type in the simplified instance reference network diagram, thereby creating a corresponding HDF composite type, traversing the data set to write data, converting the original IFC-SPF file into an IFC-HDF file, and realizing secondary compression of the file, which greatly reduces the file size and improves the compression rate, thereby reducing the occupancy rate of the IFC file and improving data access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0049] Figure 1 A method flow chart of an embodiment of the IFC file compression method provided by the present invention;
[0050] Figure 2 A method flow chart of an embodiment of a method for constructing an IFC instance reference network diagram provided by the present invention;
[0051] Figure 3 A method flow chart of an embodiment of a method for converting an IFC instance reference network diagram to an HDF file provided by the present invention;
[0052] Figure 4 A schematic diagram of the structure of an embodiment of an IFC file compression device provided by the present invention;
[0053] Figure 5 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0054] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0055] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone.
[0056] The descriptions of "first", "second", etc. involved in the embodiments of the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0057] Figure 1 A method flow chart of an embodiment of the IFC file compression method provided by the present invention is as follows: Figure 1 As shown, the IFC file compression methods include:
[0058] S101, constructing an IFC instance reference network diagram based on the original IFC-SPF file;
[0059] S102, iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram;
[0060] S103: Identify the instance type in the simplified instance reference network diagram, and convert the original IFC-SPF file into an IFC-HDF file.
[0061] The execution subject of the IFC file compression method provided by the present invention can be an electronic device, which can be a server or a terminal device. The embodiment of the present invention is implemented using Visual Studio 2017 under Windows 10.
[0062] Compared with the prior art, the IFC file compression method provided by the embodiment of the present invention constructs an IFC instance reference network diagram according to the original IFC-SPF file, iteratively simplifies the instance reference network diagram to achieve preliminary compression of the original IFC-SPF file, and identifies the instance type in the simplified instance reference network diagram, so as to create a corresponding HDF composite type, traverse the data set to write data, convert the original IFC-SPF file into an IFC-HDF file, and achieve secondary compression of the file, which greatly reduces the file size and improves the compression rate, thereby reducing the occupancy rate of the IFC file and improving data access efficiency.
[0063] In some embodiments of the present invention, the step of constructing an IFC instance reference network diagram based on the original IFC-SPF file includes:
[0064] Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version;
[0065] Locate the instance data based on the instance identifier, and obtain the type identifier of the IFC entity corresponding to the instance data;
[0066] Obtaining a corresponding type definition in the IFC_schema definition based on the type identifier;
[0067] Based on the type definition, construct an instance object;
[0068] Based on the instance object, the IFC instance reference network diagram is constructed.
[0069] In some embodiments of the present invention, constructing the IFC instance reference network diagram based on the instance object includes:
[0070] Locating the attribute offset of the instance object based on the type definition of the instance object;
[0071] Determining an instance attribute of the instance object based on the attribute offset;
[0072] Based on the instance attributes, a forward reference relationship or a reverse reference relationship is established between two instance objects;
[0073] Based on the forward reference relationship or the reverse reference relationship, the IFC instance reference network diagram is constructed.
[0074] Optionally, there is redundant information in the original IFC-SPF file, and the redundant information can be briefly classified. The specific classification principles are as follows:
[0075] The first type of redundant information is the redundant characters in the data instance part of the SPF file. This type of redundant information is invalid characters generated by the software to beautify the document and increase readability, usually spaces or carriage returns.
[0076] The second type of redundant information is the same data instance with different instance numbers. This type of redundant information refers to data instances with only the instance numbers starting with '#' being different, and the instance types and instance attributes being completely the same.
[0077] The third type of redundant information is equivalent replacement type redundant information. This type of redundant information refers to the redundancy caused by the fact that the IFC standard has multiple synonymous expressions for the same data information in some cases, such as placeholders '$' and default attribute values.
[0078] The fourth type of redundant information is implicit redundant information, which can be divided into three subcategories: (1) instances with different globally unique identifiers (GUIDs) or change histories but the same other attributes; (2) instances with list attributes, where the order of the elements is different but the overall elements are consistent and the other attributes are the same; and (3) logically identical data instances that appear in the process of the algorithm iterating from the bottom of the instance reference network diagram.
[0079] For the original IFC-SPF file, preliminary compression of the original file can be achieved by constructing an IFC instance reference network diagram, iteratively simplifying the instance reference network diagram, and reallocating the IFC instance numbers.
[0080] For example, the mapping from the IFC entity definition model to the objects in C++ is done by using the object definition in the open source project IfcOpenShell. Figure 2 A method flow chart of an embodiment of the method for constructing an IFC instance reference network diagram provided by the present invention is as follows: Figure 2 As shown in the figure, the IFC instance reference network diagram construction method includes:
[0081] S201, load and parse the original IFC-SPF file, and create a file stream object and an access object.
[0082] S202, parsing the file header to determine the IFC version corresponding to the file, and using the object definition in the open source project IfcOpenShell to obtain the C++ object definition mapped by the IFC standard mode of this version, that is, the IFC_schema definition.
[0083] S203, parse the data and move the access pointer.
[0084] The embodiment of the present invention locates instance data by instance identifier, that is, the data stream is scanned to locate the position of '#', and then the IFC entity type identifier corresponding to the instance data is obtained to the right, and the corresponding C++ type definition is obtained from the IFC_schema definition of S202 through the type identifier.
[0085] With the help of the open source project IfcOpenShell, the C++ object of the instance is constructed through the type definition, and it is classified, mapped and stored until all instance data is traversed.
[0086] At the same time, after each instance object is built, it is stored in the corresponding hash table with the instance ID, GUID, and type as the key and the instance object itself as the value. Note that the object attributes are not filled in the entire construction process, only the offset of the instance attribute in the file is saved.
[0087] Note that in the above scanning and positioning process, redundant characters such as extra spaces and carriage returns in the instance data are skipped. Similarly, the same operation is performed in the subsequent instance object attribute loading process in S204. This operation will remove the above first type of redundant information.
[0088] S204, traverse the instance objects constructed in S203 above, parse the instance object attributes, and then construct an instance reference network diagram.
[0089] To illustrate with a single instance object:
[0090] First, obtain the instance object and type definition, then directly locate the location of the instance attribute in the file according to the offset of the attribute saved in the instance object, and then load its instance attribute; during the loading process, the basic attributes of the instance object are directly read, and for the attributes of the reference type, a forward and reverse reference relationship is established between the two objects through pointers.
[0091] At the same time, during this process, the (2) sub-category of redundancy of the fourth category of redundant information mentioned above will be identified, that is, the algorithm will determine whether the instance has a list attribute. If so, the elements in the list will be rearranged according to the numerical value or the size of their identifier numbers, and then the forward and reverse reference relationships will be established according to the above steps. At this point, an instance object has been traversed;
[0092] Similarly, the complete instance reference network graph can be constructed until the algorithm traverses all instance objects.
[0093] Note that during the above instance attribute loading process, special attributes of the equivalent replacement class are uniformly loaded according to the default values. This operation will remove the third type of redundancy mentioned above.
[0094] The IFC file compression method provided by the present invention constructs an IFC instance reference network diagram for the original IFC-SPF file, and each instance object can be regarded as a node in the diagram, and the reference relationship can be regarded as an edge in the diagram. The instance reference network diagram reflects the references and connections between instance objects, so that the relationship between instance objects in the IFC file can be better understood and analyzed.
[0095] In some embodiments of the present invention, iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram includes:
[0096] Traversing the instance reference network graph to construct a non-redundant instance object set;
[0097] Based on the non-redundant instance object set, the simplified instance reference network graph is obtained.
[0098] In some embodiments of the present invention, traversing the instance reference network graph to construct a non-redundant instance object set includes:
[0099] Determine, based on the hash value corresponding to each instance object, a first redundant instance object having the same instance attribute and instance type;
[0100] Iterating from the end of the instance reference network graph to determine a logically equivalent second redundant instance object;
[0101] The non-redundant instance object set is determined based on the first redundant instance object and the second redundant instance object.
[0102] The example reference network output by S204 is simplified. The specific steps are as follows:
[0103] First, traverse the instance reference network graph and build a non-redundant instance object set.
[0104] With the help of std::unordered_set in C++ and the hash algorithm of the custom hash container, IFC instance objects are compared; note that the GUID and change history of the instance object do not participate in the hash operation. This operation will remove the redundancy of the first subcategory of the fourth category of redundant information mentioned above.
[0105] First, the instance reference network diagram described in S204 is used as input, and then the hash value corresponding to the instance object is calculated according to the hash table prepared in S203. If the mapping position of the hash value in the container is empty, it is stored in the corresponding position according to a certain mapping rule. Otherwise, it is compared with the instance object at the position. When the attributes and types of the two instance objects are the same, the current object is regarded as redundant, and the current object is the first redundant instance object. This process will remove the second type of redundancy.
[0106] Similarly, the above operation is repeated until the entire instance reference network graph is traversed, and all remaining non-redundant objects are filled into the hash set. At this time, the set is called a non-redundant instance object set.
[0107] Second, iterate from the end of the reference network graph to remove the (3)th subcategory of the fourth category of redundant information and output a simplified instance reference network graph.
[0108] Start scanning from the end of the reference network diagram one by one. If a logically equal instance object is found in the container, that is, the second redundant instance object, the instance object is considered redundant and the deletion operation is performed while marking the parent node. The instance object properties that reference the redundant object are changed. For instance objects whose object elements have changed in such a collection, they are first deleted from the collection, and then the instance object is rewritten and added to the collection.
[0109] Repeat the above steps until the entire instance reference network diagram is traversed.
[0110] Finally, a simplified instance citation network diagram can be obtained by assigning smaller numbers to data instances with more citations.
[0111] The IFC file compression method provided by the present invention can carry out targeted processing on different redundant information through iterative processing on the reference relationship between instance data, thereby realizing preliminary compression of the file.
[0112] In some embodiments of the present invention, identifying the instance type in the simplified instance reference network diagram and converting the original IFC-SPF file into an IFC-HDF file includes:
[0113] Determining an instance type of an instance object based on the simplified instance reference network diagram;
[0114] Based on the instance type, create a corresponding HDF composite type;
[0115] Based on the HDF composite type, create corresponding groups and data sets;
[0116] The data set is traversed to obtain the IFC-HDF file.
[0117] In some embodiments of the present invention, traversing the data set to obtain the IFC-HDF file includes:
[0118] Get the instance type, HDF5 composite type and instance object list corresponding to the data set;
[0119] Obtaining an unvisited instance object in the instance object list;
[0120] Based on the attribute definition of the unaccessed instance object and the HDF5 composite type definition, writing the instance attribute of the unaccessed instance object into a buffer;
[0121] The data in the buffer is written into the created HDF5 file to obtain the IFC-HDF file.
[0122] Taking the simplified instance reference network diagram as input, the IFC instance types are identified one by one, and the corresponding HDF composite types are created. The data set is traversed to write data, and the IFC-SPF file is converted into an IFC-HDF file.
[0123] The schema mapping from IFC to HDF is based on Part 26 of ISO 10303, which specifies the basic types for storing different attribute types in IFC instance data in HDF files. The rules are as follows:
[0124] For basic data, you can define it directly; for enumeration types, first create the corresponding enumeration item definition at the specified location, and then provide <string> : <integer>Specify the location of the definition and the enumeration item subscript to be taken respectively; for array types, classify them according to the number of instance data elements. For small aggregate instances, embed them in the composite type data of the parent EXPRESS entity instance. For large aggregate instances, represent them as separate HDF5 datasets.
[0125] In addition, in terms of layout strategy in HDF after IFC data conversion, data is usually stored in an aligned form, and for variable-length data in the instance, it is stored together with other attribute data. When allocating space for the composite type of HDF corresponding to the IFC instance object, it is directly allocated according to the maximum length of the variable attribute, and the unused space after storage is filled with zero values. Then, the space occupied by the converted HDF data is optimized through block storage. When creating an HDF file, the data set is stored in blocks by specifying the block size through attributes, and then the block-based data set is compressed in units of blocks using compression algorithms such as gzip or sizp, which greatly reduces the space occupied by the IFC-HDF file.
[0126] For example, Figure 3 The method flow chart of an embodiment of the method for converting an IFC instance reference network diagram to an HDF file provided by the present invention is as follows: Figure 3 As shown, including:
[0127] S301, traverse the instance reference network graph and create a path;
[0128] First, use the simplified example reference network diagram as input, create the corresponding HDF5 file, and configure its file properties.
[0129] Secondly, based on the IFC object definition provided by IfcOpenshell mentioned above, the instance object definition corresponding to this version of IFC is obtained, and then the instance object is traversed. For different IFC instance types, the corresponding HDF composite type is created according to the pattern mapping provided in this application, which will be stored in a separate group of the HDF5 file named "IFC version" + "_encoding".
[0130] Then, the corresponding Group and Dataset are created accordingly, and the Dataset name and path are saved for subsequent storage of the converted data; finally, the entire instance reference network diagram is traversed until all corresponding HDF composite types are created.
[0131] S302, traverse the Dataset and write data.
[0132] This process is based on data sets. Take a single data set as an example to start the traversal.
[0133] First, get the IFC instance type and its HDF5 composite type corresponding to the dataset, then get the instance object list in the dataset, then open the Group and Dataset according to the above path, and then open a cache space for writing. The size of this space is the number of IFC instances of this type multiplied by the size of the composite type corresponding to the instance of this type.
[0134] Next, we start converting instance objects to the corresponding HDF5 types. Taking the data conversion of a single IFC instance object of a certain type as an example, we first obtain the IFC attribute definition and HDF5 composite type definition corresponding to the instance object, then traverse the instance attributes, take out their attribute values one by one and determine their types:
[0135] If it is a reference attribute, find the location of the object it refers to and fill the data at that location;
[0136] If it is a non-reference attribute, the corresponding write accessor is called according to its type for writing, where the write accessor writes to the buffer according to the byte size occupied by the data.
[0137] Repeat the above steps until all attributes are written into the buffer and the data conversion of the instance object is completed. After all IFC instance objects in the above instance object list are converted, the buffer data is uniformly written into the currently opened Dataset.
[0138] Finally, after traversing all Datasets and writing data, the IFC-HDF file is output.
[0139] The IFC file compression method provided by the present invention performs targeted processing on different redundant information through iterative processing of reference relationships between instance data, and uses a simplified entity object network diagram as input to perform secondary compression, thereby losslessly converting the IFC file into an HDF file.
[0140] In addition, the IFC file compression method provided by the present invention solves the problem of model data loss during the file compression process, improves the compression rate of the IFC file, and can achieve format conversion from the full version of the IFC file to the HDF file. Since the random access characteristics of the converted HDF file and its flexible type definition are very suitable for the storage and access of IFC data, it is convenient to manage its instance data and properly solves the problem of difficulty in modifying the IFC file model data and low access efficiency.
[0141] In summary, the IFC file compression method provided by the present invention can support the compression and conversion of the full version of IFC files. At the same time, through the secondary compression of the original IFC-SPF file, the file compression rate is greatly improved, and its file compression rate is generally between 80% and 90%, and lossless compression of all instance objects is achieved; in addition, the IFC-HDF file obtained after the IFC-SPF file conversion supports random access, which greatly improves the data reading efficiency. The query time is usually in the millisecond level. In a few cases, the query time is increased due to the large number of instances. The file compression effect achieved by the present invention provides convenient conditions for subsequent users to use it for three-dimensional visualization modeling.
[0142] In order to better implement the IFC file compression method in the embodiment of the present invention, based on the IFC file compression method, the embodiment of the present invention also provides an IFC file compression device. Figure 4 A schematic diagram of the structure of an embodiment of the IFC file compression device provided by the present invention is shown as follows: Figure 4 As shown, the IFC file compression device 400 includes:
[0143] A construction module 410 is used to construct an IFC instance reference network diagram based on the original IFC-SPF file;
[0144] A simplification module 420, configured to iteratively simplify the instance reference network diagram to obtain a simplified instance reference network diagram;
[0145] The conversion module 430 is used to identify the instance type in the simplified instance reference network diagram and convert the original IFC-SPF file into an IFC-HDF file.
[0146] The IFC file compression device 400 provided in the above embodiment can implement the technical solution described in the above IFC file compression method embodiment. The specific implementation principles of the above modules or units can refer to the corresponding contents in the IFC file compression method embodiment, which will not be repeated here.
[0147] like Figure 5 As shown, the present invention also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502 and a display 503. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0148] In some embodiments, the processor 501 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run the program code stored in the memory 502 or process data, such as the IFC file compression method of the present invention.
[0149] In some embodiments, the processor 501 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 501 may be local or remote. In some embodiments, the processor 501 may be implemented in a cloud platform. In some embodiments, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination thereof.
[0150] In some embodiments, the memory 502 may be an internal storage unit of the electronic device 500, such as a hard disk or memory of the electronic device 500. In other embodiments, the memory 502 may also be an external storage device of the electronic device 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 500.
[0151] Furthermore, the memory 502 may include both an internal storage unit of the electronic device 500 and an external storage device. The memory 502 is used to store application software installed in the electronic device 500 and various data.
[0152] In some embodiments, the display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an organic light-emitting diode (OLED) touch device, etc. The display 503 is used to display information on the electronic device 500 and to display a visual user interface. The components 501-503 of the electronic device 500 communicate with each other via a system bus.
[0153] In one embodiment, when the processor 501 executes the IFC file compression program in the memory 502, the following steps may be implemented:
[0154] Based on the original IFC-SPF file, build the IFC instance reference network diagram;
[0155] Iteratively simplify the instance reference network diagram to obtain a simplified instance reference network diagram;
[0156] The instance type in the simplified instance reference network diagram is identified, and the original IFC-SPF file is converted into an IFC-HDF file.
[0157] It should be understood that: when the processor 501 executes the IFC file compression program in the memory 502, in addition to the above functions, other functions may also be implemented, and details may refer to the description of the above corresponding method embodiments.
[0158] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 500 mentioned, and the electronic device 500 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 500 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0159] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, the steps or functions of the IFC file compression method provided in the above-mentioned method embodiments can be implemented.
[0160] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0161] The IFC file compression method, device, electronic device and storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.< / integer> < / string>
Claims
1. An IFC file compression method, characterized in that: include: Based on the original IFC-SPF file, build the IFC instance reference network diagram; Iteratively simplify the instance reference network diagram to obtain a simplified instance reference network diagram; Identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file; The construction of the IFC instance reference network diagram based on the original IFC-SPF file includes: Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version; Locate the instance data based on the instance identifier, and obtain the type identifier of the IFC entity corresponding to the instance data; Obtaining a corresponding type definition in the IFC_schema definition based on the type identifier; Based on the type definition, construct an instance object; Based on the instance object, construct the IFC instance reference network diagram; The constructing the IFC instance reference network diagram based on the instance object includes: Locating the attribute offset of the instance object based on the type definition of the instance object; Determining an instance attribute of the instance object based on the attribute offset; Based on the instance attributes, a forward reference relationship or a reverse reference relationship is established between two instance objects; Based on the forward reference relationship or the reverse reference relationship, construct the IFC instance reference network diagram; The iterative simplification of the instance reference network diagram to obtain a simplified instance reference network diagram includes: Traversing the instance reference network graph to construct a non-redundant instance object set; Based on the non-redundant instance object set, obtaining the simplified instance reference network graph; The traversing the instance reference network graph to construct a non-redundant instance object set includes: Determine, based on the hash value corresponding to each instance object, a first redundant instance object having the same instance attribute and instance type; Iterating from the end of the instance reference network graph to determine a logically equivalent second redundant instance object; The non-redundant instance object set is determined based on the first redundant instance object and the second redundant instance object.
2. The IFC file compression method according to claim 1, characterized in that: The step of identifying the instance type in the simplified instance reference network diagram and converting the original IFC-SPF file into an IFC-HDF file includes: Determining an instance type of an instance object based on the simplified instance reference network diagram; Based on the instance type, create a corresponding HDF composite type; Based on the HDF composite type, create corresponding groups and data sets; The data set is traversed to obtain the IFC-HDF file.
3. The IFC file compression method according to claim 2, characterized in that: The traversing the data set to obtain the IFC-HDF file includes: Get the instance type, HDF5 composite type and instance object list corresponding to the data set; Obtaining an unvisited instance object in the instance object list; Based on the attribute definition of the unaccessed instance object and the HDF5 composite type definition, writing the instance attribute of the unaccessed instance object into a buffer; The data in the buffer is written into the created HDF5 file to obtain the IFC-HDF file.
4. An IFC file compression device, characterized in that: include: A construction module is used to construct an IFC instance reference network diagram based on the original IFC-SPF file; A simplification module, used for iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram; A conversion module, used for identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file; The construction of the IFC instance reference network diagram based on the original IFC-SPF file includes: Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version; Locate the instance data based on the instance identifier, and obtain the type identifier of the IFC entity corresponding to the instance data; Obtaining a corresponding type definition in the IFC_schema definition based on the type identifier; Based on the type definition, construct an instance object; Based on the instance object, construct the IFC instance reference network diagram; The constructing the IFC instance reference network diagram based on the instance object includes: Locating the attribute offset of the instance object based on the type definition of the instance object; Determining an instance attribute of the instance object based on the attribute offset; Based on the instance attributes, a forward reference relationship or a reverse reference relationship is established between two instance objects; Based on the forward reference relationship or the reverse reference relationship, construct the IFC instance reference network diagram; The iterative simplification of the instance reference network diagram to obtain a simplified instance reference network diagram includes: Traversing the instance reference network graph to construct a non-redundant instance object set; Based on the non-redundant instance object set, obtaining the simplified instance reference network graph; The traversing the instance reference network graph to construct a non-redundant instance object set includes: Determine, based on the hash value corresponding to each instance object, a first redundant instance object having the same instance attribute and instance type; Iterating from the end of the instance reference network graph to determine a logically equivalent second redundant instance object; The non-redundant instance object set is determined based on the first redundant instance object and the second redundant instance object.
5. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory, and is used to execute the program stored in the memory to implement the IFC file compression method according to any one of claims 1 to 3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the IFC file compression method according to any one of claims 1 to 3 is implemented.
