A three-dimensional scene building method, device and equipment and readable storage medium
By parsing CAD files and automatically instantiating 3D models, the problem of low automation in 3D scene construction in existing technologies has been solved, achieving higher accuracy and a simplified process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HIKROBOT TECH CO LTD
- Filing Date
- 2026-05-08
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, the automation level of 3D scene construction based on CAD data is low, relying on manual operation, resulting in a large workload and easy introduction of human error, making it impossible to accurately restore the original geometric relationships and spatial layout.
By parsing CAD files, the system automatically identifies independent basic graphic elements and blocks. Based on this data, it instantiates 3D models in the interface and provides transformation and configuration interfaces, reducing manual intervention.
It improves the accuracy and automation of 3D scene construction, reduces process complexity, and minimizes human error.
Smart Images

Figure CN122492929A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D scene construction technology, and in particular to a 3D scene construction method, apparatus, device and readable storage medium. Background Technology
[0002] In scenarios such as industrial layout planning and factory simulation visualization, building 3D scenes based on original computer-aided design (CAD) data is a key technical prerequisite for scheme verification, ergonomic analysis, path planning, and interactive demonstration.
[0003] Currently, designers typically convert CAD data into images, which are then imported into 3D simulation software as base maps. The designers then place the 3D models within the 3D scene based on these base maps.
[0004] However, the above methods have a low degree of automation and rely heavily on manual operation for locating and adding 3D models. This not only results in a huge workload and cumbersome processes, but also introduces human error, making it impossible for the final generated 3D scene to accurately reproduce the geometric relationships and spatial layout defined in the original CAD data. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, device, and readable storage medium for building a 3D scene, so as to reduce the complexity of the building process and improve the accuracy of the built 3D scene. The specific technical solution is as follows:
[0006] The first aspect of this application provides a method for building a three-dimensional scene, the method comprising:
[0007] Obtain the CAD file of the scene to be modeled;
[0008] The CAD file is parsed to determine the independent basic graphic elements and blocks contained in the CAD file;
[0009] For each specified block in the CAD file, based on the data of the specified block recorded in the CAD file, the 3D model represented by the specified block is instantiated in the building interface; for each specified independent basic graphic element in the CAD file, based on the data of the specified independent basic graphic element recorded in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the building interface.
[0010] In one optional embodiment, for each specified block in the CAD file, based on the data of the specified block recorded in the CAD file, a 3D model representing the specified block is instantiated in the building interface; for each specified independent basic graphic element in the CAD file, based on the data of the specified independent basic graphic element recorded in the CAD file, a 3D model representing the specified independent basic graphic element is instantiated in the building interface, including:
[0011] The independent basic graphic elements that are parsed out are sampled, and the basic graphic elements contained in the parsed block are sampled to obtain the positions of multiple sampling points and the connection order between each sampling point;
[0012] Based on the obtained connection order and the position of the sampling points, render each sampling point and the connection between each sampling point in the building interface to obtain the underlying model, so that the user can trigger the confirmation building command based on the displayed underlying model.
[0013] When the confirmation assembly instruction is received, for each specified block in the CAD file, the 3D model represented by the specified block is instantiated in the assembly interface according to the data of the corresponding part of the specified block in the displayed underlying model; for each specified independent basic graphic element in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the assembly interface according to the data of the corresponding part of the specified independent basic graphic element in the displayed underlying model.
[0014] In an optional embodiment, before receiving the confirmation setup instruction, the method further includes:
[0015] When a transformation instruction is received for the underlying model to be displayed, the underlying model to be displayed is adjusted according to the adjustment method indicated by the transformation instruction.
[0016] The adjustment method indicated by the transformation command includes at least one of the following: translation, rotation, scaling up, and scaling down.
[0017] In an optional embodiment, sampling the parsed independent basic graphic elements and sampling the basic graphic elements contained in the parsed block to obtain the positions of multiple sampling points and the connection order between the sampling points includes:
[0018] For each basic graphic element in the CAD file, the basic graphic element is sampled at different sampling intervals to obtain multiple sampling results for the basic graphic element; wherein, one sampling result of the basic graphic element includes: the positions of multiple sampling points obtained according to a sampling interval and the connection order between the sampling points.
[0019] The underlying model can be displayed in the following ways:
[0020] For each basic graphic element in the CAD file, calculate the current distance between that basic graphic element and the observation point;
[0021] From multiple sampling results of the basic graphic element, a sampling result corresponding to the distance is determined; wherein the number of sampling points contained in a sampling result is negatively correlated with the corresponding distance;
[0022] The interface renders each sampling point in the determined sampling results, and renders the connections between the sampling points according to the connection order in the determined sampling results.
[0023] In an optional embodiment, the method further includes:
[0024] When instantiating a 3D model in the interface, stop displaying the underlying model.
[0025] In an optional embodiment, before instantiating the 3D model in the building interface, the method further includes:
[0026] Display block configuration interface; wherein, the block configuration interface includes a block selection area and a block configuration area; the block selection area displays the block identifier of the parsed block;
[0027] When a first selection instruction is received for a block identifier in the block selection area, the block identifier indicated by the first selection instruction is displayed in the block configuration area;
[0028] When a first configuration instruction is received for each block identifier in the block configuration area, the three-dimensional model indicated by the first configuration instruction is determined as the three-dimensional model representing the specified block corresponding to that block identifier.
[0029] In an optional embodiment, before instantiating the 3D model in the building interface, the method further includes:
[0030] The graphical element configuration interface is displayed; wherein, the graphical element configuration interface includes a layer selection area and a layer configuration area; the layer selection area displays the layer identifier of the layer to which the parsed independent basic graphical element belongs;
[0031] When a second selection instruction is received for a layer identifier in the layer selection area, the layer identifier indicated by the second selection instruction is displayed in the layer configuration area;
[0032] When a second configuration instruction is received for each layer identifier in the layer configuration area, the three-dimensional model indicated by the second configuration instruction is determined as a three-dimensional model represented by a specified independent basic graphic element in the layer corresponding to that layer identifier.
[0033] A second aspect of this application provides a three-dimensional scene construction apparatus, the apparatus comprising:
[0034] The file acquisition module is used to acquire the CAD file of the scene to be modeled;
[0035] The parsing module is used to parse the CAD file and determine the independent basic graphic elements and blocks contained in the CAD file;
[0036] The instantiation module is used to instantiate the 3D model represented by each specified block in the CAD file in the building interface, based on the data of the specified block recorded in the CAD file; and to instantiate the 3D model represented by each specified independent basic graphic element in the CAD file in the building interface, based on the data of the specified independent basic graphic element recorded in the CAD file.
[0037] In an optional embodiment, the instantiation module is specifically used to sample the parsed independent basic graphic elements and to sample the basic graphic elements contained in the parsed block to obtain the positions of multiple sampling points and the connection order between each sampling point.
[0038] Based on the obtained connection order and the position of the sampling points, render each sampling point and the connection between each sampling point in the building interface to obtain the underlying model, so that the user can trigger the confirmation building command based on the displayed underlying model.
[0039] When the confirmation assembly instruction is received, for each specified block in the CAD file, the 3D model represented by the specified block is instantiated in the assembly interface according to the data of the corresponding part of the specified block in the displayed underlying model; for each specified independent basic graphic element in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the assembly interface according to the data of the corresponding part of the specified independent basic graphic element in the displayed underlying model.
[0040] In an optional embodiment, the apparatus further includes:
[0041] The adjustment display module is used to adjust the underlying model of the display according to the adjustment method indicated by the transformation instruction when a transformation instruction for the underlying model of the display is received before the confirmation building instruction is received.
[0042] The adjustment method indicated by the transformation command includes at least one of the following: translation, rotation, scaling up, and scaling down.
[0043] In an optional embodiment, the instantiation module is specifically used to sample each basic graphic element in the CAD file according to different sampling intervals to obtain multiple sampling results for the basic graphic element; wherein, one sampling result of the basic graphic element includes: the positions of multiple sampling points obtained according to a sampling interval and the connection order between the sampling points.
[0044] For each basic graphic element in the CAD file, calculate the current distance between that basic graphic element and the observation point;
[0045] From multiple sampling results of the basic graphic element, a sampling result corresponding to the distance is determined; wherein the number of sampling points contained in a sampling result is negatively correlated with the corresponding distance;
[0046] The interface renders each sampling point in the determined sampling results, and renders the connections between the sampling points according to the connection order in the determined sampling results.
[0047] In an optional embodiment, the apparatus further includes:
[0048] The Stop Display module is used to stop displaying the underlying model when instantiating a 3D model in the building interface.
[0049] In an optional embodiment, the apparatus further includes:
[0050] The first configuration module is used to display a block configuration interface before instantiating the 3D model in the building interface; wherein, the block configuration interface includes a block selection area and a block configuration area; the block selection area displays the block identifiers of the parsed blocks;
[0051] When a first selection instruction is received for a block identifier in the block selection area, the block identifier indicated by the first selection instruction is displayed in the block configuration area;
[0052] When a first configuration instruction is received for each block identifier in the block configuration area, the three-dimensional model indicated by the first configuration instruction is determined as the three-dimensional model representing the specified block corresponding to that block identifier.
[0053] In an optional embodiment, the apparatus further includes:
[0054] The second configuration module is used to display the graphic element configuration interface before instantiating the 3D model in the building interface; wherein, the graphic element configuration interface includes a layer selection area and a layer configuration area; the layer selection area displays the layer identifier of the layer to which the parsed independent basic graphic element belongs;
[0055] When a second selection instruction is received for a layer identifier in the layer selection area, the layer identifier indicated by the second selection instruction is displayed in the layer configuration area;
[0056] When a second configuration instruction is received for each layer identifier in the layer configuration area, the three-dimensional model indicated by the second configuration instruction is determined as a three-dimensional model represented by a specified independent basic graphic element in the layer corresponding to that layer identifier.
[0057] A third aspect of this application provides an electronic device, comprising:
[0058] Memory, used to store computer programs;
[0059] When a processor executes a program stored in memory, it implements any of the methods described in the first aspect above.
[0060] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the methods described in the first aspect above.
[0061] The fifth aspect of this application provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods described in the first aspect above.
[0062] Beneficial effects of the embodiments in this application:
[0063] The three-dimensional scene building method provided in this application embodiment obtains the CAD file of the scene to be modeled; parses the CAD file to determine the independent basic graphic elements and blocks contained in the CAD file; for each specified block in the CAD file, based on the data of the specified block recorded in the CAD file, instantiates the three-dimensional model represented by the specified block in the building interface; for each specified independent basic graphic element in the CAD file, based on the data of the specified independent basic graphic element recorded in the CAD file, instantiates the three-dimensional model represented by the specified independent basic graphic element in the building interface.
[0064] Based on the above processing, the CAD file is automatically parsed by electronic devices, and the 3D model is automatically instantiated in the building interface according to the data of each element in the parsing result. There is no need for manual positioning and addition of the 3D model, which reduces the risk of human error, lowers the complexity of the building process, and improves the accuracy of the built 3D scene.
[0065] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0066] 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, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0067] Figure 1 A flowchart illustrating a three-dimensional scene construction method provided in an embodiment of this application;
[0068] Figure 2 A flowchart illustrating another three-dimensional scene construction method provided in this application embodiment;
[0069] Figure 3 A schematic diagram of a block configuration interface provided in an embodiment of this application;
[0070] Figure 4 This is a schematic diagram of a layer selection area provided in an embodiment of this application;
[0071] Figure 5 A schematic diagram of a CAD drawing provided for an embodiment of this application;
[0072] Figure 6 A method based on the embodiments of this application is provided. Figure 5 A schematic diagram of the 3D scene built from the CAD drawings shown;
[0073] Figure 7 A flowchart illustrating another method for building a three-dimensional scene provided in this application embodiment;
[0074] Figure 8 This is a schematic diagram of the structure of a three-dimensional scene building device provided in an embodiment of this application;
[0075] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0076] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0077] Currently, designers typically convert CAD data into images and import them into 3D simulation software as a base map. Then, they place the 3D model within the 3D scene based on this base map. This process results in a massive workload, cumbersome procedures, and introduces human error, making it difficult for the final 3D scene to accurately reproduce the geometric relationships and spatial layout defined in the original CAD data.
[0078] To address the aforementioned technical problems, embodiments of this application provide a method, apparatus, device, and readable storage medium for building a three-dimensional scene. The method for building a three-dimensional scene provided in this application is described below. This method can be applied to electronic devices. For example, an electronic device can execute the method for building a three-dimensional scene provided in this application using installed three-dimensional simulation software.
[0079] In one embodiment, the 3D scene construction method includes: acquiring a CAD file of the scene to be modeled; parsing the CAD file to determine the independent basic graphic elements and blocks contained in the CAD file; for each specified block in the CAD file, instantiating the 3D model represented by the specified block in the construction interface based on the data of the specified block recorded in the CAD file; and for each specified independent basic graphic element in the CAD file, instantiating the 3D model represented by the specified independent basic graphic element in the construction interface based on the data of the specified independent basic graphic element recorded in the CAD file. Thus, by automatically parsing the CAD file through an electronic device and automatically instantiating the 3D model in the construction interface based on the data of each element in the parsing result, manual positioning and addition of the 3D model are eliminated, reducing the likelihood of human error, simplifying the construction process, and improving the accuracy of the constructed 3D scene.
[0080] In one embodiment, see Figure 1 The three-dimensional scene construction method provided in this application includes the following steps:
[0081] S101: Obtain the CAD (Computer-Aided Design) file of the scene to be modeled.
[0082] When it is necessary to build a model of a real-world scene (i.e., the scene to be modeled), a CAD file of that scene can be obtained; that is, a CAD file pre-drawn based on the real-world scene. In other words, the obtained CAD file represents the real-world scene that needs to be built. For example, the obtained CAD file may be in dwg or dxf format.
[0083] The scene to be modeled can be a factory or plant; correspondingly, based on the constructed 3D scene, the rationality of the factory layout can be analyzed. Alternatively, the scene to be modeled can also be a robot performing a task; correspondingly, based on the constructed 3D scene, the rationality of the robot's path planning can be analyzed.
[0084] When a 3D scene needs to be built, the user can import the CAD file into the 3D simulation software, and then the 3D simulation software can process it based on the 3D scene building method provided in the embodiments of this application.
[0085] S102: Parse the CAD file to determine the independent basic graphic elements and blocks contained in the CAD file.
[0086] In one embodiment, the basic graphic element is a line segment, a polyline, or a curve. The curve can be a circle, an arc, or an ellipse.
[0087] Understandably, in real-world CAD files, basic graphic elements are used to represent the centerlines of linear structures such as passageways, pipelines, corridors, or paths. A block is a composite data structure that can be defined by combining multiple basic graphic elements or other blocks (nested blocks).
[0088] To distinguish them, in this embodiment of the application, basic graphic elements in a CAD file that are not used to form blocks are referred to as independent basic graphic elements. For example, a line segment representing a corridor in a CAD file is an independent basic graphic element.
[0089] For example, by calling a CAD parsing library to parse a CAD file, the independent basic graphic elements and blocks contained in the CAD file can be identified, and data for each independent basic graphic element and each block can be obtained. Correspondingly, the data for each independent basic graphic element can represent its pose and shape; the data for each block can represent its pose and shape. Furthermore, parsing a CAD file can also determine the layer to which each independent basic graphic element belongs, as well as the layer to which each block belongs.
[0090] S103: For each specified block in the CAD file, based on the data of the specified block recorded in the CAD file, instantiate the 3D model represented by the specified block in the building interface; For each specified independent basic graphic element in the CAD file, based on the data of the specified independent basic graphic element recorded in the CAD file, instantiate the 3D model represented by the specified independent basic graphic element in the building interface.
[0091] The instantiated 3D model is pre-stored locally on the electronic device; for example, it could be a model configured by default within the device, or one uploaded by the user. The setup interface, also known as the canvas, is the interface provided by the 3D simulation software for building 3D scenes. Instantiating the 3D model within the setup interface means rendering the 3D model at the corresponding location within the interface.
[0092] A specified block can contain all blocks in a CAD file, or it can be a subset of blocks within a CAD file. In other words, a specified block is the block in the CAD file that corresponds to the 3D model to be rendered. For example, for some objects in a scene (such as a trash can), although the CAD file contains blocks representing those objects, if these objects are not needed when analyzing the 3D scene, then there is no need to render their 3D models in the build interface. Correspondingly, these blocks are non-specified blocks.
[0093] In one embodiment, the user can pre-configure the block identifier of a specified block in the electronic device. Correspondingly, the electronic device can obtain the identifier of each block (i.e., block identifier) by parsing the CAD file, and the specified block can be determined based on the parsed block identifier after parsing the CAD file.
[0094] In one embodiment, the user can also pre-configure the correspondence between block identifiers and 3D models in the electronic device. Accordingly, for any specified block, the electronic device can determine the 3D model corresponding to the specified block, that is, the 3D model represented by the specified block, based on the correspondence. Alternatively, the correspondence between block identifiers and 3D models can also be determined when building a 3D scene in the past. Accordingly, when building a 3D scene this time, the electronic device can obtain the correspondence and determine the 3D model represented by the specified block.
[0095] Since block data can represent the pose and shape of the block, electronic devices can instantiate the 3D model represented by the specified block in the building interface based on the data of the specified block, so that the geometric relationship and spatial layout represented by the rendered 3D model conform to the original CAD file, that is, conform to the real scene.
[0096] Similarly, specifying independent basic graphic elements can include all independent basic graphic elements in the CAD file, or it can be a subset of independent basic graphic elements in the CAD file. In other words, specifying independent basic graphic elements refers to the independent basic graphic elements in the CAD file that need to be rendered into the corresponding 3D model. For example, for some objects in a scene (such as railings), although the CAD file contains independent basic graphic elements representing these objects, if these objects are not needed when analyzing the 3D scene, then there is no need to render the 3D models of these objects in the building interface. Correspondingly, these independent basic graphic elements are non-specified independent basic graphic elements.
[0097] In one embodiment, the user can also pre-configure the correspondence between layers and 3D models in the electronic device. Accordingly, for any independent basic graphic element, the electronic device can determine the layer to which that independent basic graphic element belongs in the CAD file. If the correspondence contains a layer to which the independent basic graphic element belongs, then that independent basic graphic element is the specified basic graphic element. Correspondingly, the 3D model corresponding to the layer to which the independent basic graphic element belongs is the 3D model represented by the specified independent basic graphic element. Alternatively, the correspondence between layers and 3D models can also be determined during the previous construction of the 3D scene. Accordingly, during the current construction of the 3D scene, the electronic device can obtain this correspondence and determine the 3D model corresponding to the specified independent basic graphic element.
[0098] Since the data of independent basic graphic elements can represent the pose and shape of independent basic graphic elements, electronic devices can instantiate a 3D model represented by a specified independent basic graphic element in the interface based on the data of independent basic graphic elements, so that the geometric relationship and spatial layout represented by the rendered 3D model conforms to the original CAD file, that is, conforms to the real scene.
[0099] It's understandable that, since the underlying model is constructed based on sampling points and connections, it can be understood as a line-like / mesh-like model. The instantiated 3D model, on the other hand, can be understood as a model that accurately represents the object's true 3D shape.
[0100] In one embodiment, see Figure 2Step S103 above includes the following steps: S1031: Sampling the parsed independent basic graphic elements and sampling the basic graphic elements contained in the parsed block to obtain the positions of multiple sampling points and the connection order between each sampling point; S1032: According to the obtained connection order and the positions of the sampling points, rendering each sampling point and the connection between each sampling point in the building interface to obtain the underlying model, so that the user can trigger a confirmation building command based on the displayed underlying model; S1033: When the confirmation building command is received, for each specified block in the CAD file, according to the pose of the corresponding part of the specified block in the displayed underlying model, instantiating the 3D model represented by the specified block in the building interface; for each specified independent basic graphic element in the CAD file, according to the pose of the corresponding part of the specified independent basic graphic element in the displayed underlying model, instantiating the 3D model represented by the specified independent basic graphic element in the building interface. In this way, the basic graphic elements in the CAD file are sampled and the underlying model (also known as the base map) obtained based on the sampling points is displayed. This underlying model is not a bitmap texture, so there will be no pixelation or blurring or distortion at most viewing distances (especially at close range). It can present a clear and sharp vector graphic effect, avoid distortion due to magnification, and make it convenient to observe the underlying model as the underlying layer to understand the geometric relationships and spatial layout defined in the CAD file.
[0101] Regarding step S1031 above, since blocks are also composed of basic graphic elements, the electronic device can sample independent basic graphic elements and basic graphic elements contained in the block to obtain multiple sampling points.
[0102] For example, for a line segment, its endpoints can be obtained as sampling points; for a polyline, its turning points can be obtained as sampling points. For a curve, a series of points are sampled along the path of the curve according to the sampling interval to obtain sampling points.
[0103] Furthermore, to ensure curve smoothness, theoretically, the denser the sampling points, the better, but this would severely consume computational resources. Given that actual CAD files typically contain extremely large amounts of data, a balance can be struck between visual accuracy and rendering performance by downsampling the curves. For example, the sampling interval for a circle can be increased from one sampling point per 1° to one sampling point per 10°. This significantly reduces the number of sampling points, greatly improving rendering efficiency, while a moderate reduction in curve accuracy is visually acceptable since the base image is usually used as a reference background.
[0104] It is understandable that the confirmation build command can be triggered by the user when they confirm that the underlying model can accurately reflect the geometric relationships and spatial layout defined in the CAD file.
[0105] In one embodiment, before receiving a confirmation assembly instruction, the method further includes: when receiving a transformation instruction for the displayed underlying model, adjusting the displayed underlying model according to the adjustment method indicated by the transformation instruction; wherein the adjustment method indicated by the transformation instruction includes at least one of the following: translation, rotation, scaling up, and scaling down. In this way, the user can adjust the displayed underlying model, and correspondingly, the 3D model rendered based on the adjusted underlying model can meet the user's adjustment requirements.
[0106] It is understandable that the transformation command is triggered on the whole, consisting of the sampling points and connections of all basic graphic elements (including independent basic graphic elements and basic graphic elements contained in blocks).
[0107] During the CAD design phase, drawings may be based on a local coordinate system or specific drawing habits. This often leads to two types of problems when directly converting data from the CAD file to a 3D scene: 1. The drawing is located far from the origin of the 3D world (e.g., coordinates (0,0,0)), making the content of the 3D scene difficult to observe and manipulate. 2. The orientation of the drawing is inconsistent with the expected viewpoint of the 3D scene. These problems affect user experience and the accuracy of subsequent automated processes. Therefore, during browsing, users can choose to adjust the underlying model. For example, the interface of 3D simulation software can have adjustment function buttons. When the user triggers these buttons, the electronic device receives the transformation command to achieve the corresponding adjustment function.
[0108] Translation function: Allows users to move the entire underlying model to the world center of the 3D scene or any other suitable location. Rotation function: Allows users to adjust the rotation of the underlying model. Scaling function: Provides scaling capabilities, allowing users to scale proportionally or stretch freely.
[0109] In one embodiment, step S1031 includes the following steps: for each basic graphic element in the CAD file, sampling is performed on the basic graphic element at different sampling intervals to obtain multiple sampling results for the basic graphic element; wherein, one sampling result of the basic graphic element includes: the positions of multiple sampling points obtained according to a sampling interval and the connection order between the sampling points; the underlying model is displayed in the following manner: for each basic graphic element in the CAD file, the distance between the basic graphic element and the observation point is calculated; a sampling result corresponding to the distance is determined from the multiple sampling results of the basic graphic element; wherein, the number of sampling points included in a sampling result is negatively correlated with the corresponding distance; each sampling point in the determined sampling result is rendered in the building interface, and the connections between the sampling points are rendered according to the connection order in the determined sampling result. Thus, by displaying underlying models with different precision, rendering efficiency is improved while ensuring rendering quality.
[0110] For example, for each basic graphic element, sampling can be performed at different sampling intervals, resulting in sampling results of varying precision. After obtaining multiple sampling results, the electronic device can set the distance range corresponding to each sampling result. Subsequently, if it is determined that the distance between the basic graphic element and the observation point belongs to a certain distance range, the sampling results corresponding to that distance range are acquired, and the sampling points and connections are rendered according to those results.
[0111] Understandably, the number of sampling points in a sampling result is negatively correlated with the corresponding distance; that is, the greater the distance, the fewer sampling points the corresponding sampling result contains, and vice versa. When the distance between a basic graphic element and the observation point is large, fewer sampling points can be rendered without affecting browsing and can improve rendering efficiency; when the distance between a basic graphic element and the observation point is small, more sampling points can be rendered, improving rendering quality. In this way, multiple Level of Detail (LoD) versions are generated for the underlying model. Based on the distance between each part of the underlying model and the observation point (i.e., the camera), different levels of model precision are dynamically switched.
[0112] Since users can perform operations such as translation, rotation, scaling and zooming on the underlying model, the electronic device can recalculate the distance between each basic graphic element and the observation point each time the user performs an operation on the underlying model. Based on the calculated distance, the device can use the corresponding sampling results to render the sampling points and connections, so as to refresh and display the underlying model in real time according to the user's operation.
[0113] In one embodiment, due to user operations on the underlying model, there may be parts of the underlying model that are outside the current interface of the 3D simulation software (i.e., the camera's field of view). Therefore, to reduce the load on the GPU, these parts can be omitted from rendering. That is, the electronic device can render only the portion of the underlying model within the current viewing field of view.
[0114] In one embodiment, the method further includes stopping the display of the underlying model when instantiating the 3D model in the interface. This prevents the underlying model from affecting the user's browsing of the rendered 3D model, thus improving the user's browsing experience.
[0115] In this embodiment of the application, after the three-dimensional model represented by the specified block and the three-dimensional model represented by the specified independent basic graphic element are instantiated in the building interface, the electronic device can automatically stop displaying the underlying model.
[0116] In one embodiment, the interface may also include a button for controlling the display / display of the underlying model. After determining the 3D model represented by the specified block and the 3D model represented by the specified independent basic graphic element, if the underlying model is not currently displayed, the electronic device displays the underlying model when the user triggers the display button; if the underlying model is already displayed, the electronic device stops displaying the underlying model when the user triggers the display button.
[0117] In one embodiment, before instantiating the 3D model in the building interface, the method further includes: displaying a block configuration interface; wherein the block configuration interface includes a block selection area and a block configuration area; the block selection area displays block identifiers of the parsed blocks; when a first selection instruction is received for a block identifier in the block selection area, the block identifier indicated by the first selection instruction is displayed in the block configuration area; when a first configuration instruction is received for each block identifier in the block configuration area, the 3D model indicated by the first configuration instruction is determined as the 3D model represented by the specified block corresponding to that block identifier. Thus, users can configure the 3D model represented by the blocks according to their needs, meeting their flexible configuration requirements.
[0118] See Figure 3 , Figure 3 The interface can display the prompt: Instantiate the "block" in the CAD drawing as a "model entity". Figure 3 The left side is the block selection area. The "machine" and "workstation" displayed here represent the block identifiers (e.g., block names) of the parsed blocks. Users can select blocks as needed by checking boxes; the selected blocks are the designated blocks. Correspondingly, the right side is the block configuration area. As can be seen from the block configuration area on the right, for each block identifier, users can use the corresponding drop-down menu to indicate the 3D model (i.e., model entity) represented by that block identifier. Additionally, if a block does not need configuration, the block identifier can be deleted from the block configuration area using the "delete" button. The instance generation location is the block insertion point; that is, the 3D model represented by the block is instantiated in the building interface based on the block data.
[0119] For example, the interface may include a button to display the block configuration interface. After the CAD file is parsed and the blocks contained in the CAD file are determined, the electronic device will display the block configuration interface when the user triggers the button.
[0120] For example, after parsing a CAD file and determining the blocks it contains, the electronic device automatically displays a block configuration interface.
[0121] In one embodiment, before instantiating the 3D model in the interface, the method further includes: displaying a graphical element configuration interface; wherein the graphical element configuration interface includes a layer selection area and a layer configuration area; the layer selection area displays layer identifiers of the layers to which the parsed independent basic graphical elements belong; when a second selection instruction is received for a layer identifier in the layer selection area, the layer identifier indicated by the second selection instruction is displayed in the layer configuration area; when a second configuration instruction is received for each layer identifier in the layer configuration area, the 3D model indicated by the second configuration instruction is determined as the 3D model represented by the specified independent basic graphical element within the layer corresponding to that layer identifier. Thus, this interactive design is simple and effective. It transforms the complex problem of graphical semantic recognition into a problem of selecting pre-defined layers, ensuring the accuracy of automated processing while giving users full control and meeting their flexible configuration needs.
[0122] This embodiment utilizes the layer management mechanism of CAD as the selection criterion. Users only need to follow the relevant specifications when drawing CAD drawings, that is, placing independent basic graphic elements representing the same 3D model in one or more independent layers. Subsequently, the electronic device parses the CAD file to obtain its complete layer list and provides an intuitive interface for the user to specify the 3D model corresponding to each layer. See also... Figure 4 , Figure 4 The interface may display the prompt: Instantiate the "line" in the CAD drawing as a "model entity". Please select the CAD layer in question. Figure 4 The layer identifiers displayed in the middle layer selection area include "O" and "O-AGV". Users can select from... Figure 4 Select one or more layer identifiers from the displayed list, and indicate the 3D model corresponding to the selected layer identifier. The 3D model corresponding to the selected layer identifier is, in other words, the 3D model represented by the independent basic graphic elements within the layer corresponding to the selected layer identifier. The independent basic graphic elements within the layer corresponding to the selected layer identifier are the specified independent basic graphic elements.
[0123] For example, when drawing CAD drawings, a user can set the independent basic graphic elements representing a wall on one layer (Layer A), the independent basic graphic elements representing a corridor on one layer (Layer B), the independent basic graphic elements representing a robot's travel path on one layer (Layer C), and the independent basic graphic elements representing a passageway on one layer (Layer D). Subsequently, after parsing the layers, the electronic device can display the layer identifiers of each layer and, according to the user's configuration instructions, render the 3D model of the wall for the independent basic graphic elements in Layer A; render the 3D model of the corridor for the independent basic graphic elements in Layer B; render the 3D model of the robot's travel path for the independent basic graphic elements in Layer C; and render the 3D model of the passageway for the independent basic graphic elements in Layer D.
[0124] For example, the interface may include a button to display the graphic element configuration interface. After the CAD file is parsed to determine the independent basic graphic elements contained in the CAD file and the layers to which the independent basic graphic elements belong, the electronic device will display the graphic element configuration interface when the user triggers the display button.
[0125] For example, after parsing a CAD file to determine the independent basic graphic elements contained in the CAD file and the layers to which the independent basic graphic elements belong, the electronic device automatically displays the graphic element configuration interface.
[0126] See Figure 5 , Figure 5 The CAD drawing shown contains three blocks: block 501, block 502, and block 503. Each block is connected by an independent basic graphic element 504. Correspondingly, based on the 3D scene construction method provided in this application embodiment, a scene can be constructed as follows: Figure 6 The three-dimensional scene shown. Figure 6 In the model, the processing station 601 is a three-dimensional model represented by block 501, the picking station 602 is a three-dimensional model represented by block 502, the picking station 603 is a three-dimensional model represented by block 503, and the channel 604 is a three-dimensional model represented by independent basic graphic element 504.
[0127] See Figure 7 , Figure 7 The process shown includes the following steps:
[0128] S701: Retrieves user-imported CAD files.
[0129] S702: Draw the base map (i.e., the underlying model) in a 3D scene.
[0130] S703: Adjusts the offset, rotation, and scaling of the base map based on user actions.
[0131] S704: Determine the 3D model representing the specified block based on the user's configuration instructions.
[0132] S705: Instantiate the 3D model represented by the specified block based on the data of the corresponding part of the specified block in the underlying model.
[0133] S706: Determine the 3D model corresponding to the layer based on the user's configuration instructions.
[0134] S707: Instantiate the 3D model corresponding to the layer to which the specified independent basic graphic element belongs, based on the data of the corresponding part of the specified independent basic graphic element in the underlying model.
[0135] Based on the same inventive concept, this application also provides a three-dimensional scene construction device, see [link to relevant documentation]. Figure 8 The device includes:
[0136] The file acquisition module 801 is used to acquire the CAD file of the scene to be modeled;
[0137] The parsing module 802 is used to parse the CAD file and determine the independent basic graphic elements and blocks contained in the CAD file;
[0138] The instantiation module 803 is used to instantiate the 3D model represented by the specified block in the building interface for each specified block in the CAD file based on the data of the specified block recorded in the CAD file; and to instantiate the 3D model represented by the specified independent basic graphic element in the building interface for each specified independent basic graphic element in the CAD file based on the data of the specified independent basic graphic element recorded in the CAD file.
[0139] In an optional embodiment, the instantiation module 803 is specifically used to sample the parsed independent basic graphic elements and to sample the basic graphic elements contained in the parsed block to obtain the positions of multiple sampling points and the connection order between each sampling point.
[0140] Based on the obtained connection order and the position of the sampling points, render each sampling point and the connection between each sampling point in the building interface to obtain the underlying model, so that the user can trigger the confirmation building command based on the displayed underlying model.
[0141] When the confirmation assembly instruction is received, for each specified block in the CAD file, the 3D model represented by the specified block is instantiated in the assembly interface according to the data of the corresponding part of the specified block in the displayed underlying model; for each specified independent basic graphic element in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the assembly interface according to the data of the corresponding part of the specified independent basic graphic element in the displayed underlying model.
[0142] In an optional embodiment, the apparatus further includes:
[0143] The adjustment display module is used to adjust the underlying model of the display according to the adjustment method indicated by the transformation instruction when a transformation instruction for the underlying model of the display is received before the confirmation building instruction is received.
[0144] The adjustment method indicated by the transformation command includes at least one of the following: translation, rotation, scaling up, and scaling down.
[0145] In an optional embodiment, the instantiation module 803 is specifically used to sample each basic graphic element in the CAD file according to different sampling intervals to obtain multiple sampling results of the basic graphic element; wherein, one sampling result of the basic graphic element includes: the positions of multiple sampling points obtained according to a sampling interval and the connection order between the sampling points.
[0146] For each basic graphic element in the CAD file, calculate the current distance between that basic graphic element and the observation point;
[0147] From multiple sampling results of the basic graphic element, a sampling result corresponding to the distance is determined; wherein the number of sampling points contained in a sampling result is negatively correlated with the corresponding distance;
[0148] The interface renders each sampling point in the determined sampling results, and renders the connections between the sampling points according to the connection order in the determined sampling results.
[0149] In an optional embodiment, the apparatus further includes:
[0150] The Stop Display module is used to stop displaying the underlying model when instantiating a 3D model in the building interface.
[0151] In an optional embodiment, the apparatus further includes:
[0152] The first configuration module is used to display a block configuration interface before instantiating the 3D model in the building interface; wherein, the block configuration interface includes a block selection area and a block configuration area; the block selection area displays the block identifiers of the parsed blocks;
[0153] When a first selection instruction is received for a block identifier in the block selection area, the block identifier indicated by the first selection instruction is displayed in the block configuration area;
[0154] When a first configuration instruction is received for each block identifier in the block configuration area, the three-dimensional model indicated by the first configuration instruction is determined as the three-dimensional model representing the specified block corresponding to that block identifier.
[0155] In an optional embodiment, the apparatus further includes:
[0156] The second configuration module is used to display the graphic element configuration interface before instantiating the 3D model in the building interface; wherein, the graphic element configuration interface includes a layer selection area and a layer configuration area; the layer selection area displays the layer identifier of the layer to which the parsed independent basic graphic element belongs;
[0157] When a second selection instruction is received for a layer identifier in the layer selection area, the layer identifier indicated by the second selection instruction is displayed in the layer configuration area;
[0158] When a second configuration instruction is received for each layer identifier in the layer configuration area, the three-dimensional model indicated by the second configuration instruction is determined as a three-dimensional model represented by a specified independent basic graphic element in the layer corresponding to that layer identifier.
[0159] This application also provides an electronic device, such as... Figure 9 As shown, it includes:
[0160] Memory 901 is used to store computer programs;
[0161] When processor 902 executes a program stored in memory 901, it performs the following steps:
[0162] Obtain the CAD file of the scene to be modeled;
[0163] The CAD file is parsed to determine the independent basic graphic elements and blocks contained in the CAD file;
[0164] For each specified block in the CAD file, based on the data of the specified block recorded in the CAD file, the 3D model represented by the specified block is instantiated in the building interface; for each specified independent basic graphic element in the CAD file, based on the data of the specified independent basic graphic element recorded in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the building interface.
[0165] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 902, communication interface, and memory 901 communicating with each other via the communication bus.
[0166] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0167] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0168] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0169] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0170] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described three-dimensional scene construction methods.
[0171] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the three-dimensional scene construction methods described above.
[0172] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.
[0173] It should be noted that, in this document, relational terms such as "first" and "second" are used only 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.
[0174] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0175] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A three-dimensional scene building method, characterized in that, The method includes: Obtain the CAD file of the scene to be modeled; The CAD file is parsed to determine the independent basic graphic elements and blocks contained in the CAD file; For each specified block in the CAD file, based on the data of the specified block recorded in the CAD file, the 3D model represented by the specified block is instantiated in the building interface; for each specified independent basic graphic element in the CAD file, based on the data of the specified independent basic graphic element recorded in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the building interface.
2. The method of claim 1, wherein, For each specified block in the CAD file, based on the data of that specified block recorded in the CAD file, the 3D model representing that specified block is instantiated in the building interface; for each specified independent basic graphic element in the CAD file, based on the data of that specified independent basic graphic element recorded in the CAD file, the 3D model representing that specified independent basic graphic element is instantiated in the building interface, including: The independent basic graphic elements that are parsed out are sampled, and the basic graphic elements contained in the parsed block are sampled to obtain the positions of multiple sampling points and the connection order between each sampling point; Based on the obtained connection order and the position of the sampling points, render each sampling point and the connection between each sampling point in the building interface to obtain the underlying model, so that the user can trigger the confirmation building command based on the displayed underlying model. When the confirmation assembly instruction is received, for each specified block in the CAD file, the 3D model represented by the specified block is instantiated in the assembly interface according to the data of the corresponding part of the specified block in the displayed underlying model; for each specified independent basic graphic element in the CAD file, the 3D model represented by the specified independent basic graphic element is instantiated in the assembly interface according to the data of the corresponding part of the specified independent basic graphic element in the displayed underlying model.
3. The method according to claim 2, characterized in that, Before receiving the confirmation setup instruction, the method further includes: When a transformation instruction is received for the underlying model to be displayed, the underlying model to be displayed is adjusted according to the adjustment method indicated by the transformation instruction. The adjustment method indicated by the transformation command includes at least one of the following: translation, rotation, scaling up, and scaling down.
4. The method according to claim 2 or 3, characterized in that, The process of sampling the parsed independent basic graphic elements and sampling the basic graphic elements contained in the parsed blocks to obtain the positions of multiple sampling points and the connection order between the sampling points includes: For each basic graphic element in the CAD file, the basic graphic element is sampled at different sampling intervals to obtain multiple sampling results for the basic graphic element; wherein, one sampling result of the basic graphic element includes: the positions of multiple sampling points obtained according to a sampling interval and the connection order between the sampling points. The underlying model can be displayed in the following ways: For each basic graphic element in the CAD file, calculate the current distance between that basic graphic element and the observation point; From multiple sampling results of the basic graphic element, a sampling result corresponding to the distance is determined; wherein the number of sampling points contained in a sampling result is negatively correlated with the corresponding distance; The interface renders each sampling point in the determined sampling results, and renders the connections between the sampling points according to the connection order in the determined sampling results.
5. The method according to claim 2, characterized in that, The method further includes: When instantiating a 3D model in the interface, stop displaying the underlying model.
6. The method according to any one of claims 1 to 3, characterized in that, Before instantiating the 3D model in the interface, the method further includes: Display block configuration interface; wherein, the block configuration interface includes a block selection area and a block configuration area; the block selection area displays the block identifier of the parsed block; When a first selection instruction is received for a block identifier in the block selection area, the block identifier indicated by the first selection instruction is displayed in the block configuration area; When a first configuration instruction is received for each block identifier in the block configuration area, the three-dimensional model indicated by the first configuration instruction is determined as the three-dimensional model representing the specified block corresponding to that block identifier.
7. The method according to any one of claims 1 to 3, characterized in that, Before instantiating the 3D model in the interface, the method further includes: The graphical element configuration interface is displayed; wherein, the graphical element configuration interface includes a layer selection area and a layer configuration area; the layer selection area displays the layer identifier of the layer to which the parsed independent basic graphical element belongs; When a second selection instruction is received for a layer identifier in the layer selection area, the layer identifier indicated by the second selection instruction is displayed in the layer configuration area; When a second configuration instruction is received for each layer identifier in the layer configuration area, the three-dimensional model indicated by the second configuration instruction is determined as a three-dimensional model represented by a specified independent basic graphic element in the layer corresponding to that layer identifier.
8. A three-dimensional scene construction device, characterized in that, The device includes: The file acquisition module is used to acquire the CAD file of the scene to be modeled; The parsing module is used to parse the CAD file and determine the independent basic graphic elements and blocks contained in the CAD file; The instantiation module is used to instantiate the 3D model represented by each specified block in the CAD file in the building interface, based on the data of the specified block recorded in the CAD file; and to instantiate the 3D model represented by each specified independent basic graphic element in the CAD file in the building interface, based on the data of the specified independent basic graphic element recorded in the CAD file.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.