A method, device, medium and equipment for generating a three-dimensional subspace model based on CAD drawings
By processing and connecting domain analysis of the vector information of the target layer in the CAD drawing, a three-dimensional model of each subspace is generated, which solves the problem that the subspace cannot be displayed independently in the prior art, and realizes the flexible display of the architectural model.
Patent Information
- Application Number
- CN202411920068.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2044-12-25
AI Technical Summary
The prior art is difficult to independently display each subspace in the visualization of architectural models, resulting in inflexible display of architectural models.
By obtaining vector information of the target layer in the CAD drawing, drawing images containing all components, performing connectivity domain analysis, filtering the effective connectivity domain, and generating a three-dimensional model of each subspace.
The independent three-dimensional model generation of each subspace is realized, making the display of architectural models more flexible and refined.
Smart Images

Figure CN119359958B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional model reconstruction, and in particular to a method, device, medium and equipment for generating a three-dimensional model of a subspace based on CAD drawings. Background Art
[0002] When making a model based on CAD drawings, a three-dimensional model of an entire floor or an entire building is usually reconstructed. However, for some application scenarios that require detailed display of a three-dimensional model of a certain subspace, such as only needing to display the three-dimensional model in a certain room, these three-dimensional models of the entire floor or the entire building cannot be realized. Summary of the Invention
[0003] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a method, device, medium and equipment for generating a three-dimensional model of a subspace based on CAD drawings. To achieve the above purpose, the present invention is implemented by the following technical solutions:
[0004] In a first aspect, the present invention provides a method for generating a three-dimensional model of a subspace based on CAD drawings, including:
[0005] Obtain the vector information of the target layer in the CAD drawing, where the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes line information and arc information;
[0006] Draw an image containing all components according to the vector information, where the components include walls, doors, windows, and structural columns;
[0007] Perform connected component analysis on the image containing all components to obtain the connected component information corresponding to each subspace;
[0008] Generate a three-dimensional model of each subspace according to the connected component information;
[0009] The generating a three-dimensional model of each subspace according to the connected component information includes:
[0010] Screen the connected components in the connected component information whose area information is greater than a first threshold, and determine them as valid connected components;
[0011] Obtain the contour coordinate information of each valid connected component according to the edge information in the connected component information;
[0012] Convert the contour coordinate information into the corresponding contour coordinate information in the CAD drawing;
[0013] Obtain all component information in the CAD drawing located within the corresponding contour coordinates in the CAD drawing, where the components include walls, doors, windows, and structural columns;
[0014] Generate a three-dimensional model corresponding to each component according to the component information, and combine them into a three-dimensional model of the current subspace.
[0015] Combined with the first aspect, optionally, an image including all components is drawn according to the vector information, and the components include walls, doors, windows, and structural columns, including:
[0016] Initialize a blank image;
[0017] Draw a straight line in the blank image according to the straight line information in the vector information to obtain a straight line image;
[0018] Draw the radius of the arc in the straight line image according to the arc information in the vector information to obtain the image including all components.
[0019] Combined with the first aspect, optionally, drawing a straight line in the blank image according to the straight line information in the vector information includes:
[0020] Obtain the maximum rectangular bounding box information of the set composed of all straight lines, and the bounding box information includes the minimum x coordinate, the minimum y coordinate, the length in the x direction, and the length in the y direction;
[0021] Subtract the x value of all straight line endpoint coordinates from the minimum x coordinate to obtain the translated endpoint x coordinate, and subtract the y value of all straight line endpoint coordinates from the minimum y coordinate to obtain the translated endpoint y coordinate;
[0022] Determine the ratio of the maximum value of the length in the x direction and the length in the y direction to the maximum pixel value of the blank image as the scaling ratio value;
[0023] Scale the coordinates of the two endpoints of the translated straight line according to the scaling ratio value to obtain the scaled straight line endpoint coordinates;
[0024] Draw a straight line in the blank image according to the scaled straight line endpoint coordinates.
[0025] Combined with the first aspect, optionally, the connected domain information includes area information and edge information.
[0026] In a second aspect, the present invention provides a device for generating a three-dimensional model of a subspace based on a CAD drawing, including:
[0027] A vector information acquisition module for acquiring vector information of a target layer in a CAD drawing, where the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information;
[0028] An image drawing module that draws an image containing all components according to the vector information, where the components include walls, doors, windows, and structural columns;
[0029] A connected component analysis module that performs connected component analysis on the image containing all components to obtain the connected component information corresponding to each subspace;
[0030] A subspace model generation module that generates a three-dimensional model of each subspace according to the connected component information. Generating a three-dimensional model of each subspace according to the connected component information includes: screening the connected components in the connected component information whose area information is greater than a first threshold and determining them as valid connected components; obtaining the contour coordinate information of each valid connected component according to the edge information in the connected component information; converting the contour coordinate information into the corresponding contour coordinate information in a CAD drawing; obtaining all component information located within the corresponding contour coordinates in the CAD drawing, where the components include walls, doors, windows, and structural columns; generating a three-dimensional model corresponding to each component according to the component information and combining them into the three-dimensional model of the current subspace.
[0031] In a third aspect, the present invention provides a computer-readable storage medium with a computer program stored thereon. When the computer program is executed by a processor, it implements the method for generating a three-dimensional model of a subspace based on a CAD drawing as described in any one of the first aspects.
[0032] In a fourth aspect, the present invention provides a device for generating a three-dimensional model of a subspace based on a CAD drawing, including:
[0033] A memory for storing instructions;
[0034] A processor for executing the instructions, causing the device to perform operations for implementing the method for generating a three-dimensional model of a subspace based on a CAD drawing as described in any one of the first aspects.
[0035] Compared with the prior art, the beneficial effects achieved by the method, device, medium, and equipment for generating a three-dimensional model of a subspace based on a CAD drawing provided by the embodiments of the present invention include:
[0036] The present invention obtains the vector information of the target layer in the CAD drawing. The target layer includes a wall layer, a door layer, a window layer, and a structural column layer. The vector information includes straight line information and arc information. An image containing all components is drawn according to the vector information. The components include walls, doors, windows, and structural columns. Connected component analysis is performed on the image containing all components to obtain the connected component information corresponding to each subspace. According to the connected component information, a three-dimensional model of each subspace is generated. The present invention effectively solves the problem that each subspace cannot be independently displayed in the visualization of the building model, making the display of the building model more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 FIG. is a flowchart of a method for generating a three-dimensional model of a subspace based on a CAD drawing according to Embodiment 1 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0038] It should be noted that, without conflict, the embodiments in this embodiment and the features in the embodiments can be combined with each other. The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0039] Embodiment 1:
[0040] As Figure 1 shown, the embodiment of the present invention provides a method for generating a three-dimensional model of a subspace based on a CAD drawing, including:
[0041] S1: Obtain the vector information of the target layer in the CAD drawing. The target layer includes a wall layer, a door layer, a window layer, and a structural column layer. The vector information includes straight line information and arc information;
[0042] S2: Draw an image containing all components according to the vector information. The components include walls, doors, windows, and structural columns;
[0043] Specifically, the step of drawing an image containing all components according to the vector information, where the components include walls, doors, windows, and structural columns, includes:
[0044] S2-1: Initialize a blank image;
[0045] S2-2: Draw a straight line in the blank image according to the straight line information in the vector information to obtain a straight line image;
[0046] Specifically, drawing a straight line in the blank image according to the straight line information in the vector information includes:
[0047] S2-2-1: Obtain the maximum rectangular bounding box information of the set composed of all straight lines, where the bounding box information includes the minimum x coordinate, minimum y coordinate, x-direction length, and y-direction length;
[0048] S2-2-2: Subtract the minimum x coordinate from the x values of all straight line endpoint coordinates to obtain the translated endpoint x coordinates, and subtract the minimum y coordinate from the y values of all straight line endpoint coordinates to obtain the translated endpoint y coordinates;
[0049] S2-2-3: Determine the ratio of the maximum value of the x-direction length and the y-direction length to the maximum pixel value of the blank image as the scaling ratio value;
[0050] S2-2-4: Scale the coordinates of the two endpoints of the translated straight line according to the scaling ratio value to obtain the scaled straight line endpoint coordinates;
[0051] S2-2-5: Draw a straight line in the blank image according to the scaled straight line endpoint coordinates.
[0052] S2-3: Draw the radius of the arc in the straight line image according to the arc information in the vector information to obtain the image containing all components.
[0053] S3: Perform connected component analysis on the image containing all components to obtain the connected component information corresponding to each subspace;
[0054] S4: Generate a 3D model for each subspace according to the connected component information.
[0055] Specifically, generating a 3D model for each subspace according to the connected component information includes:
[0056] S4-1: Screen the connected components in the connected component information whose area information is greater than the first threshold and determine them as valid connected components;
[0057] S4-2: Obtain the contour coordinate information of each valid connected component according to the edge information in the connected component information;
[0058] S4-3: Convert the contour coordinate information into the corresponding contour coordinate information in the CAD drawing;
[0059] S4-4: Obtain all component information located within the corresponding contour coordinates in the CAD drawing, where the components include walls, doors, windows, and structural columns;
[0060] S4-5: Generate a 3D model corresponding to each component according to the component information, and combine them into the 3D model of the current subspace.
[0061] The method for generating a 3D model of a subspace based on CAD drawings provided by the present invention effectively solves the problem that each subspace cannot be independently displayed in the visualization of a building model, making the display of the building model more flexible.
[0062] Embodiment 2:
[0063] The embodiment of the present invention provides a device for generating a 3D model of a subspace based on CAD drawings, including:
[0064] A vector information acquisition module that acquires the vector information of the target layer in the CAD drawing, where the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes line information and arc information;
[0065] An image drawing module that draws an image including all components according to the vector information, where the components include walls, doors, windows, and structural columns;
[0066] A connected component analysis module that performs connected component analysis on the image including all components to obtain the connected component information corresponding to each subspace;
[0067] A subspace model generation module that generates a 3D model for each subspace according to the connected component information. The generating a 3D model for each subspace according to the connected component information includes: screening the connected components in the connected component information whose area information is greater than a first threshold and determining them as valid connected components; obtaining the contour coordinate information of each valid connected component according to the edge information in the connected component information; converting the contour coordinate information into the corresponding contour coordinate information in the CAD drawing; obtaining all component information in the CAD drawing located within the corresponding contour coordinates in the CAD drawing, where the components include walls, doors, windows, and structural columns; generating a 3D model corresponding to each component according to the component information, and combining them into the 3D model of the current subspace.
[0068] The device for generating a 3D model of a subspace based on CAD drawings provided by the present invention effectively solves the problem that each subspace cannot be independently displayed in the visualization of a building model, making the display of the building model more flexible.
[0069] Embodiment 3:
[0070] The embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements a method for generating a 3D model of a subspace based on CAD drawings as described in Embodiment 1.
[0071] Example 4:
[0072] An embodiment of the present invention provides a subspace three-dimensional model generation device based on CAD drawings, including:
[0073] A memory for storing instructions;
[0074] A processor for executing the instructions, so that the device performs operations to implement the method for generating a subspace three-dimensional model based on CAD drawings according to any one of the embodiments.
[0075] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0076] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0077] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0078] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Therefore, the instructions executed on the computer or other programmable device provide for implementing the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1Steps of the functions specified in one or more boxes.
[0079] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the technical principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A method for generating a subspace three-dimensional model based on a CAD drawing, characterized in that: include: Obtaining vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; Draw an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; Performing a connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; Generate a three-dimensional model of each subspace according to the connected domain information; Generating a three-dimensional model of each subspace according to the connected domain information includes: Screening the connected domain information, wherein the connected domain information has area information greater than a first threshold, and determining the connected domain as a valid connected domain; Acquire contour coordinate information of each valid connected domain according to edge information in the connected domain information; Convert the outline coordinate information into corresponding outline coordinate information in the CAD drawing; Obtaining all component information in the CAD drawing that is located within the corresponding contour coordinates in the CAD drawing, wherein the components include walls, doors, windows, and structural columns; According to the component information, a three-dimensional model corresponding to each component is generated and combined into a current subspace three-dimensional model.
2. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 1, characterized in that: The step of obtaining an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns, includes: Initialize a blank image; According to the straight line information in the vector information, a straight line is drawn in the blank image to obtain a straight line image; According to the arc information in the vector information, the radius of the arc is drawn in the straight line image to obtain the image containing all the components.
3. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 2, characterized in that: Drawing a straight line in the blank image according to the straight line information in the vector information includes: Obtaining the maximum rectangular bounding box information of the set composed of all straight lines, wherein the bounding box information includes the minimum x coordinate, the minimum y coordinate, the length in the x direction, and the length in the y direction; Subtract the x-coordinates of all the straight line endpoints from the minimum x-coordinate to obtain the x-coordinates of the endpoints after translation, and subtract the y-coordinates of all the straight line endpoints from the minimum y-coordinate to obtain the y-coordinates of the endpoints after translation; Determine the ratio of the maximum value of the length in the x direction and the length in the y direction to the maximum pixel value of the blank image as the scaling value; According to the scaling ratio value, the coordinates of the two endpoints of the translated straight line are scaled to obtain the scaled straight line endpoint coordinates; A straight line is drawn in the blank image according to the zoomed straight line endpoint coordinates.
4. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 1, characterized in that: The connected domain information includes area information and edge information.
5. A subspace three-dimensional model generation device based on CAD drawings, characterized in that: include: A vector information acquisition module, which acquires vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; An image drawing module, which draws an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; A connected domain analysis module performs connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; A subspace model generation module generates a three-dimensional model of each subspace according to the connected domain information, wherein the generating of the three-dimensional model of each subspace according to the connected domain information includes: screening the connected domains whose area information is greater than a first threshold in the connected domain information to determine them as valid connected domains; The contour coordinate information of each valid connected domain is obtained according to the edge information in the connected domain information; the contour coordinate information is converted into the corresponding contour coordinate information in the CAD drawing; all component information in the CAD drawing located within the corresponding contour coordinates in the CAD drawing is obtained, wherein the components include walls, doors, windows, and structural columns; according to the component information, a three-dimensional model corresponding to each component is generated, and they are combined into a current subspace three-dimensional model.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a subspace three-dimensional model based on a CAD drawing as described in any one of claims 1 to 4 is implemented.
7. A device for generating a subspace three-dimensional model based on a CAD drawing, characterized in that: include: A memory for storing instructions; A processor is used to execute the instruction so that the device performs the operation of implementing the subspace three-dimensional model generation method based on CAD drawings as described in any one of claims 1-4.
Citation Information
Patent Citations
A three-dimensional rapid modeling system and method based on a building two-dimensional CAD drawing
CN109710963A
Method for automatically constructing Revit three-dimensional model through CAD plane drawing
CN115510530A