A method and device for converting a Revit model into a Unity model with extended data
By adopting an automated conversion method for Revit to Unity models based on the GLTF standard, the problems of loss of non-geometric attribute information and cumbersome material mapping when importing Revit models into Unity are solved. This method achieves lightweight modeling and automated attribute association, reducing the maintenance cost of updates and iterations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU METRO DESIGN & RES INST CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-07-07
AI Technical Summary
Existing technologies for importing Revit models into the Unity engine suffer from several problems, including loss of non-geometric attribute information, cumbersome material mapping, lack of automated attribute association mechanisms, and insufficient lightweight model processing. As a result, the imported models cannot meet the needs of subsequent operation and maintenance management or data query, and the maintenance cost of updates and iterations is high.
This method employs an automated conversion and attribute reconstruction approach from Revit to Unity based on the GLTF standard. By analyzing component elements in the 3D view on the Revit side, structural files, geometric files, and texture files are generated. On the Unity side, path resolution verification and asynchronous loading are performed to achieve the association mapping between geometry and attributes, ultimately generating a Unity model with extended data.
It achieves the preservation and automatic association of non-geometric information, solves the problems of cumbersome material mapping and insufficient model lightweighting, and generates models that support high-fidelity and robust 3D visualization reconstruction, reducing the maintenance cost of updates and iterations.
Smart Images

Figure CN122346902A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of building information modeling technology, and in particular to a method and apparatus for converting a Revit model into a Unity model with extended data. Background Technology
[0002] With the widespread application of Building Information Modeling (BIM) technology throughout the entire building lifecycle, Autodesk Revit, as the mainstream BIM modeling software, carries a large amount of geometric and non-geometric attribute information about buildings (such as materials, dimensions, manufacturer information, structural parameters, etc.). At the same time, game engines such as Unity, due to their powerful real-time rendering capabilities, interactivity, and cross-platform features, are increasingly being used for the visualization, virtual tours, and digital twin applications of BIM models.
[0003] Currently, there are two main methods for importing Revit models into the Unity engine: The first is conversion via a common intermediate file format (such as FBX), which is the most traditional method. Users export the model from Revit as FBX and then import these files into Unity. The process includes Revit -> export FBX -> Unity import -> material reconstruction in Unity. Its advantage is utilizing Revit's built-in export function, requiring no additional development, but it loses material information and component attribute information. The second method is conversion via intermediate software (such as Navisworks). Using Navisworks' data format as an intermediary, the main process includes Revit -> export NWC -> use Navisworks to read the NWC file -> Navisworks export FBX -> Unity import -> generate Unity model. Its advantage is leveraging Navisworks' built-in export function, requiring no additional development, and it can generate material information, but component attribute information is still lost.
[0004] Although the above-mentioned existing technologies have achieved geometric transfer of models to a certain extent, there are still significant shortcomings and deficiencies in application scenarios such as generating interactive extended data and separating model lightweighting and data structuring. Specifically, these include: (1) loss and fragmentation of non-geometric information (attribute data). Specifically, the biggest drawback of the FBX method is that its essence is the exchange of geometric data. During the export process, the rich BIM parameters in Revit (such as the structural type of the component, fire rating, custom parameters, etc.) are usually completely stripped away, leaving only the appearance geometric mesh and some material UV information of the model. After importing into Unity, the model is just a "dead" geometry, losing the core value of BIM information and failing to meet the needs of subsequent operation and maintenance management or data query. Although some commercial plugins can import attributes, their data structures are often closed or in a specific format, making it difficult for developers to customize secondary development in Unity or flexibly connect them to external databases (such as SQL, Web API); (2) chaotic model hierarchy and insufficient lightweighting processing. The modeling logic of Revit models (based on families, types, and instances) differs fundamentally from the rendering logic of Unity (based on Mesh, Material, and GameObject). When directly converting existing technologies, a large number of redundant sub-meshes or excessively deep hierarchical structures are often generated. When facing large-scale architectural projects, the lack of targeted automatic optimization mechanisms (such as automatic instantiation processing and culling of invisible faces) results in an excessively high number of triangles (Draw Calls) in the imported Unity model, which seriously affects the frame rate and performance during runtime, especially in mobile or web applications. (3) There is a lack of mechanisms for generating and associating extended data. Existing technologies are usually one-time model transfers, that is, whatever Revit has is imported, and there is a lack of a mechanism to generate or map new extended data during the conversion process. For example, existing technologies have difficulty automatically calculating the bounding box center point of components for navigation, automatically generating an ID index table for click interaction, or reorganizing Revit parameters into lightweight JSON data transmitted over the network according to business logic during the import process. This means that during the Unity development phase, programmers still need to spend a lot of time manually mounting scripts or organizing data; (4) The maintenance cost of updates and iterations is high. When the Revit source model undergoes minor changes (such as moving a wall), the traditional FBX process usually requires re-exporting the entire model and resetting the materials and scripts in Unity. The workflow mainly relies on manual repetitive operations and lacks automated incremental updates or data ID anchoring capabilities. Summary of the Invention
[0005] To address the technical problems existing in the prior art when importing Revit models into the Unity engine, such as loss of non-geometric attribute information, cumbersome material mapping, lack of automated attribute association mechanism, and insufficient model lightweighting processing, this application provides a method and apparatus for converting Revit models into Unity models with extended data. It adopts an automated conversion and attribute reconstruction method for Revit to Unity models based on the GLTF standard extension, which realizes the preservation of extended data such as non-geometric information, can automatically perform geometric and attribute association mapping, and finally realizes persistent storage and interactive access of data.
[0006] In one aspect, this application provides a method for converting a Revit model into a Unity model with extended data, including:
[0007] In Revit, the selected 3D view is analyzed to obtain a set of referenced files and a JSON-formatted structural file. The structural file references the geometry and texture files in the set of referenced files through an index path.
[0008] In Unity, the paths of the structure file and the set of referenced files are parsed and verified, and the index path is intelligently corrected to obtain the corrected string;
[0009] Based on the corrected string, asynchronous loading is performed using the structure file and the reference file set. The scene node tree loaded is processed by the shader repair logic to obtain the instantiated model.
[0010] The instantiated model is parsed for attributes, and the parsed attribute data is mounted to the target instance to establish the association between geometry and attributes, generating a Unity model with extended data.
[0011] Perform scene post-processing and interaction initialization on the Unity model, and update the Unity model.
[0012] Optionally, perform component element analysis on the selected 3D view to obtain a set of referenced files and a JSON-formatted structure file, including:
[0013] The selected 3D view is subjected to geometric analysis to extract geometric mesh data, and the 3D view is subjected to texture mapping and non-geometric analysis to extract texture mapping data;
[0014] A geometry file is generated based on the geometry mesh data, and a texture file is generated based on the texture mapping data;
[0015] Traverse each element in the 3D view and construct a node tree with a JSON structure using the key data of the elements;
[0016] The acquired non-geometric attributes are written into the extended fields of each node tree, the node trees are updated, a structure file is generated, and an index path is established in the structure file based on the filenames of the geometry file and the texture file.
[0017] Optionally, in Unity, the paths of the structure file and the set of referenced files are parsed and verified, and the index path is intelligently corrected to obtain a corrected string, including:
[0018] On the Unity side, the index path is parsed from the structure file to obtain the index values of the geometry file and texture file;
[0019] Based on the index value, determine whether the geometry file and / or the texture file exists;
[0020] If the geometry file and / or the texture file does not exist, a path detection algorithm is used to scan for the corresponding update file in the same directory where the structure file is stored, based on the index value and the main file name of the structure file.
[0021] The relative path is constructed using the updated file, and the index path is dynamically corrected in the structure file to obtain the corrected string.
[0022] Optionally, based on the corrected string, asynchronous loading is performed using the structure file and the reference file set. The scene node tree loaded is then processed through shader repair logic to obtain an instantiated model, including:
[0023] Based on the corrected string, the structure file and the reference file set are asynchronously loaded through a preset interface to instantiate the scene node tree and generate an instantiated model;
[0024] The scene node tree is analyzed for material shading based on a preset rendering pipeline detection mechanism. When a material is found to be missing, the shader repair logic is triggered.
[0025] Perform shader repair, correct the shading references of each material in the scene node tree according to the obtained rendering pipeline configuration, and update the instantiated model.
[0026] Optionally, based on the corrected string, the structure file and the reference file set are asynchronously loaded through a preset interface to instantiate the scene node tree and generate an instantiated model, including:
[0027] Based on the corrected string and the preset interface, initiate an asynchronous loading task;
[0028] Asynchronous loading is performed based on the structure file and the set of referenced files to generate an instantiated scene node tree;
[0029] During the asynchronous loading process, a polling mechanism is used to traverse the scene index in the structure file, update the root node of the scene node tree, until the root node corresponds to a valid child object, and generate an instantiated model.
[0030] Optionally, based on the obtained rendering pipeline configuration, the shading references of each material in the scene node tree are corrected, and the instantiated model is updated, including:
[0031] Obtain the rendering pipeline configuration of the scene node tree;
[0032] When the rendering pipeline is configured as a general rendering pipeline, a preset shader is loaded as the target shader; or, when the rendering pipeline is configured as a general rendering pipeline, a standard shader is loaded as the target shader.
[0033] Traverse the currently generated mesh rendering components, redirect the shading of the material and material properties of the scene node tree based on the target shader, and update the instantiated model.
[0034] Optionally, the instantiated model undergoes attribute parsing, and the parsed attribute data is mounted to the target instance to establish a relationship between geometry and attributes, generating a Unity model with extended data, including:
[0035] The attribute mounting process is executed, and a hierarchical fuzzy matching algorithm is used to parse the JSON data corresponding to the instantiated model to determine the target instance and the attribute data corresponding to the target instance.
[0036] Based on the attribute data, deserialization and instantiation are performed to generate script components;
[0037] A property storage component is dynamically added to the target instance, the script component is mounted to the property storage component, the relationship between geometry and properties is established, and a Unity model with extended data is generated.
[0038] Optionally, a hierarchical fuzzy matching algorithm is used to parse the JSON data corresponding to the instantiated model to determine the target instance and the attribute data corresponding to the target instance, including:
[0039] A hierarchical positioning algorithm is used to parse the JSON data in the instantiated model to locate the target instance, key parent node, and attribute data of the target instance, wherein the key parent node belongs to the target instance;
[0040] A fuzzy matching anchoring algorithm is used to traverse the JSON data and identify the key child nodes associated with the key parent node;
[0041] The updated name is obtained by cleaning the characters based on the original name of the key child node;
[0042] By comparing the updated name and the original name, key child nodes of the same type are matched to the target instance, and the attribute data is mapped to the key child nodes.
[0043] Optionally, perform scene post-processing and interaction initialization on the Unity model, and update the Unity model, including:
[0044] Analyze the overall bounding box of a Unity model;
[0045] Post-processing is performed on the overall bounding box to adaptively adjust the camera focus to the center of the Unity model;
[0046] Add a collider to the generated target object in the Unity model, initialize the interaction, and update the Unity model.
[0047] Secondly, this application provides an apparatus for converting a Revit model into a Unity model with extended data, comprising:
[0048] The source data extraction and separation module is used to perform component element analysis on the selected 3D view in Revit to obtain a set of referenced files and a JSON-formatted structural file. The structural file references the geometric files and texture files in the set of referenced files through an index path.
[0049] The target-side asynchronous loading and reconstruction module is used in Unity to parse and verify the paths of the structure file and the reference file set, intelligently correct the index path, and obtain a correction string; based on the correction string, asynchronous loading is performed using the structure file and the reference file set, and the scene node tree loaded by the shader repair logic is processed to obtain the instantiated model;
[0050] The attribute automatic parsing and mounting module is used to parse the attributes of the instantiated model, mount the parsed attribute data to the target instance, establish the association between geometry and attributes, and generate a Unity model with extended data.
[0051] The Scene Interaction module is used to perform scene post-processing and interaction initialization on Unity models, and to update Unity models.
[0052] In summary, this embodiment of the application performs multi-dimensional element parsing on the selected 3D view in Revit, generating structure files, geometry files, and texture files. Non-geometric extension data is written into the structure files, and index paths referencing the geometry and texture files are established. In Unity, a 3D scene is generated based on these files. Specifically, naming analysis is performed on each file, parsing the index paths of geometry and texture files from the structure files. The index paths are used to determine if there are any path / naming updates in the geometry and / or texture files. When a file update is detected, a path detection algorithm is used to traverse the directories with the same name as the structure files, dynamically correcting the index paths of the structure files to the geometry and / or texture files, obtaining a corrected string. Then, using an asynchronous loading method, based on the corrected string, each file is called. Using each file, a scene node tree is instantiated in Unity through a preset interface, generating an instantiated model. Through rendering pipeline detection logic, material shader analysis is performed on the node tree, and shader repair logic automatically adapts the shader references, updating the instantiated model. Finally, the instantiated model undergoes further automated parsing, mapping extended data such as attribute data to instances. This ensures that multiple instances of the same type can be correctly mapped to the same set of attribute data. The attribute data is then re-mounted to the corresponding components using a component-based mounting method, establishing a connection between geometry and attributes. This generates a Unity model with extended data, achieving a complete correspondence between the model's geometry and its non-geometric extended data. Scene post-processing and interactive initialization are performed on the Unity model, enabling it to support various interactive functions. Therefore, this embodiment achieves high-fidelity and robust 3D visualization reconstruction in terms of the generated model and materials, making model processing more lightweight. In terms of generating extended data, it achieves precise and automated association between geometric objects and BIM attributes, solving not only the technical problems of lost non-geometric attribute information and lack of automated attribute association mechanisms in existing technologies, but also the technical problems of cumbersome material mapping and insufficient model lightweighting. Attached Figure Description
[0053] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0054] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0055] Figure 1A flowchart illustrating a method for converting a Revit model into a Unity model with extended data, provided in an embodiment of this application;
[0056] Figure 2 This is a flowchart illustrating the steps of an optional embodiment of this application for converting a Revit model into a Unity model with extended data.
[0057] Figure 3 This is an overall architecture diagram of a model conversion system provided as an optional example of this application;
[0058] Figure 4 This is an optional example of the intelligent path correction flowchart provided in this application;
[0059] Figure 5 This is a schematic diagram of the attribute mounting matching logic provided as an optional example in this application;
[0060] Figure 6 This is a structural block diagram of an apparatus for converting a Revit model into a Unity model with extended data, provided in an embodiment of this application. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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, 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.
[0062] To facilitate understanding of the embodiments of this application, further explanations and descriptions will be provided below in conjunction with the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on the embodiments of this application.
[0063] Figure 1 This application provides a flowchart illustrating a method for converting a Revit model into a Unity model with extended data, which may specifically include the following steps:
[0064] Step 110: In Revit, perform component element analysis on the selected 3D view to obtain a set of referenced files and a JSON-formatted structural file.
[0065] The structure file references geometry files and texture files in the referenced file set via index paths.
[0066] In this embodiment, when the export program is started in the Revit 3D view, all the primitives in the selected 3D view are traversed, each component and element is parsed, and the BIM model (Building Information Model) is decoupled into three independent files, including: structural description file (also known as structural file), geometric data file (also known as geometric file), and texture resource file (also known as texture file).
[0067] In practical implementation, the components and elements parsed may include, but are not limited to: geometric mesh data, texture maps, and primitive-related data. Geometric mesh data can be used to generate geometry files; texture maps can be used to generate texture files; the structure file records data in JSON format (JavaScript Object Notation, a lightweight data exchange format), which can be used to construct a node tree of JSON structure. Each node in the node tree can have corresponding fields, primitive-related data can be written into the corresponding fields, and additional index paths can be created in the nodes. The structure file can reference the geometry and texture files through the index paths, realizing the referencing of geometric and texture data.
[0068] Step 120: In Unity, the path of the structure file and the set of referenced files is parsed and verified, and the index path is intelligently corrected to obtain the corrected string.
[0069] Specifically, in Unity, the user-selected structure file is obtained, and the index path is obtained by parsing the structure file, so as to reference the geometry file and texture file using the index path.
[0070] To address the issue of lost references caused by changes in source file paths or filenames, this embodiment introduces an intelligent path detection algorithm. Specifically, it parses the structure file, obtains the nodes related to the index path in the file's JSON structure, and determines the index paths of the geometry and texture files (the index path value is usually a URI value). Then, it uses the URI value to verify the validity of the path. Understandably, when the path of the geometry file and / or texture file changes or the filename is modified, the file corresponding to the URI value does not exist, therefore the path is invalid.
[0071] When an invalid path is determined, intelligent path correction can be performed. This involves scanning the directory containing the structure files through path exploration, constructing new relative paths for files with updated names, and updating the index path to obtain a corrected JSON string, which serves as the correction string. The correction string primarily includes the path value of the updated index path.
[0072] It should be noted that when the intelligent correction algorithm detects that the path is valid, it can directly use the value of the original index path as the correction string.
[0073] Step 130: Based on the corrected string, asynchronous loading is performed using the structure file and the reference file set. The scene node tree loaded by the shader repair logic is then processed to obtain the instantiated model.
[0074] In the actual implementation, the Unity side performs the asynchronous loading task, using the structure file selected by the user as a base, and reads the geometry file and texture file using the correction string to perform asynchronous loading.
[0075] During asynchronous loading, the loading progress can be fed back in real time. After loading is completed, the scene node tree is instantiated and an instantiated model is generated.
[0076] After completing the scene node tree and model instantiation, a geometry reconstruction process is executed to analyze whether material shaders are missing. If a loss is confirmed, shader repair logic is executed to update and replace all material shader references, reset parameters, and synchronously update the instantiated model.
[0077] Step 140: Perform attribute parsing on the instantiated model, and mount the parsed attribute data to the target instance to establish the association between geometry and attributes, generating a Unity model with extended data.
[0078] In this embodiment, after the model is instantiated, the attribute mounting protocol can be initiated to parse the JSON data of the instantiated model, traverse each node, and extract non-geometric attribute data as extended data. Then, using algorithms such as fuzzy matching, the corresponding instance is found as the target instance, and the extended data is mounted to the target instance, thereby establishing the association between geometric objects and JSON-formatted attribute data, and generating a Unity model with extended data.
[0079] Step 150: Perform scene post-processing and interaction initialization on the Unity model, and update the Unity model.
[0080] In this embodiment, the generated Unity model can be focused through scene post-processing and can be initialized through interactive processing, enabling the Unity model to have functions such as ray detection and click interaction.
[0081] In a specific implementation, scene post-processing and interaction initialization processing are performed on the Unity model, and the Unity model is updated. This may include: analyzing the overall bounding box of the Unity model; performing scene post-processing on the overall bounding box and adaptively adjusting the camera focus to the center of the Unity model; adding colliders to the generated target objects in the Unity model, initializing the interaction, and updating the Unity model.
[0082] Specifically, this embodiment calculates the bounding box of the generated Unity model and automatically adjusts the camera position and focal length to focus on the center of the model. Simultaneously, a MeshCollider collider is added to the generated Mesh object to support subsequent raycasting and click-based interaction features.
[0083] As can be seen, the embodiments of this application achieve high-fidelity and high-robustness 3D visualization reconstruction in terms of generated models and materials, and make model processing more lightweight by storing relevant file data in JSON format; in terms of generating extended data, it achieves accurate and automated association between geometric objects and BIM attributes, solving the technical problems of loss of non-geometric attribute information and lack of automated attribute association mechanism in the prior art, as well as solving the technical problems of cumbersome material mapping and insufficient model lightweighting.
[0084] Reference Figure 2 The diagram illustrates a step-by-step flowchart of a method for converting a Revit model into a Unity model with extended data, according to an optional embodiment of this application. The method may specifically include the following steps:
[0085] Step 210: In Revit, perform component element analysis on the selected 3D view to obtain a set of referenced files and a JSON-formatted structural file.
[0086] The structure file references geometry files and texture files in the referenced file set via index paths.
[0087] In practical implementation, the above-mentioned component element analysis of the selected 3D view to obtain the reference file set and JSON format structure file may include: performing geometric analysis on the selected 3D view to extract geometric mesh data, and performing texture and non-geometric analysis on the 3D view to extract texture map data; generating a geometry file based on the geometric mesh data, and generating a texture file based on the texture map data; traversing each primitive in the 3D view, using the key data of the primitives to construct a node tree of JSON structure; writing the obtained non-geometric attributes into the extended fields of each node tree, updating the node tree, generating a structure file, and establishing an index path in the structure file based on the filenames of the geometry file and the texture file.
[0088] In related technologies, the technical solution of exporting Revit models to Unity models suffers from low loading efficiency and chaotic resource management when dealing with large-scale scene models. The overall export method also tends to result in large file sizes and difficulties in modification. Furthermore, intermediate formats such as FBX can only transmit geometry and cannot retain component attributes and material details, leading to the loss of BIM attributes and material information during cross-platform transmission.
[0089] To address the technical problems of existing technologies when dealing with large-scale scene models, such as low loading efficiency, chaotic resource management, large exported file size, and difficulty in modification, this embodiment provides a structured and lightweight model loading strategy. It primarily employs a technique of separating geometry, structure, and texture storage to achieve complete and lossless transfer of the model and various related information, while preserving attributes and detailed information.
[0090] Reference Figure 3 As shown, in practical implementation, the Revit API can be further developed to build automatic extraction programs, scripts, or plugins. By automatically traversing all component elements in the selected Revit project, the complex BIM model data structure is separated and decoupled into three independent file types: geometry files, texture files, and structural files generated based on synchronously extracted component attribute information. The extraction of these three independent file types is explained in detail below:
[0091] Geometry file (format can be .bin): Specifically, in this embodiment, the geometric mesh data of the 3D view is parsed, including but not limited to the coordinates of the model vertices, normals, UV coordinates and triangular face index data, etc., and a geometry file is generated using the geometric mesh data. The geometry file stores the geometric mesh data in binary stream form.
[0092] Texture files (format can be .jpg or .png, such as concrete texture.jpg): In this embodiment, the diffuse reflection, normal and other texture files (also called texture maps or texture images) of the material are extracted from the 3D view. The texture files can be used as texture map data to generate texture files.
[0093] In this embodiment, geometry files and texture files can be considered as a set of reference files.
[0094] The structure file (storing data in JSON format, .gltf format) simultaneously extracts non-geometric attributes (such as FamilyName, ElementID, custom parameters, etc.) and key data (including but not limited to: unique identifiers, type parameters, and instance parameters) of Revit components during the extraction of each reference file set. A node tree with a JSON structure is constructed using the key data. Non-geometric attributes are serialized and written to extended fields of the node tree, such as the `extras` extended field, achieving heterogeneous storage of data and geometry. Finally, an index path (or reference path) is established in the node tree, using the filenames of geometry and texture files as path values or index values (e.g., URIs), and written to the corresponding fields to generate the structure file. The structure file records the scene hierarchy (Nodes), node names, transformation matrices (position, rotation, scaling), and reference paths to geometry and texture data in JSON format. The structure file can index / reference / call geometry and texture files through the index path.
[0095] Preferably, geometry files and texture files can be exported to the same directory as the structure files.
[0096] For example, this application can be applied to a Windows 10 operating system environment. The source software can be Autodesk Revit 2020 or later; the target engine is Unity 2021.3 LTS or later (supporting Built-in and URP rendering pipelines); the middleware includes a custom loading script based on GLTFast and a Revit secondary development export plugin.
[0097] Taking the extraction of Revit model A as an example, the extracted geometry file can be named Model_A.bin, and the structure file can be named Model_A.gltf. Within the node tree of the structure file, two nodes, buffers and images, can be created for the index path. The index path buffers can be used to reference the geometry file, and the index path images can be used to reference the texture file. The index path can have a uri field, which accurately references .bin and .jpg files. For example, for the index path buffers, the JSON fragment of the structure file can be recorded as: "buffers": [{"uri": "Model_A.bin"}]. Subsequently, in Unity, when importing files to build the model, intelligent path correction can be performed based on the index path.
[0098] Therefore, this embodiment proposes a lightweight BIM model transmission architecture based on a three-element decoupled (geometry-texture-data) structure, constructing a data organization form based on the GLTF extended standard and abandoning the traditional FBX overall export mode. Specifically, at the source end (Revit end), the model is decoupled into the above three types of files, and the BIM attribute serialization is embedded into the structure file. In the subsequent target end (Unity end), these three types of resources can be loaded and assembled asynchronously on demand through the conversion logic of the Unity end, that is, runtime reorganization is performed through asynchronous streaming loading. This loosely coupled file organization form not only optimizes memory usage and improves rendering performance, but also makes the updates of single materials or local components more flexible, without the need to re-export the entire project, significantly improving the project maintenance efficiency and iteration speed.
[0099] Step 220: In Unity, the path of the structure file and the set of referenced files is parsed and verified, and the index path is intelligently corrected to obtain the corrected string.
[0100] In existing technologies, when the source file path changes or the filename is modified, it usually cannot be imported successfully directly, resulting in errors such as missing references. To address this, this embodiment performs secondary development on the Unity side to build a path detection algorithm. When the user selects a structure file, the Unity side executes the structure file loading process. When loading the .gltf text stream, it automatically parses the geometry and texture files referenced within it, such as parsing the URI of the index path mentioned in the example above, and verifies the validity of each file's path through the URI. If the path is invalid, an intelligent error correction (i.e., intelligent rectification) process is executed. This process locates the directory where the structure file is located, automatically scans for files with the same name or compatible files in the same directory, and dynamically corrects the index path of the structure file. In other words, the structure file is treated as JSON data, and the URI field in the JSON data is dynamically corrected to ensure that the loading flow is not interrupted.
[0101] Optionally, in this embodiment, the path parsing and verification of the structure file and the referenced file set are performed in Unity, and the index path is intelligently corrected to obtain the corrected string. This may include the following sub-steps:
[0102] Sub-step 2201: On the Unity side, the index path is parsed from the structure file to obtain the index values of the geometry file and texture file.
[0103] Sub-step 2202: Based on the index value, determine whether the geometry file and / or the texture file exist.
[0104] Sub-step 2203: If the geometry file and / or the texture file does not exist, a path detection algorithm is used to scan for the corresponding update file in the same directory where the structure file is stored, based on the index value and the main file name of the structure file.
[0105] Sub-step 2204: Construct a relative path using the updated file, dynamically correct the index path in the structure file, and obtain a corrected string.
[0106] A unified explanation is provided for sub-steps 2201-2204:
[0107] Reference Figure 3 As shown, in actual implementation, Unity can obtain the user-selected structure file and mark its path by calling a native file browsing interface (such as StandaloneFileBrowser). The text content of the structure file is read, treating it as a string and entering the preprocessing stage. During preprocessing, the index path (including buffers and images nodes) in the JSON structure is parsed to obtain the corresponding URI value. Then, the URI value is parsed to obtain the paths and filenames of the geometry and texture files. The URI value can consist of a path and a filename; when the referenced file set is stored in the same directory as the structure file, the path is empty, and the URI value is the filename.
[0108] The system searches for files corresponding to filenames under the URI path, verifying the validity of the URI path by checking if geometry files, texture files, etc., exist. If no corresponding file is found, it indicates that the path is invalid, and the geometry files or texture files may have been renamed or not stored under the URI path.
[0109] At this point, obtain the directory where the current structure file is located, and further determine the sibling directory. Under this sibling directory, based on the main file name of the structure file, scan the updated files of the geometry file and texture file. The updated file can be understood as the file after the original reference file set has been modified in terms of file name or path. The updated file includes files with the same name as the structure file in the sibling directory, or compatible files of the geometry file and texture file.
[0110] The updated file is used to construct a new relative path and replace the URI value in the JSON data, generating a corrected JSON string.
[0111] As an example, refer to Figure 4As shown, in Unity (whether in editor mode or the packaged .exe program), the user selects the Model_A.gltf file through the file browse window. If, during file transfer, the user manually renames Model_A.gltf and Model_A.bin to Project_X.gltf and Project_X.bin respectively, but does not modify the internal code of the Model_A.gltf file, the following intelligent path correction steps can be executed:
[0112] A1: The system reads the full text content of Project_X.gltf;
[0113] A2: Parse the JSON structure from the read text content, and further read the URI value under the buffers node from the parsed JSON data. Since the internal code of the Model_A.gltf file has not been modified, the URI value is Model_A.bin at this time;
[0114] A3: The system checks if Model_A.bin exists in the current directory. Since Model_A.bin has been renamed to Project_X.bin, the search result is that it does not exist.
[0115] A4: Triggering self-healing logic, executing the path detection algorithm. Specifically, the system obtains the currently loaded main file name Project_X. Based on the main file name Project_X, it searches for the existence of Project_X.bin in the same directory. The result is that Project_X.bin exists.
[0116] A5: The system dynamically replaces "uri": "Model_A.bin" in the JSON string with "uri": "Project_X.bin" in memory.
[0117] A6: Perform the same logic on texture maps (Images) to ensure that all referenced paths point to real local files, thus completing intelligent path correction.
[0118] Therefore, to address the problem in existing technologies where file renaming leads to invalid reference paths, resulting in model loading failures (white models / missing models), this embodiment introduces intelligent self-healing logic during Unity's file loading phase. It establishes an efficient and accurate algorithm to dynamically detect file existence at runtime and automatically correct JSON reference paths. Specifically, when the file pointed to by the original URI does not exist, it automatically searches for files with the same name or compatible suffixes in the same directory, using the current main filename as an index, and dynamically corrects the reference relationships in memory.
[0119] Step 230: Based on the corrected string, asynchronously load the structure file and the reference file set through a preset interface, instantiate the scene node tree, and generate an instantiated model.
[0120] Specifically, it can be deeply customized based on the GLTFast framework. On the Unity side, after reading the three types of files normally, it uses the corrected JSON string and GLTFast interface to start an asynchronous loading task, execute the asynchronous loading process, provide real-time feedback on the loading progress during the asynchronous loading process, and instantiate the scene node tree after loading is completed to generate an instantiated model of the 3D scene.
[0121] In practical implementation, this embodiment uses the corrected string as a basis and calls the structure file and the reference file set through a preset interface to perform asynchronous loading, instantiate the scene node tree, and generate an instantiated model. This can include: starting an asynchronous loading task based on the corrected string and the preset interface; performing asynchronous loading based on the structure file and the reference file set to generate an instantiated scene node tree; during the asynchronous loading process, using a polling mechanism to traverse the scene index in the structure file, updating the root node of the scene node tree, until the root node corresponds to a valid child object, and generating an instantiated model.
[0122] In the specific implementation, to address the issue that the main scene definition may be missing in the Revit exported file, this embodiment uses a polling mechanism to traverse all Scene indices in GLTF until the root node containing valid child objects is successfully instantiated, thus preventing the loading of empty objects.
[0123] Step 240: Perform material shading analysis on the scene node tree based on the preset rendering pipeline detection mechanism, and trigger shader repair logic when it is determined that a material is missing.
[0124] Step 250: Perform shader repair, correct the shading references of each material in the scene node tree according to the obtained rendering pipeline configuration, and update the instantiated model.
[0125] Steps 240-250 are described uniformly as follows:
[0126] To address issues such as material loss (e.g., model turning pink (InternalErrorShader)) caused by shader stripping after Unity build, this embodiment introduces an automatic shader adaptation mechanism for shader repair. During loading, it detects in real time whether material shaders are missing and redirects shaders through built-in rendering pipeline detection logic.
[0127] Specifically, the constructed scene node tree is traversed, and the MeshRenderer components generated by each node are analyzed. An automatic shader adaptation mechanism is used to determine if material shaders are missing. If a missing material shader is detected (e.g., its name contains "InternalError"), shader repair logic is triggered. The current rendering pipeline configuration is obtained, which is divided into built-in and universal rendering pipelines (URP). For different pipeline configurations, all material shader references are replaced in batches, material shaders are redirected to system-preset standard shaders (such as Universal RenderPipeline / Lit or Standard), and opacity and blending modes are processed. Color and opacity parameters are reset, and the instantiated model is updated to ensure correct model visual effects.
[0128] In one optional embodiment, correcting the shading references of each material in the scene node tree and updating the instantiated model according to the obtained rendering pipeline configuration may include: obtaining the rendering pipeline configuration of the scene node tree; when the rendering pipeline is configured as a general rendering pipeline, loading a preset shader as the target shader, or, when the rendering pipeline is configured as a general rendering pipeline, loading a standard shader as the target shader; traversing the currently generated mesh rendering components, reshaping the materials and material properties of the scene node tree based on the target shader, and updating the instantiated model.
[0129] In practical implementation, this embodiment can perform the following automatic shader adaptation process:
[0130] B1: After the model is instantiated, the script immediately traverses the MeshRenderer components of all child objects under the root node of the scene node tree.
[0131] B2: For each component, retrieve the component's material and check the current shader name of each material. If a material's shader name contains the keywords "Error" or "Internal," then the shader is considered missing.
[0132] B3: The system detects the rendering pipeline configuration (GraphicsSettings) of the current runtime environment.
[0133] If a Universal Render Pipeline (URP) is detected, the system's default Universal Render Pipeline / Lit Shader is loaded as the target Shader.
[0134] If a built-in pipeline is detected, the Standard Shader is loaded as the target Shader.
[0135] B4: Assign the correct target shader to the material sphere, and automatically set the rendering mode (Opaque / Transparent) and blending mode (SrcBlend / DstBlend) according to the material properties (such as the transparency alpha value) to correctly reproduce the visual effect of the material.
[0136] Therefore, this embodiment solves the problem of incompatibility between coordinate systems and material rendering mechanisms between heterogeneous software, enabling automated cross-platform adaptation. Specifically, addressing the differences between Revit and Unity in coordinate system definition and material rendering pipelines, this embodiment uses an automatic error correction algorithm in the transformation logic to automatically align model position, rotation, and scaling ratios, as well as automatically convert Revit material parameters to Unity standard material spheres (Standard / URP). This eliminates the tedious steps of manually adjusting materials and aligning model positions, achieving a one-click automated workflow from design to rendering. This embodiment incorporates pipeline detection logic during the model generation stage to automatically identify the current runtime environment (Built-in or URP) and force the material shader to be replaced with a system-preset standard shader (such as Universal Render Pipeline / Lit), while preserving the original material's color and transparency parameters.
[0137] Step 260: Execute the attribute mounting process, using a hierarchical fuzzy matching algorithm to parse the JSON data corresponding to the instantiated model, and determine the target instance and the attribute data corresponding to the target instance.
[0138] In the actual implementation, after the model is instantiated, the model geometry has been generated, and the attribute mounting coroutine can be started immediately to execute attribute mounting. During attribute mounting, the JSON data of the instantiated model (from the structure file) can be parsed, all nodes containing extended data can be traversed, the corresponding target instance can be found (e.g., GameObject instance in a game object, components such as structural columns), and the corresponding attribute data to be mounted can be extracted so that BIM attribute data can be "injected" into the instance later.
[0139] Optionally, the above-mentioned hierarchical fuzzy matching algorithm is used to parse the JSON data corresponding to the instantiated model to determine the target instance and the attribute data corresponding to the target instance. Specifically, it may include: using a hierarchical positioning algorithm to parse the JSON data in the instantiated model to locate the target instance, key parent nodes, and attribute data of the target instance, wherein the key parent node belongs to the target instance; using a fuzzy matching anchoring algorithm to traverse the JSON data and identify key child nodes associated with the key parent node; performing character cleaning based on the original name of the key child node to obtain an updated name; comparing the updated name and the original name to match key child nodes of the same type to the target instance, and mapping the attribute data to the key child node.
[0140] In the specific implementation, the core of attaching attribute data to the corresponding component lies in establishing the association between geometric objects and JSON data through a hierarchical-fuzzy matching dual anchoring algorithm. First, a hierarchical positioning algorithm is used to traverse all nodes containing extras data in the JSON data, extracting the Category field from the extras to obtain Category information. This information is then used to narrow down the search range within the Unity-generated model hierarchy. Within this search range, a fuzzy matching algorithm is used to find target instances such as GameObject instances and components, and to determine the corresponding attribute data for each target instance. Furthermore, for each target instance, the corresponding category parent node (such as "structural column") can be prioritized in the Unity scene as a key parent node.
[0141] The Unity engine typically renames multiple instances with the same name in an instantiated model. For example, multiple structural columns might have suffixes like Column_1, Column (2), etc. Understandably, in multiple instances of the same type, the names of child nodes and parent nodes can be related. Therefore, for key parent nodes, fuzzy matching can be used to anchor the child nodes of the parent node to obtain the key child nodes. Fuzzy matching can ignore the _Index or (Index) suffix in the name (i.e., ignore "_1", "(2)", etc.) to improve matching efficiency.
[0142] Finally, key child nodes are renamed and their names are updated to correctly map multiple instances of the same type to the same set of attribute data. Specifically, a character cleaning and prefix matching algorithm is used, ignoring special suffixes generated by Unity, comparing the scene object name with the original BIM component name, matching key child nodes of the same type to the corresponding target instances, and mapping attribute data to each key child node. For example, multiple structural columns with different names can be mapped to instances of the broad category of "structural column" simultaneously, and attribute data can be mapped to multiple structural columns, facilitating subsequent attribute attachment.
[0143] Step 270: Perform deserialization and instantiation processing based on the attribute data to generate a script component.
[0144] Step 280: Dynamically add an attribute storage component to the target instance, mount the script component to the attribute storage component, establish the association between geometry and attributes, and generate a Unity model with extended data.
[0145] Steps 270-280 will be described in detail:
[0146] In this embodiment, the retrieved JSON-formatted attribute data is deserialized to generate key-value pairs. The key-value pairs are then instantiated to convert them into Unity script components, such as Unity's MonoBehaviour script components, including GltfPropertyData.
[0147] A property storage component is dynamically added to the GameObject instance found above, and the script component is attached to the GameObject instance, thereby filling the list of key-value pairs corresponding to the property data into the component, and thus realizing persistent storage and interactive access of the data.
[0148] For example, refer to Figure 5 As shown, to address the issue of BIM attributes not being accurately attached to the corresponding components due to Unity's automatic renaming, this application can specifically implement attribute attachment by performing the following process:
[0149] As can be seen from the above example, during the export stage of this application, the Revit plugin has written the component properties into the extras node of the structural file. Assuming that the attribute data in the JSON data is an example of: { "name": "rectangular structural column_600x600", "extras": { "Category": "structural column", "ElementID": "345212", "fire rating": "Level 1", "manufacturer": "XXX building materials factory"}}.
[0150] In the fuzzy matching anchoring of scene objects and data, when the model is generated in Unity, since there are multiple pillars of the same type in the scene, Unity will automatically name them as: {Object A: Rectangular structure pillar_600x600}; {Object B: Rectangular structure pillar_600x600 (1)}; {Object C: Rectangular structure pillar_600x600_2}.
[0151] To accurately assign the same set of attribute data to the three objects mentioned above, the following association process can be performed:
[0152] C1: Execute level locking (first-level anchoring). The system reads the Category value from the JSON data, which is "Structural Column". The system traverses the root node of the Unity scene, searching for each instance, such as the node named "Structural Column" (parent object). Once found, the subsequent search scope is limited to below this parent object, greatly narrowing the search range and improving efficiency. The parent object obtained at this point is the Structural Column, which can be used as a key parent node.
[0153] C2: Perform name cleaning and prefix matching (secondary anchoring). The system iterates through the JSON and finds the name "rectangular structure column_600x600". Under the parent object "structure column", it iterates through all child objects, and the key child nodes obtained include the aforementioned objects A, B, and C.
[0154] A character cleaning algorithm is performed on each sub-object name: First, the sub-object name is analyzed and identified, and spaces, parentheses, and numbers at the end of the name are removed, such as "(1)" in "rectangular structure column_600x600 (1)". Then, underscores and numbers at the end are removed, such as "_2" in "rectangular structure column_600x600_2". The updated name obtained after cleaning is "rectangular structure column_600x600". The system compares the cleaned name with the original name, and the result shows a successful match.
[0155] C3: Executes componentized data mounting. Specifically, after a successful match, the system automatically adds a custom script component GltfPropertyData to objects A, B, and C respectively, deserializing the key-value pairs (ElementID, fire rating, manufacturer, etc.) in the JSON into a C# list and populating it into the component's public variable.
[0156] Final result: When a user clicks on any column (such as object B) in the Unity runtime interface, the GltfPropertyData component on that object can be read through the UI interface, and the corresponding BIM property (such as "fire protection rating: level one") can be viewed immediately, realizing the complete correspondence between the model geometry and its non-geometric extended data.
[0157] Therefore, this embodiment establishes an automated mapping mechanism between geometric objects and business data, solving the technical problem of the difficulty in automatically mounting and interacting with BIM component attributes in Unity. Specifically, addressing the inefficiency of existing technologies that require manual addition of scripts and data entry for massive numbers of components in Unity, this embodiment develops a dedicated data parsing and mounting script on the Unity side. This script can automatically read the exported extended data package while the model geometry is being generated, accurately "anchoring" and mounting BIM attributes such as structural type, dimensional parameters, and manufacturer information to the corresponding Unity GameObjects. This mechanism enables the imported model to immediately possess interactive capabilities, significantly reducing the threshold and time cost of developing interactive applications.
[0158] Furthermore, this embodiment addresses the issue of Unity engine automatically adding suffixes to duplicate instances, leading to mismatches with source data, by proposing a dual matching strategy. During the first-level anchoring, the range of corresponding parent nodes in the Unity scene is locked based on the "category" field of the BIM data. During the second-level anchoring, the range of parent nodes is used as a benchmark, and suffixes generated by Unity are ignored through regular expressions or string cleaning algorithms, achieving a precise mapping between scene object names and source BIM component names.
[0159] Step 290: Perform scene post-processing and interaction initialization on the Unity model, and update the Unity model.
[0160] In practical implementation, based on the method for converting a Revit model into a Unity model with extended data provided in the embodiments of this application, an automated conversion and attribute reconstruction system for Revit to Unity models based on the GLTF standard extension can be realized. This system mainly includes: a source data extraction and separation module, an intermediate data storage layer, a target asynchronous loading and reconstruction module, and an attribute automatic parsing and mounting module.
[0161] In summary, this embodiment of the application constructs a custom export program on the Revit side, structurally separating the complex BIM data into geometric data files (GLTF / BIN) and texture resource files (JPG), and simultaneously extracting component attribute information. On the Unity side, using custom import logic in conjunction with the GLTFast plugin, the above files are automatically parsed and reassembled, achieving lossless transfer of material mapping and attribute data from Revit to Unity, ensuring the consistency of model visuals and information in the digital twin scene. Furthermore, scene post-processing and interactive initialization are performed on the Unity model, enabling the model to support various interactive functions.
[0162] Compared with the aforementioned prior art, the invention has the following significant advantages and beneficial effects:
[0163] 1. Regarding "generated models and materials": This invention achieves high-fidelity and robust 3D visualization reconstruction. Specifically, addressing the technical problem of "white models" or texture errors occurring when files are renamed or moved in existing technologies, this invention first introduces intelligent self-healing of material paths, solving the problem of "material loss" caused by chaotic file management. Second, through a built-in intelligent path correction mechanism, this invention can automatically detect invalid texture reference paths during the generation of models and materials, and intelligently search for and dynamically replace them with files of the same name or compatible files in the same directory. This ensures that the generated model can still fully present the original design even when the source file naming is not standardized.
[0164] This invention solves the problem of abnormal model display (turning pink) after deployment by automatically adapting the rendering shader. Specifically, addressing the technical flaw of the Unity engine that easily removes dynamic material shaders during packaging and deployment, this invention integrates automatic shader adaptation logic during material generation. It can forcibly reset the material shaders according to the current runtime environment (built-in pipeline or URP pipeline), ensuring that the generated model can correctly display material colors and transparency whether in the editor or in the deployed application, without the need for manual correction.
[0165] 2. Regarding "generating extended data," this invention achieves precise and automated association between geometric objects and BIM attributes:
[0166] Specifically, this invention overcomes the limitations of naming convention differences across heterogeneous platforms, achieving fully automatic mounting of attribute data: Existing technologies, when importing Revit models, automatically add suffixes to duplicate component instances in Unity, causing the traditional logic of matching data by name to fail. This invention employs a dual anchoring algorithm of category locking and fuzzy matching, which automatically ignores the differentiated suffixes generated by Unity when generating extended data, accurately identifying the original identity of the components. This ensures that every generated geometric model (regardless of its instance number) can be accurately associated with its corresponding BIM extended data such as structural type, dimensions, and manufacturer.
[0167] 3. This invention enables integrated delivery of models and data, improving the development efficiency of digital twin applications:
[0168] Specifically, using the method of this invention, users can simultaneously generate extended data components containing complete business information while generating a 3D model, without writing additional query scripts or manually entering data. This "what you see is what you get" data generation method enables the imported model to directly possess interactive query capabilities, greatly reducing the complexity of secondary development of BIM data in game engines.
[0169] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should know that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps may be performed in other orders or simultaneously.
[0170] like Figure 6 As shown in the illustration, this application also provides an apparatus 600 for converting a Revit model into a Unity model with extended data, comprising:
[0171] The source data extraction and separation module 610 is used to perform component element analysis on the selected 3D view in Revit to obtain a set of referenced files and a JSON-formatted structural file. The structural file references the geometric files and texture files in the set of referenced files through an index path.
[0172] The target-side asynchronous loading and reconstruction module 620 is used in Unity to parse and verify the paths of the structure file and the reference file set, intelligently correct the index path, and obtain a correction string; based on the correction string, asynchronous loading is performed using the structure file and the reference file set, and the scene node tree loaded by the shader repair logic is processed to obtain an instantiated model;
[0173] The attribute automatic parsing and mounting module 630 is used to parse the attributes of the instantiated model, mount the parsed attribute data to the target instance, establish the association between geometry and attributes, and generate a Unity model with extended data.
[0174] The Scene Interaction Module 640 is used to perform scene post-processing and interaction initialization on Unity models, and to update Unity models.
[0175] The target-side asynchronous loading and reconstruction module is based on a deeply customized GLTFast framework and is responsible for reading various files and generating 3D scenes in the Unity runtime environment. It specifically includes the following sub-units:
[0176] The intelligent path correction unit is used in Unity to parse the index path from the structure file to obtain the index values of the geometry file and texture file; based on the index values, it determines whether the geometry file and / or the texture file exists; if the geometry file and / or the texture file does not exist, a path detection algorithm is used to scan the corresponding update file in the same directory as the structure file based on the index value and the main file name of the structure file; a relative path is constructed using the update file, and the index path is dynamically corrected in the structure file to obtain the correction string.
[0177] The scene brute-force polling instantiation unit is used to asynchronously load the structure file and the reference file set through a preset interface based on the modified string, instantiate the scene node tree, and generate an instantiated model.
[0178] The Shader Auto-Adaptation and Repair Unit is used to perform material shading analysis on the scene node tree based on a preset rendering pipeline detection mechanism. When it is determined that a material is missing, the shader repair logic is triggered. The shader repair is executed, and the shading references of each material in the scene node tree are corrected according to the obtained rendering pipeline configuration, and the instantiated model is updated.
[0179] It should be noted that the apparatus for converting a Revit model into a Unity model with extended data provided in the embodiments of this application can execute the method for converting a Revit model into a Unity model with extended data provided in any embodiment of this application, and has the corresponding functions and beneficial effects of executing the method.
[0180] In specific implementations, the aforementioned device can be integrated into a device, enabling the device to function as an electronic device. This electronic device can consist of two or more physical entities, or it can consist of a single physical entity. For example, an electronic device can be a personal computer (PC), a computer, a server, etc. This application does not impose specific limitations on this.
[0181] like Figure 6 As shown, this application embodiment provides an electronic device, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114. The processor 111, communication interface 112, and memory 113 communicate with each other via the communication bus 114. The memory 113 stores computer programs. When the processor 111 executes the program stored in the memory 113, it implements the steps of the method provided in any of the foregoing method embodiments. For example, the steps of the method may include the following:
[0182] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method provided in any of the foregoing method embodiments.
[0183] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0184] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for converting a Revit model into a Unity model with extended data, characterized in that, include: In Revit, component element analysis is performed on the selected 3D view to obtain a set of referenced files and a JSON-formatted structural file. The structural file references the geometry and texture files in the set of referenced files through an index path. In Unity, the paths of the structure file and the set of referenced files are parsed and verified, and the index path is intelligently corrected to obtain the corrected string; Based on the corrected string, asynchronous loading is performed using the structure file and the reference file set. The scene node tree loaded is processed by the shader repair logic to obtain the instantiated model. The instantiated model is parsed for attributes, and the parsed attribute data is mounted to the target instance to establish the association between geometry and attributes, generating a Unity model with extended data. Perform scene post-processing and interaction initialization on the Unity model, and update the Unity model.
2. The method according to claim 1, characterized in that, Perform component element analysis on the selected 3D view to obtain a set of referenced files and a JSON-formatted structure file, including: The selected 3D view is subjected to geometric analysis to extract geometric mesh data, and the 3D view is subjected to texture mapping and non-geometric analysis to extract texture mapping data; A geometry file is generated based on the geometry mesh data, and a texture file is generated based on the texture mapping data; Traverse each element in the 3D view and construct a node tree with a JSON structure using the key data of the elements; The acquired non-geometric attributes are written into the extended fields of each node tree, the node trees are updated, a structure file is generated, and an index path is established in the structure file based on the filenames of the geometry file and the texture file.
3. The method according to claim 1, characterized in that, In Unity, the paths of the structure file and the referenced file set are parsed and verified, and the index path is intelligently corrected to obtain a corrected string, including: On the Unity side, the index path is parsed from the structure file to obtain the index values of the geometry file and texture file; Based on the index value, determine whether the geometry file and / or the texture file exists; If the geometry file and / or the texture file does not exist, a path detection algorithm is used to scan for the corresponding update file in the same directory where the structure file is stored, based on the index value and the main file name of the structure file. The relative path is constructed using the updated file, and the index path is dynamically corrected in the structure file to obtain the corrected string.
4. The method according to claim 1, characterized in that, Based on the corrected string, asynchronous loading is performed using the structure file and the reference file set. The scene node tree loaded is then processed through shader repair logic to obtain an instantiated model, including: Based on the corrected string, the structure file and the reference file set are asynchronously loaded through a preset interface to instantiate the scene node tree and generate an instantiated model; The scene node tree is analyzed for material shading based on a preset rendering pipeline detection mechanism. When a material is found to be missing, the shader repair logic is triggered. Perform shader repair, correct the shading references of each material in the scene node tree according to the obtained rendering pipeline configuration, and update the instantiated model.
5. The method according to claim 4, characterized in that, Based on the corrected string, the structure file and the referenced file set are asynchronously loaded through a preset interface to instantiate the scene node tree and generate an instantiated model, including: Based on the corrected string and the preset interface, initiate an asynchronous loading task; Asynchronous loading is performed based on the structure file and the set of referenced files to generate an instantiated scene node tree; During the asynchronous loading process, a polling mechanism is used to traverse the scene index in the structure file, update the root node of the scene node tree, until the root node corresponds to a valid child object, and generate an instantiated model.
6. The method according to claim 4, characterized in that, Based on the obtained rendering pipeline configuration, correct the shading references of each material in the scene node tree, and update the instantiated model, including: Obtain the rendering pipeline configuration of the scene node tree; When the rendering pipeline is configured as a general rendering pipeline, a preset shader is loaded as the target shader; or, when the rendering pipeline is configured as a general rendering pipeline, a standard shader is loaded as the target shader. Traverse the currently generated mesh rendering components, redirect the shading of the material and material properties of the scene node tree based on the target shader, and update the instantiated model.
7. The method according to claim 1, characterized in that, The instantiated model undergoes attribute parsing, and the parsed attribute data is mounted to the target instance, establishing the association between geometry and attributes to generate a Unity model with extended data, including: The attribute mounting process is executed, and a hierarchical fuzzy matching algorithm is used to parse the JSON data corresponding to the instantiated model to determine the target instance and the attribute data corresponding to the target instance. Based on the attribute data, deserialization and instantiation are performed to generate script components; A property storage component is dynamically added to the target instance, the script component is mounted to the property storage component, the relationship between geometry and properties is established, and a Unity model with extended data is generated.
8. The method according to claim 7, characterized in that, A hierarchical fuzzy matching algorithm is used to parse the JSON data corresponding to the instantiated model to determine the target instance and the attribute data corresponding to the target instance, including: A hierarchical positioning algorithm is used to parse the JSON data in the instantiated model to locate the target instance, key parent node, and attribute data of the target instance, wherein the key parent node belongs to the target instance; A fuzzy matching anchoring algorithm is used to traverse the JSON data and identify the key child nodes associated with the key parent node; The updated name is obtained by cleaning the characters based on the original name of the key child node; By comparing the updated name and the original name, key child nodes of the same type are matched to the target instance, and the attribute data is mapped to the key child nodes.
9. The method according to claim 1, characterized in that, Perform scene post-processing and interaction initialization on the Unity model, and update the Unity model, including: Analyze the overall bounding box of a Unity model; Post-processing is performed on the overall bounding box to adaptively adjust the camera focus to the center of the Unity model; Add a collider to the generated target object in the Unity model, initialize the interaction, and update the Unity model.
10. An apparatus for converting a Revit model into a Unity model with extended data, characterized in that, include: The source data extraction and separation module is used to perform component element analysis on the selected 3D view in Revit to obtain a set of referenced files and a JSON-formatted structural file. The structural file references the geometric files and texture files in the set of referenced files through an index path. The target-side asynchronous loading and reconstruction module is used in Unity to parse and verify the paths of the structure file and the reference file set, intelligently correct the index path, and obtain the correction string. Based on the corrected string, asynchronous loading is performed using the structure file and the reference file set. The scene node tree loaded is processed by the shader repair logic to obtain the instantiated model. The attribute automatic parsing and mounting module is used to parse the attributes of the instantiated model, mount the parsed attribute data to the target instance, establish the association between geometry and attributes, and generate a Unity model with extended data. The Scene Interaction module is used to perform scene post-processing and interaction initialization on Unity models, and to update Unity models.